The product to key.
The identity key, or undefined when neither an identity nor a
supplier is available to key against.
productSeriesKey({ cacheKey: "889460", supplier: "Carolina", … }); // "3f9c2a…"
export function productSeriesKey(product: Product): string | undefined {
const identity = product.cacheKey ?? product.url ?? product.title;
if (identity == null || String(identity).length === 0 || !product.supplier) {
return undefined;
}
return getProductIdentityKey(String(identity), product.supplier);
}
Derive the product's stable identity key — shared by its base series and every variant series. Prefers the stamped
cacheKey, falling back to the URL then the title so scraped products without a stamped key still track.