The product's unique identity (its cacheKey), or the URL
as a fallback when no identity was stamped.
Supplier name.
Optionalmeta: { title?: string; url?: string }Optional extra metadata: display title and canonical URL (kept for display and legacy-key matching).
The exclusion key that was written.
await addExcludedProduct(product.cacheKey ?? product.url, product.supplier, {
title: product.title,
url: product.url,
});
export async function addExcludedProduct(
identity: string,
supplierName: string,
meta?: { title?: string; url?: string },
): Promise<string> {
const key = getProductIdentityKey(identity, supplierName);
try {
const map = await loadExcludedProducts();
map[key] = {
identity,
url: meta?.url,
supplier: supplierName,
title: meta?.title,
excludedAt: Date.now(),
};
await putExcludedProducts(map);
} catch (error) {
console.warn('Failed to persist excluded product to IndexedDB:', { error });
}
return key;
}
Add a product to the excluded list in IndexedDB, keyed by the supplier's stable product identity (getProductIdentityKey) — the same key that keys the product-detail cache. Idempotent: re-excluding an already-ignored product just refreshes its
excludedAtand last-known title. Returns the exclusion key for the caller's logging convenience.