From 9a042c647845090c2423863408fc1580b8081fce Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Thu, 5 Feb 2026 08:43:58 +0100 Subject: [PATCH] debug: Add diagnostics for Buy Box warning issue --- components/BuyBoxWarningBadge.tsx | 5 +++++ services/dataProcessor.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/BuyBoxWarningBadge.tsx b/components/BuyBoxWarningBadge.tsx index 713c4dc..0eeb21d 100644 --- a/components/BuyBoxWarningBadge.tsx +++ b/components/BuyBoxWarningBadge.tsx @@ -19,6 +19,11 @@ export const BuyBoxWarningBadge: React.FC = ({ asin, bu if (!buyBoxLostMap || !asin) return null; const data = buyBoxLostMap.get(asin.toUpperCase()); + + if (asin.toUpperCase() === 'B0D3874WSD') { + console.log(`[BuyBoxBadge Debug] ASIN: ${asin}, Found in map: ${!!data}, Countries: ${data?.countries.join(', ') || 'none'}`); + } + if (!data || data.countries.length === 0) return null; return ( diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index 36904f6..052aa9e 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -2216,14 +2216,14 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom const rawReason = String(row[reasonIdx] || '').trim(); // Debug specific ASIN reported by user - if (rawAsin === 'B0D3874WSD' && config.country === 'ES') { - console.log(`[BuyBox Debug] ASIN B0D3874WSD found in ES. Raw Reason: "${rawReason}" (Length: ${rawReason.length})`); + if (rawAsin === 'B0D3874WSD' || rawAsin.includes('B0D3874WSD')) { + console.log(`[BuyBox Debug] ASIN ${rawAsin} found in ${config.country}. Headers:`, headers); + console.log(`[BuyBox Debug] Reason at index ${reasonIdx}: "${rawReason}" (Length: ${rawReason.length})`); } // Only consider as BB lost if there is an Issue Type / Reason specified - // Empty reason or "Fixed" status means no issue = they have the Buy Box const lowReason = rawReason.toLowerCase(); - if (!rawReason || lowReason === 'fixed' || lowReason === 'ok' || lowReason === 'hecho' || lowReason === 'solucionado') continue; + if (!rawReason || lowReason === 'fixed' || lowReason === 'ok' || lowReason === 'hecho' || lowReason === 'solucionado' || lowReason === 'corrected') continue; let entry = buyBoxMap.get(rawAsin); if (!entry) {