Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NadiyaS committed Dec 6, 2024
1 parent cd870cc commit 002ed30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StorefrontInstance } from "@adobe/magento-storefront-events-sdk/dist/ty

import schemas from "../schemas";
import { StorefrontContext } from "../types/contexts";
import {getCcdmData} from "../utils/ccdm";
import { getCcdmData } from "../utils/ccdm";

const createContext = (storefront?: StorefrontInstance): StorefrontContext => {
const mse = window.magentoStorefrontEvents;
Expand Down Expand Up @@ -37,7 +37,7 @@ const createContext = (storefront?: StorefrontInstance): StorefrontContext => {

const context: StorefrontContext = {
schema: schemas.STOREFRONT_INSTANCE_SCHEMA_URL,
data: {...mainData, ...getCcdmData(storefrontCtx)},
data: { ...mainData, ...getCcdmData(storefrontCtx) },
};

return context;
Expand Down
8 changes: 4 additions & 4 deletions packages/storefront-events-collector/src/utils/ccdm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { StorefrontInstance } from "@adobe/magento-storefront-events-sdk/dist/types/types/schemas";

/** returns part of storefront instance data which should be set for CCDM customers */
export const getCcdmData = (storefrontCtx : StorefrontInstance): object => {
export const getCcdmData = (storefrontCtx: StorefrontInstance): object => {
// If locale is not empty, and scope codes are empty - it is CCDM customer, otherwise returns empty object
if (!storefrontCtx?.locale ||
if (
!storefrontCtx?.locale ||
storefrontCtx?.storeViewCode ||
storefrontCtx?.storeCode ||
storefrontCtx?.websiteCode
Expand All @@ -14,7 +15,6 @@ export const getCcdmData = (storefrontCtx : StorefrontInstance): object => {
return {
storeViewCode: storefrontCtx.locale,
storeCode: "STORE_CODE",
websiteCode: "WEBSITE_CODE"

websiteCode: "WEBSITE_CODE",
};
};

0 comments on commit 002ed30

Please # to comment.