@factorypure/client-helpers 1.1.19 → 1.1.21

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -667,7 +667,7 @@ class LowPriceOutlierRule {
667
667
  overridableBy = [];
668
668
  evaluate(context) {
669
669
  const multiplier = getUndercutThreshold(context.variant.price, context.globalScrapeOptions.undercut_threshold_ranges || []);
670
- const isTooCheap = context.result.extracted_price < context.variant.price * multiplier;
670
+ const isTooCheap = (context.result.extracted_total ?? context.result.extracted_price ?? 0) < context.variant.price * multiplier;
671
671
  if (isTooCheap) {
672
672
  return {
673
673
  ruleId: this.id,
@@ -675,7 +675,7 @@ class LowPriceOutlierRule {
675
675
  message: HIDE_REASONS.LOW_PRICE_OUTLIER,
676
676
  metadata: {
677
677
  variantPrice: context.variant.price,
678
- resultPrice: context.result.extracted_price,
678
+ resultPrice: context.result.extracted_total ?? context.result.extracted_price ?? 0,
679
679
  threshold: multiplier,
680
680
  },
681
681
  timestamp: new Date().toISOString(),
@@ -727,7 +727,7 @@ class CompetitorExclusionRule {
727
727
  priority = 80;
728
728
  enabled = true;
729
729
  canBeOverridden = true;
730
- overridableBy = ['sku_match', 'calculated_sku_match', 'alt_sku_match'];
730
+ overridableBy = [];
731
731
  evaluate(context) {
732
732
  const lowerSource = context.result.source.toLowerCase();
733
733
  const isExcluded = context.variantScrapeOptions.competitor_exclusions.some((exclusion) => exclusion && lowerSource === exclusion.toLowerCase());
@@ -1522,6 +1522,7 @@ export const filterScrapeResultsV2 = ({ scrapeResults, variant, variantScrapeOpt
1522
1522
  function handleDuplicatesV2(results) {
1523
1523
  const filteredUniqueResultsMap = {};
1524
1524
  results.forEach((item) => {
1525
+ // TODO ALEX this should probably compare on listing_hash
1525
1526
  const key = `${item.source}-${item.title}-${item.extracted_total ?? item.extracted_price}`;
1526
1527
  if (!filteredUniqueResultsMap[key]) {
1527
1528
  filteredUniqueResultsMap[key] = item;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorypure/client-helpers",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "scripts": {
12
12
  "build": "tsc",
13
+ "watch": "tsc --watch",
13
14
  "test": "echo \"Error: no test specified\" && exit 1"
14
15
  },
15
16
  "keywords": [],