@factorypure/client-helpers 1.1.17 → 1.1.18
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 +1 -0
- package/dist/index.js +50 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -681,6 +681,7 @@ export declare const HIDE_OVERRIDE_REASONS: {
|
|
|
681
681
|
CALCULATED_SKU_MATCH: string;
|
|
682
682
|
CALCULATED_SKU_PARTIAL_MATCH: string;
|
|
683
683
|
CALCULATED_ALT_SKU_MATCH: string;
|
|
684
|
+
AI_COMPARISON_MATCH: string;
|
|
684
685
|
};
|
|
685
686
|
export declare const TOO_CHEAP_MULTIPLIER = 0.75;
|
|
686
687
|
export declare const TOO_EXPENSIVE_MULTIPLIER = 1.15;
|
package/dist/index.js
CHANGED
|
@@ -421,6 +421,7 @@ export const HIDE_OVERRIDE_REASONS = {
|
|
|
421
421
|
CALCULATED_SKU_MATCH: 'Calculated SKU Match',
|
|
422
422
|
CALCULATED_SKU_PARTIAL_MATCH: 'Calculated SKU Partial Match',
|
|
423
423
|
CALCULATED_ALT_SKU_MATCH: 'Calc. Alt SKU Match',
|
|
424
|
+
AI_COMPARISON_MATCH: 'AI Comparison Match',
|
|
424
425
|
};
|
|
425
426
|
const HIDE_ALWAYS_MAP = {
|
|
426
427
|
[HIDE_REASONS.HIGH_PRICE_OUTLIER]: true,
|
|
@@ -1191,6 +1192,55 @@ class RefurbishedUsedRule {
|
|
|
1191
1192
|
// ===============================
|
|
1192
1193
|
// Override Rules
|
|
1193
1194
|
// ===============================
|
|
1195
|
+
/**
|
|
1196
|
+
* Rule for filtering AI comparison mismatches
|
|
1197
|
+
*/
|
|
1198
|
+
class AIComparisonOverrideRule {
|
|
1199
|
+
id = 'ai_comparison_override';
|
|
1200
|
+
name = 'AI Comparison Override';
|
|
1201
|
+
description = 'Filters results where AI comparison determined the listing does match the variant';
|
|
1202
|
+
severity = FilterSeverity.INFO;
|
|
1203
|
+
priority = 200;
|
|
1204
|
+
enabled = true;
|
|
1205
|
+
canBeOverridden = true;
|
|
1206
|
+
overridableBy = [];
|
|
1207
|
+
evaluate(context) {
|
|
1208
|
+
// Only applies to results with listing_hash (primarily immersive results)
|
|
1209
|
+
const result = context.result;
|
|
1210
|
+
if (!result.listing_hash || !context.comparisonMap) {
|
|
1211
|
+
return null;
|
|
1212
|
+
}
|
|
1213
|
+
const variantId = String(context.variant.id);
|
|
1214
|
+
const listingHash = result.listing_hash;
|
|
1215
|
+
// Check if we have comparison data for this variant and listing
|
|
1216
|
+
const variantComparisons = context.comparisonMap[variantId];
|
|
1217
|
+
if (!variantComparisons) {
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
const comparison = variantComparisons[listingHash];
|
|
1221
|
+
if (!comparison) {
|
|
1222
|
+
return null;
|
|
1223
|
+
}
|
|
1224
|
+
// Only filter confirmed overrides (is_match = 1 AND sufficient_info = 1)
|
|
1225
|
+
// Allow results where we don't have sufficient info to compare
|
|
1226
|
+
if (comparison.is_match === 1 && comparison.sufficient_info === 1) {
|
|
1227
|
+
return {
|
|
1228
|
+
ruleId: this.id,
|
|
1229
|
+
severity: this.severity,
|
|
1230
|
+
message: HIDE_OVERRIDE_REASONS.AI_COMPARISON_MATCH,
|
|
1231
|
+
metadata: {
|
|
1232
|
+
listingHash,
|
|
1233
|
+
isMatch: comparison.is_match,
|
|
1234
|
+
sufficientInfo: comparison.sufficient_info,
|
|
1235
|
+
resultDescription: comparison.result_description,
|
|
1236
|
+
comparedAt: comparison.compared_at,
|
|
1237
|
+
},
|
|
1238
|
+
timestamp: new Date().toISOString(),
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
return null;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1194
1244
|
/**
|
|
1195
1245
|
* Override rule for SKU matches in title
|
|
1196
1246
|
*/
|