@factorypure/client-helpers 1.0.27 → 1.0.28

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 CHANGED
@@ -362,6 +362,7 @@ export declare const HIDE_REASONS: {
362
362
  REFURBISHED_USED: string;
363
363
  SKIP_SKU: string;
364
364
  VENDOR_EXCLUSION: string;
365
+ SCAM_SOURCE_EXCLUSION: string;
365
366
  };
366
367
  export declare const HIDE_OVERRIDE_REASONS: {
367
368
  SKU_MATCH: string;
package/dist/index.js CHANGED
@@ -167,6 +167,7 @@ export const HIDE_REASONS = {
167
167
  REFURBISHED_USED: 'Refurbished/Used',
168
168
  SKIP_SKU: 'Skipped SKU',
169
169
  VENDOR_EXCLUSION: 'Vendor Exclusion',
170
+ SCAM_SOURCE_EXCLUSION: 'Scam Source Exclusion',
170
171
  };
171
172
  export const HIDE_OVERRIDE_REASONS = {
172
173
  SKU_MATCH: 'SKU Match',
@@ -187,6 +188,7 @@ const HIDE_ALWAYS_MAP = {
187
188
  [HIDE_REASONS.REFURBISHED_USED]: false,
188
189
  [HIDE_REASONS.SKIP_SKU]: false,
189
190
  [HIDE_REASONS.VENDOR_EXCLUSION]: false,
191
+ [HIDE_REASONS.SCAM_SOURCE_EXCLUSION]: true,
190
192
  };
191
193
  export const TOO_CHEAP_MULTIPLIER = 0.75;
192
194
  export const TOO_EXPENSIVE_MULTIPLIER = 1.15;
@@ -200,6 +202,7 @@ export const filterScrapeResults = ({ scrapeResults, variant, filters, globalScr
200
202
  filteredResults = handleExclusionsSearch(filteredResults, filters, variant);
201
203
  filteredResults = handleSkipSkuSearch(filteredResults, filters, variant);
202
204
  filteredResults = handleVendorExclusions(filteredResults, filters, variant);
205
+ filteredResults = filterScamExclusions(filteredResults, globalScrapeOptions?.scam_sources || []);
203
206
  return filteredResults;
204
207
  };
205
208
  const handleVendorExclusions = (dataToSearch, filters, variant) => {
@@ -387,6 +390,18 @@ const filterCompetitors = (results, competitor_exclusions) => {
387
390
  });
388
391
  return results;
389
392
  };
393
+ const filterScamExclusions = (results, scam_sources) => {
394
+ results.forEach((item) => {
395
+ if (!item.hide_reasons) {
396
+ item.hide_reasons = [];
397
+ }
398
+ const lowerSource = item.source.toLowerCase();
399
+ if (scam_sources.some((exclusion) => exclusion && lowerSource === exclusion.toLowerCase())) {
400
+ item.hide_reasons.push(HIDE_REASONS.SCAM_SOURCE_EXCLUSION);
401
+ }
402
+ });
403
+ return results;
404
+ };
390
405
  const filterDuplicateResults = (results) => {
391
406
  const filteredUniqueResultsMap = {};
392
407
  results.forEach((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorypure/client-helpers",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",