From cf803038b7c0961a9795f7c956e6ab754a6f83b2 Mon Sep 17 00:00:00 2001 From: Swati Mukherjee Date: Fri, 17 Jan 2025 17:15:46 +0530 Subject: [PATCH] fix cookie logic --- libs/martech/helpers.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libs/martech/helpers.js b/libs/martech/helpers.js index 8cc93109d10..7fef182899d 100644 --- a/libs/martech/helpers.js +++ b/libs/martech/helpers.js @@ -434,11 +434,19 @@ export const loadAnalyticsAndInteractionData = async ({ locale, env, calculatedT // Update the AMCV cookie with ECID updateAMCVCookie(ECID); - const stateStorePayload = targetRespJson?.handle?.find((item) => item.type === 'state:store')?.payload; - const extractedData = stateStorePayload?.map((item) => ({ - key: item.key, - value: item.value, - })); + const extractedData = []; + targetRespJson?.handle?.forEach((item) => { + if (item?.type === 'state:store') { + item?.payload?.forEach((payload) => { + if ( + payload?.key === 'kndctr_9E1005A551ED61CA0A490D45_AdobeOrg_cluster' + || payload?.key === 'kndctr_9E1005A551ED61CA0A490D45_AdobeOrg_identity') { + extractedData.push({ ...payload }); + } + }); + } + }); + updateMartechCookies(extractedData); // Resolve or reject based on propositions