From 66302ef7d3968a8dec47755cc42ca8c595a8cf52 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 6 Nov 2024 09:33:14 -0700 Subject: [PATCH] fix(preact/recommendationinstantiator): allowing for invalid shopper integration with legacy script --- .../src/Instantiators/RecommendationInstantiator.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx index fbd165e40..25b229bef 100644 --- a/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx +++ b/packages/snap-preact/src/Instantiators/RecommendationInstantiator.tsx @@ -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 = { tag: profile, ...defined({ products: combinedProducts.length ? combinedProducts : undefined, cart: elemContext.cart && getArrayFunc(elemContext.cart), - shopper: shopper?.id || shopperId, + shopper: shopperIdentifier, filters, blockedItems, profile: options,