Skip to content

Commit

Permalink
chore: code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Jan 11, 2024
1 parent 3f7b61e commit 6c2c442
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cdk/v2/destinations/intercom/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ steps:
last_seen_at: $.toSeconds(.context.traits.lastSeenAt),
role: .traits.role || .context.traits.role,
signed_up_at: $.toSeconds(.traits.createdAt || .context.traits.createdAt),
owner_id: .traits.ownerId || .context.traits.ownerId ? Number(.traits.ownerId || .context.traits.ownerId) : undefined,
owner_id: Number(.traits.ownerId || .context.traits.ownerId) || undefined,
unsubscribed_from_emails: .traits.unsubscribedFromEmails || .context.traits.unsubscribedFromEmails
})
payload.name = $.getName(.message);
payload.custom_attributes = .message.context.traits || {};
payload.custom_attributes = $.filterCustomAttributes(payload, "user");
payload.external_id = !(payload.external_id) && .destination.Config.sendAnonymousId && .message.anonymousId ? .message.anonymousId : payload.external_id;
payload.external_id = !payload.external_id && .destination.Config.sendAnonymousId && .message.anonymousId ? .message.anonymousId : payload.external_id;
payload;
- name: prepareIdentifyPayload
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/intercom/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const filterCustomAttributes = (payload, type) => {
});

if (isDefinedAndNotNull(customAttributes) && Object.keys(customAttributes).length > 0) {
customAttributes = flattenJson(customAttributes);
customAttributes = flattenJson(customAttributes, '_');
}
}
return customAttributes;
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/intercom/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe('filterCustomAttributes utility test', () => {
custom_attributes: { source: 'rudder-js-sdk', data: { nestedAttribute: 'nestedValue' } },
};
const result = filterCustomAttributes(payload, 'user');
expect(result).toEqual({ source: 'rudder-js-sdk', 'data.nestedAttribute': 'nestedValue' });
expect(result).toEqual({ source: 'rudder-js-sdk', data_nestedAttribute: 'nestedValue' });
});

it('Should return null when custom_attributes is null', () => {
Expand Down

0 comments on commit 6c2c442

Please sign in to comment.