Skip to content

Commit

Permalink
fix: add customer id check
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Sep 1, 2024
1 parent 9bd9ef5 commit 39c81c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/v1/sources/shopify/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ const processIdentifierEvent = async (event, metricMetadata) => {

function processPixelEvent(inputEvent) {
const { name, query_parameters, clientId, data } = inputEvent;
const { checkout } = data;
const { order } = checkout;
const { customer } = order;

Check warning on line 434 in src/v1/sources/shopify/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v1/sources/shopify/transform.js#L430-L434

Added lines #L430 - L434 were not covered by tests
let message;
switch (name) {
case PIXEL_EVENT_TOPICS.PAGE_VIEWED:
Expand All @@ -449,14 +452,14 @@ function processPixelEvent(inputEvent) {
break;
case PIXEL_EVENT_TOPICS.CHECKOUT_STARTED:
case PIXEL_EVENT_TOPICS.CHECKOUT_COMPLETED:

Check warning on line 454 in src/v1/sources/shopify/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v1/sources/shopify/transform.js#L437-L454

Added lines #L437 - L454 were not covered by tests
message.userId = data?.checkout?.order?.customer?.id || '';
if (customer.id) message.userId = customer.id || '';
message = checkoutEventBuilder(inputEvent);
break;
case PIXEL_EVENT_TOPICS.CHECKOUT_ADDRESS_INFO_SUBMITTED:
case PIXEL_EVENT_TOPICS.CHECKOUT_CONTACT_INFO_SUBMITTED:
case PIXEL_EVENT_TOPICS.CHECKOUT_SHIPPING_INFO_SUBMITTED:
case PIXEL_EVENT_TOPICS.PAYMENT_INFO_SUBMITTED:

Check warning on line 461 in src/v1/sources/shopify/transform.js

View check run for this annotation

Codecov / codecov/patch

src/v1/sources/shopify/transform.js#L456-L461

Added lines #L456 - L461 were not covered by tests
message.userId = data?.checkout?.order?.customer?.id || '';
if (customer.id) message.userId = customer.id || '';
message = checkoutStepEventBuilder(inputEvent);
break;
case PIXEL_EVENT_TOPICS.SEARCH_SUBMITTED:
Expand Down

0 comments on commit 39c81c1

Please sign in to comment.