From 220311ec98a56058656b16f24cdc448f5442a728 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Wed, 12 Jul 2023 13:38:39 -0500 Subject: [PATCH] correctly apply config overrides and fallback to {} This is correctly apply config overrids & ensure idxArgs & inquieryArgs are at least empty objects --- .../marko-web-theme-monorail/browser/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/marko-web-theme-monorail/browser/index.js b/packages/marko-web-theme-monorail/browser/index.js index 1a14e7568..db36c9461 100644 --- a/packages/marko-web-theme-monorail/browser/index.js +++ b/packages/marko-web-theme-monorail/browser/index.js @@ -28,19 +28,25 @@ 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 { + enableOmedaIdentityX, + withP1Events, + } = config; + const idxArgs = config.idxArgs || {}; const inquiryArgs = config.inquiryArgs || {}; - if (config.withP1Events) { + if (withP1Events) { P1Events(Browser); }