@afilimax/core 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/affiliate-manager.d.ts +18 -0
- package/dist/affiliate-manager.js +33 -0
- package/dist/enums/marketplace.enum.d.ts +2 -1
- package/dist/enums/marketplace.enum.js +1 -0
- package/dist/helpers/config.helper.d.ts +14 -0
- package/dist/helpers/config.helper.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces/affiliate-provider.interface.d.ts +8 -0
- package/dist/interfaces/affiliate-provider.interface.js +13 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/url-validators/index.d.ts +10 -0
- package/dist/utils/url-validators/index.js +46 -0
- package/dist/utils/url-validators/is-aliexpress-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-aliexpress-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-amazon-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-amazon-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-americanas-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-americanas-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-kabum-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-kabum-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-magazine-luiza-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-magazine-luiza-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-mercado-livre-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-mercado-livre-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-pichau-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-pichau-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-shopee-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-shopee-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-temu-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-temu-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-terabyte-shop-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-terabyte-shop-product-url.util.js +7 -0
- package/package.json +40 -40
package/README.md
CHANGED
|
@@ -86,6 +86,62 @@ const product = scrapedProductSchema.parse({
|
|
|
86
86
|
})
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
### Provedores de Afiliados
|
|
90
|
+
|
|
91
|
+
O `AffiliateProvider` é uma classe abstrata fundamental para estender as capacidades de afiliação do ecossistema Afilimax.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { AffiliateProvider } from "@afilimax/core"
|
|
95
|
+
|
|
96
|
+
interface CustomOptions {
|
|
97
|
+
trackingId: string
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
class MyProvider extends AffiliateProvider<CustomOptions> {
|
|
101
|
+
name = "Meu Provedor"
|
|
102
|
+
domains = ["loja-exemplo.com.br"]
|
|
103
|
+
|
|
104
|
+
// Implementação obrigatória para gerar o link
|
|
105
|
+
createAffiliateUrl = async (url: string) => {
|
|
106
|
+
return `https://link-afiliado.com?id=${this.options.trackingId}&url=${url}`
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const provider = new MyProvider({ trackingId: "user-123" })
|
|
111
|
+
|
|
112
|
+
// Verifica se uma URL pertence ao provedor
|
|
113
|
+
if (provider.supportsUrl("https://loja-exemplo.com.br/item")) {
|
|
114
|
+
const affiliateUrl = await provider.createAffiliateUrl("https://loja-exemplo.com.br/item")
|
|
115
|
+
console.log(affiliateUrl)
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Gerenciamento de Provedores (Encadeamento)
|
|
120
|
+
|
|
121
|
+
O `AffiliateManager` permite agrupar múltiplos provedores e encontrar automaticamente o correto para uma determinada URL.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { AffiliateManager } from "@afilimax/core"
|
|
125
|
+
|
|
126
|
+
const manager = new AffiliateManager([
|
|
127
|
+
new AmazonProvider(options),
|
|
128
|
+
new ShopeeProvider(options),
|
|
129
|
+
new MagaluProvider(options)
|
|
130
|
+
])
|
|
131
|
+
|
|
132
|
+
// O manager encontrará o provedor correto baseado nos domínios suportados.
|
|
133
|
+
// Caso nenhum provedor suporte a URL, retornará null.
|
|
134
|
+
const url = "https://www.amazon.com.br/dp/B088GHHR6K"
|
|
135
|
+
const affiliateUrl = await manager.createAffiliateUrl(url)
|
|
136
|
+
|
|
137
|
+
if (affiliateUrl) {
|
|
138
|
+
console.log("URL de afiliado:", affiliateUrl)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Você também pode adicionar novos provedores dinamicamente
|
|
142
|
+
manager.use(new CustomProvider())
|
|
143
|
+
```
|
|
144
|
+
|
|
89
145
|
## Licença
|
|
90
146
|
|
|
91
147
|
Este projeto está sob a licença MIT.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AffiliateProvider } from "./interfaces/affiliate-provider.interface";
|
|
2
|
+
export declare class AffiliateManager {
|
|
3
|
+
private readonly providers;
|
|
4
|
+
constructor(providers: AffiliateProvider<any>[]);
|
|
5
|
+
/**
|
|
6
|
+
* Encontra o primeiro provedor que suporta a URL fornecida.
|
|
7
|
+
*/
|
|
8
|
+
findProvider(url: string): AffiliateProvider<any> | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Cria uma URL de afiliado usando o primeiro provedor compatível encontrado.
|
|
11
|
+
* Caso nenhum provedor seja encontrado, retorna null.
|
|
12
|
+
*/
|
|
13
|
+
createAffiliateUrl(url: string): Promise<string | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Adiciona um provedor ao início da cadeia.
|
|
16
|
+
*/
|
|
17
|
+
use(provider: AffiliateProvider<any>): this;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AffiliateManager = void 0;
|
|
4
|
+
class AffiliateManager {
|
|
5
|
+
constructor(providers) {
|
|
6
|
+
this.providers = providers;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Encontra o primeiro provedor que suporta a URL fornecida.
|
|
10
|
+
*/
|
|
11
|
+
findProvider(url) {
|
|
12
|
+
return this.providers.find(provider => provider.supportsUrl(url));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Cria uma URL de afiliado usando o primeiro provedor compatível encontrado.
|
|
16
|
+
* Caso nenhum provedor seja encontrado, retorna null.
|
|
17
|
+
*/
|
|
18
|
+
async createAffiliateUrl(url) {
|
|
19
|
+
const provider = this.findProvider(url);
|
|
20
|
+
if (!provider) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return provider.createAffiliateUrl(url);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adiciona um provedor ao início da cadeia.
|
|
27
|
+
*/
|
|
28
|
+
use(provider) {
|
|
29
|
+
this.providers.unshift(provider);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.AffiliateManager = AffiliateManager;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const configHelper: {
|
|
2
|
+
domains: {
|
|
3
|
+
amazon: string[];
|
|
4
|
+
mercado_livre: string[];
|
|
5
|
+
shopee: string[];
|
|
6
|
+
aliexpress: string[];
|
|
7
|
+
magazine_luiza: string[];
|
|
8
|
+
kabum: string[];
|
|
9
|
+
terabyte_shop: string[];
|
|
10
|
+
pichau: string[];
|
|
11
|
+
americanas: string[];
|
|
12
|
+
temu: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configHelper = void 0;
|
|
4
|
+
const enums_1 = require("../enums");
|
|
5
|
+
exports.configHelper = {
|
|
6
|
+
domains: {
|
|
7
|
+
[enums_1.Marketplace.Amazon]: ["amazon.com", "amazon.com.br", "amzn.to", "a.co"],
|
|
8
|
+
[enums_1.Marketplace.MercadoLivre]: ["mercadolivre.com.br", "mercadolivre.com"],
|
|
9
|
+
[enums_1.Marketplace.Shopee]: ["shopee.com.br", "shopee.com"],
|
|
10
|
+
[enums_1.Marketplace.AliExpress]: ["aliexpress.com"],
|
|
11
|
+
[enums_1.Marketplace.MagazineLuiza]: ["magazineluiza.com.br", "magazinevoce.com.br", "magazineluiza.onelink.me"],
|
|
12
|
+
[enums_1.Marketplace.Kabum]: ["kabum.com.br"],
|
|
13
|
+
[enums_1.Marketplace.TerabyteShop]: ["terabyteshop.com.br"],
|
|
14
|
+
[enums_1.Marketplace.Pichau]: ["pichau.com.br"],
|
|
15
|
+
[enums_1.Marketplace.Americanas]: ["americanas.com.br"],
|
|
16
|
+
[enums_1.Marketplace.Temu]: ["temu.com"],
|
|
17
|
+
},
|
|
18
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./interfaces"), exports);
|
|
18
18
|
__exportStar(require("./schemas"), exports);
|
|
19
19
|
__exportStar(require("./enums"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./affiliate-manager"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare abstract class AffiliateProvider<TOptions> {
|
|
2
|
+
protected readonly options: TOptions;
|
|
3
|
+
abstract domains: string[];
|
|
4
|
+
constructor(options: TOptions);
|
|
5
|
+
abstract name: string;
|
|
6
|
+
supportsUrl(url: string): boolean;
|
|
7
|
+
abstract createAffiliateUrl: (url: string) => Promise<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AffiliateProvider = void 0;
|
|
4
|
+
class AffiliateProvider {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
supportsUrl(url) {
|
|
9
|
+
const hostname = new URL(url).hostname;
|
|
10
|
+
return this.domains.some(domain => hostname === domain || hostname.endsWith(`.${domain}`));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AffiliateProvider = AffiliateProvider;
|
package/dist/interfaces/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./price.interface"), exports);
|
|
|
18
18
|
__exportStar(require("./product.interface"), exports);
|
|
19
19
|
__exportStar(require("./shipping.interface"), exports);
|
|
20
20
|
__exportStar(require("./coupon.interface"), exports);
|
|
21
|
+
__exportStar(require("./affiliate-provider.interface"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./url-validators";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./url-validators"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./is-amazon-product-url.util";
|
|
2
|
+
export * from "./is-aliexpress-product-url.util";
|
|
3
|
+
export * from "./is-shopee-product-url.util";
|
|
4
|
+
export * from "./is-terabyte-shop-product-url.util";
|
|
5
|
+
export * from "./is-kabum-product-url.util";
|
|
6
|
+
export * from "./is-pichau-product-url.util";
|
|
7
|
+
export * from "./is-temu-product-url.util";
|
|
8
|
+
export * from "./is-magazine-luiza-product-url.util";
|
|
9
|
+
export * from "./is-americanas-product-url.util";
|
|
10
|
+
export declare function isValidProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.isValidProductUrl = isValidProductUrl;
|
|
18
|
+
const is_magazine_luiza_product_url_util_1 = require("./is-magazine-luiza-product-url.util");
|
|
19
|
+
const is_terabyte_shop_product_url_util_1 = require("./is-terabyte-shop-product-url.util");
|
|
20
|
+
const is_americanas_product_url_util_1 = require("./is-americanas-product-url.util");
|
|
21
|
+
const is_aliexpress_product_url_util_1 = require("./is-aliexpress-product-url.util");
|
|
22
|
+
const is_shopee_product_url_util_1 = require("./is-shopee-product-url.util");
|
|
23
|
+
const is_pichau_product_url_util_1 = require("./is-pichau-product-url.util");
|
|
24
|
+
const is_amazon_product_url_util_1 = require("./is-amazon-product-url.util");
|
|
25
|
+
const is_kabum_product_url_util_1 = require("./is-kabum-product-url.util");
|
|
26
|
+
const is_temu_product_url_util_1 = require("./is-temu-product-url.util");
|
|
27
|
+
__exportStar(require("./is-amazon-product-url.util"), exports);
|
|
28
|
+
__exportStar(require("./is-aliexpress-product-url.util"), exports);
|
|
29
|
+
__exportStar(require("./is-shopee-product-url.util"), exports);
|
|
30
|
+
__exportStar(require("./is-terabyte-shop-product-url.util"), exports);
|
|
31
|
+
__exportStar(require("./is-kabum-product-url.util"), exports);
|
|
32
|
+
__exportStar(require("./is-pichau-product-url.util"), exports);
|
|
33
|
+
__exportStar(require("./is-temu-product-url.util"), exports);
|
|
34
|
+
__exportStar(require("./is-magazine-luiza-product-url.util"), exports);
|
|
35
|
+
__exportStar(require("./is-americanas-product-url.util"), exports);
|
|
36
|
+
function isValidProductUrl(url) {
|
|
37
|
+
return ((0, is_amazon_product_url_util_1.isAmazonProductUrl)(url) ||
|
|
38
|
+
(0, is_aliexpress_product_url_util_1.isAliExpressProductUrl)(url) ||
|
|
39
|
+
(0, is_shopee_product_url_util_1.isShopeeProductUrl)(url) ||
|
|
40
|
+
(0, is_terabyte_shop_product_url_util_1.isTerabyteShopProductUrl)(url) ||
|
|
41
|
+
(0, is_kabum_product_url_util_1.isKabumProductUrl)(url) ||
|
|
42
|
+
(0, is_pichau_product_url_util_1.isPichauProductUrl)(url) ||
|
|
43
|
+
(0, is_temu_product_url_util_1.isTemuProductUrl)(url) ||
|
|
44
|
+
(0, is_magazine_luiza_product_url_util_1.isMagazineLuizaProductUrl)(url) ||
|
|
45
|
+
(0, is_americanas_product_url_util_1.isAmericanasProductUrl)(url));
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAliExpressProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAliExpressProductUrl = isAliExpressProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAliExpressProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.aliexpress.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAmazonProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAmazonProductUrl = isAmazonProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAmazonProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.amazon.join("|");
|
|
7
|
+
const amazonProductRegex = new RegExp(`https?://(?:www\\.)?(?:${domainPattern})/(?:.+/)?(?:gp/product|dp|exec/obidos/tg/detail|gp/aw/d|gp/offer-listing|d)/[\\w\\d]+|https://amzn\\.to/[\\w\\d]+`, "i");
|
|
8
|
+
return amazonProductRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAmericanasProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAmericanasProductUrl = isAmericanasProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAmericanasProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.americanas.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isKabumProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isKabumProductUrl = isKabumProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isKabumProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.kabum.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMagazineLuizaProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMagazineLuizaProductUrl = isMagazineLuizaProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isMagazineLuizaProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.magazine_luiza.join("|");
|
|
7
|
+
const magazineLuizaRegex = new RegExp(`^https?://(?:www\\.)?(?:${domainPattern})/(?:.+)?`, "i");
|
|
8
|
+
return magazineLuizaRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMercadoLivreProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMercadoLivreProductUrl = isMercadoLivreProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isMercadoLivreProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.mercado_livre.join("|");
|
|
7
|
+
const mercadoLivreProductRegex = new RegExp(`^https?://(?:www\\.|lista\\.|produto\\.)?(?:${domainPattern})/(?:[^/]+/)?(ML[AB]-?\\d{7,}|p/[\\w\\d]+|sec/[\\w\\d]+)`, "i");
|
|
8
|
+
return mercadoLivreProductRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPichauProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPichauProductUrl = isPichauProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isPichauProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.pichau.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isShopeeProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isShopeeProductUrl = isShopeeProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isShopeeProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.shopee.join("|");
|
|
7
|
+
const shopeeRegex = new RegExp(`^https?://(?:www\\.|s\\.)?(?:${domainPattern})/(?:.+-)?i\\.\\d+\\.\\d+|^https://shp\\.ee/[\\w\\d]+`, "i");
|
|
8
|
+
return shopeeRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTemuProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTemuProductUrl = isTemuProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isTemuProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.temu.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTerabyteShopProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTerabyteShopProductUrl = isTerabyteShopProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isTerabyteShopProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.terabyte_shop.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@afilimax/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "commonjs",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist/*",
|
|
10
|
-
"!/**/__tests__"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsc",
|
|
14
|
-
"dev": "ts-node ./src/index.ts",
|
|
15
|
-
"format": "prettier --write \"src/**/*.ts\""
|
|
16
|
-
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"afilimax",
|
|
22
|
-
"brazilian marketplaces scraper",
|
|
23
|
-
"brazilian afiliate marketing"
|
|
24
|
-
],
|
|
25
|
-
"author": "Marcuth",
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@types/node": "^25.2
|
|
29
|
-
"eslint": "^10.0.
|
|
30
|
-
"eslint-config-prettier": "^10.1.8",
|
|
31
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
32
|
-
"prettier": "^3.8.1",
|
|
33
|
-
"prettier-plugin-sort-imports": "^1.8.
|
|
34
|
-
"ts-node": "^10.9.2",
|
|
35
|
-
"typescript": "^5.9.3"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"zod": "^4.3.6"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@afilimax/core",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/*",
|
|
10
|
+
"!/**/__tests__"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "ts-node ./src/index.ts",
|
|
15
|
+
"format": "prettier --write \"src/**/*.ts\""
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"afilimax",
|
|
22
|
+
"brazilian marketplaces scraper",
|
|
23
|
+
"brazilian afiliate marketing"
|
|
24
|
+
],
|
|
25
|
+
"author": "Marcuth",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^25.3.2",
|
|
29
|
+
"eslint": "^10.0.2",
|
|
30
|
+
"eslint-config-prettier": "^10.1.8",
|
|
31
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
32
|
+
"prettier": "^3.8.1",
|
|
33
|
+
"prettier-plugin-sort-imports": "^1.8.11",
|
|
34
|
+
"ts-node": "^10.9.2",
|
|
35
|
+
"typescript": "^5.9.3"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"zod": "^4.3.6"
|
|
39
|
+
}
|
|
40
|
+
}
|