Skip to content

Commit

Permalink
fix(preact/recommendationinstantiator): allowing for invalid shopper …
Browse files Browse the repository at this point in the history
…integration with legacy script
  • Loading branch information
korgon committed Nov 6, 2024
1 parent 8d3492f commit 66302ef
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ export class RecommendationInstantiator {
// using the "legacy" integration structure
const { profile, products, product, seed, filters, blockedItems, options, shopper, shopperId } = elemContext;
const combinedProducts = [].concat(products || product || seed || []);
const shopperIdentifier = [shopper, shopper?.id, shopperId, shopperId?.id].filter((val) => val && typeof val === 'string').pop();

const profileRequestGlobals: Partial<RecommendRequestModel> = {
tag: profile,
...defined({
products: combinedProducts.length ? combinedProducts : undefined,
cart: elemContext.cart && getArrayFunc(elemContext.cart),
shopper: shopper?.id || shopperId,
shopper: shopperIdentifier,
filters,
blockedItems,
profile: options,
Expand Down

0 comments on commit 66302ef

Please sign in to comment.