@factorypure/client-helpers 1.0.9 → 1.0.10
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/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type ScrapeFiltersType = {
|
|
|
9
9
|
competitor_exclusions: string[];
|
|
10
10
|
match_values: string[];
|
|
11
11
|
skip_skus: string[];
|
|
12
|
+
skip_vendors: string[];
|
|
12
13
|
vendor_search_exclusions: string[];
|
|
13
14
|
search_exclusions: string[];
|
|
14
15
|
result_ignore_keys: string[] | null;
|
|
@@ -22,6 +23,7 @@ export type FilterOptionsType = {
|
|
|
22
23
|
duplicates_filter_enabled?: boolean;
|
|
23
24
|
search_index_enabled?: boolean;
|
|
24
25
|
skip_skus_enabled?: boolean;
|
|
26
|
+
skip_vendors_enabled?: boolean;
|
|
25
27
|
wattage_exclusions_enabled?: boolean;
|
|
26
28
|
search_exclusions_enabled?: boolean;
|
|
27
29
|
exclude_ignored_keys_enabled?: boolean;
|
|
@@ -33,6 +35,7 @@ export declare const filterScrapeResults: ({ scrapeResults, variant, filters, fi
|
|
|
33
35
|
title: string;
|
|
34
36
|
sku: string;
|
|
35
37
|
price: number;
|
|
38
|
+
vendor: string;
|
|
36
39
|
};
|
|
37
40
|
filters: ScrapeFiltersType;
|
|
38
41
|
filterOptions?: FilterOptionsType;
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,12 @@ const handleIndexSearch = (dataToSearch, filters, variant, filterOptions) => {
|
|
|
111
111
|
.map((sku) => ` ${sku} `);
|
|
112
112
|
nots.push(...formatted);
|
|
113
113
|
}
|
|
114
|
+
if (filters.skip_vendors.length && filterOptions.skip_vendors_enabled) {
|
|
115
|
+
const formatted = filters.skip_vendors
|
|
116
|
+
.filter((vendor) => vendor.toLowerCase() !== variant.vendor.toLowerCase())
|
|
117
|
+
.map((vendor) => ` ${vendor} `);
|
|
118
|
+
nots.push(...formatted);
|
|
119
|
+
}
|
|
114
120
|
const lowerCaseTitle = title.toLowerCase();
|
|
115
121
|
const titleWithoutSku = lowerCaseTitle.replace(sku.toLowerCase(), "");
|
|
116
122
|
const wattageTerms = Array.from(titleWithoutSku.matchAll(/\b(\d{4,5})w\b/gi)).map((match) => match[1]);
|