Skip to content

Commit

Permalink
refactor: Add partner client id (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanClemons authored Sep 11, 2024
1 parent 4ed39a2 commit 3895648
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ function generateLogPayload(account, { meta, events: bizEvents, tracking }) {
let buyer_profile_hash;
let buyer_profile_valid;
let partner_attribution_id;
let partner_client_id;

const components = Object.entries(meta)
.filter(([, component]) => component.account === account)
.map(([index, component]) => {
// buttonSessionId could be undefined here
const { type, buttonSessionId, messageRequestId, stats = {}, trackingDetails } = component;
const { type, partnerClientId, buttonSessionId, messageRequestId, stats = {}, trackingDetails } = component;
const { clickUrl } = trackingDetails;
delete trackingDetails.clickUrl;

// We expect these to be the same for every event so just take one
partner_client_id = partner_client_id ?? partnerClientId;
merchant_profile_hash = merchant_profile_hash ?? trackingDetails.MERCHANT_PROFILE_HASH;
merchant_profile_valid = merchant_profile_valid ?? trackingDetails.MERCHANT_PROFILE_VALID;
buyer_profile_hash = buyer_profile_hash ?? trackingDetails.BUYER_PROFILE_HASH;
Expand Down Expand Up @@ -87,6 +89,7 @@ function generateLogPayload(account, { meta, events: bizEvents, tracking }) {
// Integration Details
client_id: clientID,
merchant_id: account,
partner_client_id,
partner_attribution_id,
merchant_profile_hash,
merchant_profile_valid,
Expand Down

0 comments on commit 3895648

Please sign in to comment.