diff --git a/src/zoid/buttons/component.jsx b/src/zoid/buttons/component.jsx index 34e860d91..271c3f66a 100644 --- a/src/zoid/buttons/component.jsx +++ b/src/zoid/buttons/component.jsx @@ -717,7 +717,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { offerCountryCode, creditProductIdentifier, }) => { - const { message, clientID, merchantID, currency, buttonSessionID } = + const { message, clientID, currency, buttonSessionID, merchantID } = props; const amount = message?.amount; @@ -730,7 +730,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { [FPTI_KEY.CONTEXT_ID]: buttonSessionID, [FPTI_KEY.CONTEXT_TYPE]: "button_session_id", [FPTI_KEY.EVENT_NAME]: "message_click", - [FPTI_KEY.SELLER_ID]: merchantID?.join(","), [FPTI_KEY.BUTTON_MESSAGE_OFFER_TYPE]: offerType, [FPTI_KEY.BUTTON_MESSAGE_CREDIT_PRODUCT_IDENTIFIER]: creditProductIdentifier, @@ -741,7 +740,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { [FPTI_KEY.BUTTON_MESSAGE_OFFER_COUNTRY]: offerCountryCode, [FPTI_KEY.BUTTON_MESSAGE_CURRENCY]: currency, [FPTI_KEY.BUTTON_MESSAGE_AMOUNT]: amount, - }); + }) + .flush(); const modalInstance = await getModal(clientID, merchantID); return modalInstance?.show({ @@ -758,10 +758,10 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { required: false, value: ({ props }) => { return () => { + const { clientID, merchantID } = props; // offerType, messageType, offerCountryCode, and creditProductIdentifier are passed in and may be used in an upcoming message hover logging feature // lazy loads the modal, to be memoized and executed onMessageClick - const { clientID, merchantID } = props; return getModal(clientID, merchantID); }; }, @@ -776,8 +776,17 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { messageType, offerCountryCode, creditProductIdentifier, + merchantID: serverMerchantId, }) => { - const { message, buttonSessionID, currency, merchantID } = props; + // merchantID that comes from props is an array + const { message, buttonSessionID, currency } = props; + + // override with server id if partner does not exist + if (serverMerchantId) { + getLogger().addTrackingBuilder(() => ({ + [FPTI_KEY.SELLER_ID]: serverMerchantId, + })); + } getLogger() .info("button_message_render") @@ -788,7 +797,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { [FPTI_KEY.CONTEXT_ID]: buttonSessionID, [FPTI_KEY.CONTEXT_TYPE]: "button_session_id", [FPTI_KEY.EVENT_NAME]: "message_render", - [FPTI_KEY.SELLER_ID]: merchantID?.join(","), [FPTI_KEY.BUTTON_MESSAGE_OFFER_TYPE]: offerType, [FPTI_KEY.BUTTON_MESSAGE_CREDIT_PRODUCT_IDENTIFIER]: creditProductIdentifier, @@ -799,7 +807,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => { [FPTI_KEY.BUTTON_MESSAGE_CURRENCY]: currency, [FPTI_KEY.BUTTON_MESSAGE_OFFER_COUNTRY]: offerCountryCode, [FPTI_KEY.BUTTON_MESSAGE_AMOUNT]: message?.amount, - }); + }) + .flush(); }; }, }, diff --git a/src/zoid/buttons/util.js b/src/zoid/buttons/util.js index 52346bd62..b5576f134 100644 --- a/src/zoid/buttons/util.js +++ b/src/zoid/buttons/util.js @@ -373,7 +373,7 @@ function buildModalBundleUrl(): string { export const getModal: ( clientID: string, - merchantID: $ReadOnlyArray | void + merchantID?: $ReadOnlyArray | void ) => Object = memoize(async (clientID, merchantID) => { try { const namespace = getNamespace();