From cd4c240e40fb589da720ed4927defac251016c58 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Mon, 26 Jun 2023 14:36:49 -0500 Subject: [PATCH 1/4] Ensure brwoser config defaults are applied correctly Instead of just taking config as a prop spread the default config and config overrides bein sent in. --- packages/marko-web-theme-monorail/browser/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/marko-web-theme-monorail/browser/index.js b/packages/marko-web-theme-monorail/browser/index.js index 1a14e7568..3c8309f26 100644 --- a/packages/marko-web-theme-monorail/browser/index.js +++ b/packages/marko-web-theme-monorail/browser/index.js @@ -28,18 +28,20 @@ const setP1EventsIdentity = ({ p1events, brandKey, encryptedId }) => { p1events('setIdentity', `omeda.${brandKey}.customer*${encryptedId}~encrypted`); }; -export default (Browser, config = { +const defaultConfig = { enableOmedaIdentityX: true, withGTM: true, withP1Events: true, idxArgs: {}, inquiryArgs: {}, -}) => { +}; + +export default (Browser, configOverrides = {}) => { + const config = { ...defaultConfig, ...configOverrides }; const { EventBus } = Browser; const { enableOmedaIdentityX } = config; const idxArgs = config.idxArgs || {}; const inquiryArgs = config.inquiryArgs || {}; - if (config.withP1Events) { P1Events(Browser); } From b289d1ccaa109ecd6d55f0c114891ba406134382 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Mon, 26 Jun 2023 14:44:24 -0500 Subject: [PATCH 2/4] Remove unused prop --- packages/marko-web-theme-monorail/browser/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/marko-web-theme-monorail/browser/index.js b/packages/marko-web-theme-monorail/browser/index.js index 3c8309f26..b9e42e2d1 100644 --- a/packages/marko-web-theme-monorail/browser/index.js +++ b/packages/marko-web-theme-monorail/browser/index.js @@ -30,7 +30,6 @@ const setP1EventsIdentity = ({ p1events, brandKey, encryptedId }) => { const defaultConfig = { enableOmedaIdentityX: true, - withGTM: true, withP1Events: true, idxArgs: {}, inquiryArgs: {}, From 42eb9e5137e941971c532d31b8f0370011aeffe6 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Mon, 26 Jun 2023 14:46:41 -0500 Subject: [PATCH 3/4] Clean prop assinment --- packages/marko-web-theme-monorail/browser/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/marko-web-theme-monorail/browser/index.js b/packages/marko-web-theme-monorail/browser/index.js index b9e42e2d1..22d9715f4 100644 --- a/packages/marko-web-theme-monorail/browser/index.js +++ b/packages/marko-web-theme-monorail/browser/index.js @@ -38,10 +38,14 @@ const defaultConfig = { export default (Browser, configOverrides = {}) => { const config = { ...defaultConfig, ...configOverrides }; const { EventBus } = Browser; - const { enableOmedaIdentityX } = config; - const idxArgs = config.idxArgs || {}; - const inquiryArgs = config.inquiryArgs || {}; - if (config.withP1Events) { + const { + enableOmedaIdentityX, + idxArgs, + inquiryArgs, + withP1Events, + } = config; + + if (withP1Events) { P1Events(Browser); } From 2cea7cb9f24dcb335e41c864fa23988d400772f4 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Thu, 29 Jun 2023 07:11:51 -0500 Subject: [PATCH 4/4] Use getAsAObject to set idxArgs & inquiryArgs This will ensure these parts of the config being passed in are at minimum an empty object. --- packages/marko-web-theme-monorail/browser/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/marko-web-theme-monorail/browser/index.js b/packages/marko-web-theme-monorail/browser/index.js index 22d9715f4..daafe4346 100644 --- a/packages/marko-web-theme-monorail/browser/index.js +++ b/packages/marko-web-theme-monorail/browser/index.js @@ -7,6 +7,7 @@ import NativeX from '@parameter1/base-cms-marko-web-native-x/browser'; import IdentityX from '@parameter1/base-cms-marko-web-identity-x/browser'; import OmedaIdentityX from '@parameter1/base-cms-marko-web-omeda-identity-x/browser'; import P1Events from '@parameter1/base-cms-marko-web-p1-events/browser'; +import { getAsObject } from '@parameter1/base-cms-object-path'; import IdentityXNewsletterForms from './idx-newsletter-form/index'; import ContentMeterTrack from './content-meter-track.vue'; @@ -40,11 +41,12 @@ export default (Browser, configOverrides = {}) => { const { EventBus } = Browser; const { enableOmedaIdentityX, - idxArgs, - inquiryArgs, withP1Events, } = config; + const idxArgs = getAsObject(config, 'idxArgs'); + const inquiryArgs = getAsObject(config, 'inquiryArgs'); + if (withP1Events) { P1Events(Browser); }