Skip to content

Commit

Permalink
fix cookie logic
Browse files Browse the repository at this point in the history
  • Loading branch information
swamu committed Jan 17, 2025
1 parent e53de50 commit cf80303
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions libs/martech/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf80303

Please sign in to comment.