Canonical product URL.
Supplier name.
Optionalmeta: { title?: string }Optional extra metadata (e.g. display title).
The exclusion key that was written.
await addExcludedProduct(product.url, product.supplier, {
title: product.title,
});
export async function addExcludedProduct(
url: string,
supplierName: string,
meta?: { title?: string },
): Promise<string> {
const key = getProductExclusionKey(url, supplierName);
try {
const map = await loadExcludedProducts();
map[key] = {
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. Idempotent: re-excluding an already-ignored product just refreshes its
excludedAtand last-known title. Returns the exclusion key for the caller's logging convenience.