@chordcommerce/analytics 1.22.0-beta.3 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,6 @@ import { addCdpSnippet, cdpQueue } from './cdp.js';
11
11
  import { addCdpConsent } from './consent/index.js';
12
12
  import { eventSchemas } from '../validators/index.js';
13
13
  import { pruneNullValues } from '../utils.js';
14
- import { syncIdentifiersToCart as syncIdentifiers, } from './identifiers.js';
15
14
  const DEBUG_MODE_STORAGE_KEY = 'chordcommerce/analytics/debug';
16
15
  const CONSENT_QUEUE_STORAGE_KEY = 'chordcommerce/analytics/consent-queue';
17
16
  const CONSENT_QUEUE_TTL_MS = 5 * 60 * 1000; // 5 minutes
@@ -19,7 +18,7 @@ const CONSENT_QUEUE_MAX_SIZE_BYTES = 100 * 1024; // 100KB max queue size
19
18
  const CONSENT_QUEUE_MAX_EVENTS = 50; // Max number of events to queue
20
19
  export class ChordAnalytics {
21
20
  constructor(options) {
22
- var _a, _b, _c, _d, _e, _f, _g;
21
+ var _a, _b, _c, _d;
23
22
  /**
24
23
  * Allows snippet.js to detect whether this library has been initialized yet.
25
24
  */
@@ -586,7 +585,7 @@ export class ChordAnalytics {
586
585
  });
587
586
  });
588
587
  this.reset = () => __awaiter(this, void 0, void 0, function* () {
589
- var _h;
588
+ var _e;
590
589
  try {
591
590
  this.resetInProgress = true;
592
591
  const a = this.ccdp();
@@ -603,12 +602,12 @@ export class ChordAnalytics {
603
602
  // eslint-disable-next-line
604
603
  yield new Promise((resolve) => setTimeout(resolve, 10));
605
604
  try {
606
- const userState = ((_h = a === null || a === void 0 ? void 0 : a.user) === null || _h === void 0 ? void 0 : _h.call(a)) || {};
605
+ const userState = ((_e = a === null || a === void 0 ? void 0 : a.user) === null || _e === void 0 ? void 0 : _e.call(a)) || {};
607
606
  if (userState.userId === null || userState.userId === undefined) {
608
607
  break;
609
608
  }
610
609
  }
611
- catch (_j) {
610
+ catch (_f) {
612
611
  break;
613
612
  }
614
613
  attempts++;
@@ -654,6 +653,17 @@ export class ChordAnalytics {
654
653
  return;
655
654
  if (event.data.source !== 'chord-web-pixel')
656
655
  return;
656
+ // Validate origin — only accept messages from the same hostname
657
+ try {
658
+ if (event.origin) {
659
+ const eventHostname = new URL(event.origin).hostname;
660
+ if (eventHostname !== window.location.hostname)
661
+ return;
662
+ }
663
+ }
664
+ catch (_a) {
665
+ return;
666
+ }
657
667
  const message = event.data;
658
668
  if (this.options.enableLogging && this.options.debug) {
659
669
  // eslint-disable-next-line no-console
@@ -664,18 +674,18 @@ export class ChordAnalytics {
664
674
  case 'track': {
665
675
  const [eventName, properties] = message.payload;
666
676
  if (eventName) {
667
- this.track(eventName, properties);
677
+ Promise.resolve(this.track(eventName, properties)).catch((err) => this.logger('[Chord Analytics]: Error in web pixel track:', err));
668
678
  }
669
679
  break;
670
680
  }
671
681
  case 'identify': {
672
682
  const [userId, traits] = message.payload;
673
- this.identify(userId, traits);
683
+ Promise.resolve(this.identify(userId, traits)).catch((err) => this.logger('[Chord Analytics]: Error in web pixel identify:', err));
674
684
  break;
675
685
  }
676
686
  case 'page': {
677
687
  const [properties] = message.payload;
678
- this.page(properties);
688
+ Promise.resolve(this.page(undefined, properties)).catch((err) => this.logger('[Chord Analytics]: Error in web pixel page:', err));
679
689
  break;
680
690
  }
681
691
  default:
@@ -697,28 +707,10 @@ export class ChordAnalytics {
697
707
  }
698
708
  };
699
709
  };
700
- /**
701
- * Sync CDP anonymous ID and Google Client ID to Shopify cart attributes.
702
- * This enables server-side events (webhooks) to correlate with client-side tracking.
703
- *
704
- * By default, syncs:
705
- * - `_cdpAnonymousId`: from the `__eventn_id` cookie (Chord/Jitsu CDP)
706
- * - `_googleClientId`: from the `_ga` cookie (Google Analytics)
707
- *
708
- * @param options - Optional configuration for the sync
709
- * @returns The updated cart, or undefined if no update was needed or an error occurred
710
- */
711
- this.syncIdentifiersToCart = (options) => __awaiter(this, void 0, void 0, function* () {
712
- const result = yield syncIdentifiers(options);
713
- if (result) {
714
- this.logger('[Chord Analytics]: Identifiers synced to cart');
715
- }
716
- return result;
717
- });
718
710
  // TODO: Add support for props.products
719
711
  this.trackCartViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
720
- var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
721
- const cart = (_o = (_m = (_l = (_k = this.options) === null || _k === void 0 ? void 0 : _k.formatters) === null || _l === void 0 ? void 0 : _l.objects) === null || _m === void 0 ? void 0 : _m.cart) === null || _o === void 0 ? void 0 : _o.call(_m, {
712
+ var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
713
+ const cart = (_k = (_j = (_h = (_g = this.options) === null || _g === void 0 ? void 0 : _g.formatters) === null || _h === void 0 ? void 0 : _h.objects) === null || _j === void 0 ? void 0 : _j.cart) === null || _k === void 0 ? void 0 : _k.call(_j, {
722
714
  cart: props === null || props === void 0 ? void 0 : props.cart,
723
715
  });
724
716
  const payload = {
@@ -727,17 +719,17 @@ export class ChordAnalytics {
727
719
  products: cart === null || cart === void 0 ? void 0 : cart.products,
728
720
  value: cart === null || cart === void 0 ? void 0 : cart.value,
729
721
  };
730
- if ((_r = (_q = (_p = this.options) === null || _p === void 0 ? void 0 : _p.formatters) === null || _q === void 0 ? void 0 : _q.events) === null || _r === void 0 ? void 0 : _r.cartViewed) {
731
- const formattedPayload = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.formatters) === null || _t === void 0 ? void 0 : _t.events) === null || _u === void 0 ? void 0 : _u.cartViewed(props, payload);
722
+ if ((_o = (_m = (_l = this.options) === null || _l === void 0 ? void 0 : _l.formatters) === null || _m === void 0 ? void 0 : _m.events) === null || _o === void 0 ? void 0 : _o.cartViewed) {
723
+ const formattedPayload = (_r = (_q = (_p = this.options) === null || _p === void 0 ? void 0 : _p.formatters) === null || _q === void 0 ? void 0 : _q.events) === null || _r === void 0 ? void 0 : _r.cartViewed(props, payload);
732
724
  return this.track('Cart Viewed', formattedPayload, options);
733
725
  }
734
726
  return this.track('Cart Viewed', payload, options);
735
727
  });
736
728
  // TODO: Add support for props.products
737
729
  this.trackCheckoutStarted = (props, options) => __awaiter(this, void 0, void 0, function* () {
738
- var _v, _w, _x, _y, _z, _0, _1;
739
- const formatter = (_x = (_w = (_v = this.options) === null || _v === void 0 ? void 0 : _v.formatters) === null || _w === void 0 ? void 0 : _w.events) === null || _x === void 0 ? void 0 : _x.checkoutStarted;
740
- const checkout = (_1 = (_0 = (_z = (_y = this.options) === null || _y === void 0 ? void 0 : _y.formatters) === null || _z === void 0 ? void 0 : _z.objects) === null || _0 === void 0 ? void 0 : _0.checkout) === null || _1 === void 0 ? void 0 : _1.call(_0, {
730
+ var _s, _t, _u, _v, _w, _x, _y;
731
+ const formatter = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.formatters) === null || _t === void 0 ? void 0 : _t.events) === null || _u === void 0 ? void 0 : _u.checkoutStarted;
732
+ const checkout = (_y = (_x = (_w = (_v = this.options) === null || _v === void 0 ? void 0 : _v.formatters) === null || _w === void 0 ? void 0 : _w.objects) === null || _x === void 0 ? void 0 : _x.checkout) === null || _y === void 0 ? void 0 : _y.call(_x, {
741
733
  checkout: props === null || props === void 0 ? void 0 : props.checkout,
742
734
  });
743
735
  const payload = checkout;
@@ -748,8 +740,8 @@ export class ChordAnalytics {
748
740
  return this.track('Checkout Started', payload, options);
749
741
  });
750
742
  this.trackCheckoutStepCompleted = (props, options) => __awaiter(this, void 0, void 0, function* () {
751
- var _2, _3, _4;
752
- const formatter = (_4 = (_3 = (_2 = this.options) === null || _2 === void 0 ? void 0 : _2.formatters) === null || _3 === void 0 ? void 0 : _3.events) === null || _4 === void 0 ? void 0 : _4.checkoutStepCompleted;
743
+ var _z, _0, _1;
744
+ const formatter = (_1 = (_0 = (_z = this.options) === null || _z === void 0 ? void 0 : _z.formatters) === null || _0 === void 0 ? void 0 : _0.events) === null || _1 === void 0 ? void 0 : _1.checkoutStepCompleted;
753
745
  const payload = {
754
746
  checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
755
747
  payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
@@ -763,8 +755,8 @@ export class ChordAnalytics {
763
755
  return this.track('Checkout Step Completed', payload, options);
764
756
  });
765
757
  this.trackCheckoutStepViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
766
- var _5, _6, _7;
767
- const formatter = (_7 = (_6 = (_5 = this.options) === null || _5 === void 0 ? void 0 : _5.formatters) === null || _6 === void 0 ? void 0 : _6.events) === null || _7 === void 0 ? void 0 : _7.checkoutStepViewed;
758
+ var _2, _3, _4;
759
+ const formatter = (_4 = (_3 = (_2 = this.options) === null || _2 === void 0 ? void 0 : _2.formatters) === null || _3 === void 0 ? void 0 : _3.events) === null || _4 === void 0 ? void 0 : _4.checkoutStepViewed;
768
760
  const payload = {
769
761
  checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
770
762
  payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
@@ -778,8 +770,8 @@ export class ChordAnalytics {
778
770
  return this.track('Checkout Step Viewed', payload, options);
779
771
  });
780
772
  this.trackCouponApplied = (props, options) => __awaiter(this, void 0, void 0, function* () {
781
- var _8, _9, _10;
782
- const formatter = (_10 = (_9 = (_8 = this.options) === null || _8 === void 0 ? void 0 : _8.formatters) === null || _9 === void 0 ? void 0 : _9.events) === null || _10 === void 0 ? void 0 : _10.couponApplied;
773
+ var _5, _6, _7;
774
+ const formatter = (_7 = (_6 = (_5 = this.options) === null || _5 === void 0 ? void 0 : _5.formatters) === null || _6 === void 0 ? void 0 : _6.events) === null || _7 === void 0 ? void 0 : _7.couponApplied;
783
775
  const payload = {
784
776
  cart_id: props === null || props === void 0 ? void 0 : props.cartId,
785
777
  coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
@@ -794,8 +786,8 @@ export class ChordAnalytics {
794
786
  return this.track('Coupon Applied', payload, options);
795
787
  });
796
788
  this.trackCouponDenied = (props, options) => __awaiter(this, void 0, void 0, function* () {
797
- var _11, _12, _13;
798
- const formatter = (_13 = (_12 = (_11 = this.options) === null || _11 === void 0 ? void 0 : _11.formatters) === null || _12 === void 0 ? void 0 : _12.events) === null || _13 === void 0 ? void 0 : _13.couponDenied;
789
+ var _8, _9, _10;
790
+ const formatter = (_10 = (_9 = (_8 = this.options) === null || _8 === void 0 ? void 0 : _8.formatters) === null || _9 === void 0 ? void 0 : _9.events) === null || _10 === void 0 ? void 0 : _10.couponDenied;
799
791
  const payload = {
800
792
  cart_id: props === null || props === void 0 ? void 0 : props.cartId,
801
793
  coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
@@ -810,8 +802,8 @@ export class ChordAnalytics {
810
802
  return this.track('Coupon Denied', payload, options);
811
803
  });
812
804
  this.trackCouponEntered = (props, options) => __awaiter(this, void 0, void 0, function* () {
813
- var _14, _15, _16;
814
- const formatter = (_16 = (_15 = (_14 = this.options) === null || _14 === void 0 ? void 0 : _14.formatters) === null || _15 === void 0 ? void 0 : _15.events) === null || _16 === void 0 ? void 0 : _16.couponEntered;
805
+ var _11, _12, _13;
806
+ const formatter = (_13 = (_12 = (_11 = this.options) === null || _11 === void 0 ? void 0 : _11.formatters) === null || _12 === void 0 ? void 0 : _12.events) === null || _13 === void 0 ? void 0 : _13.couponEntered;
815
807
  const payload = {
816
808
  cart_id: props === null || props === void 0 ? void 0 : props.cartId,
817
809
  coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
@@ -825,8 +817,8 @@ export class ChordAnalytics {
825
817
  return this.track('Coupon Entered', payload, options);
826
818
  });
827
819
  this.trackCouponRemoved = (props, options) => __awaiter(this, void 0, void 0, function* () {
828
- var _17, _18, _19;
829
- const formatter = (_19 = (_18 = (_17 = this.options) === null || _17 === void 0 ? void 0 : _17.formatters) === null || _18 === void 0 ? void 0 : _18.events) === null || _19 === void 0 ? void 0 : _19.couponRemoved;
820
+ var _14, _15, _16;
821
+ const formatter = (_16 = (_15 = (_14 = this.options) === null || _14 === void 0 ? void 0 : _14.formatters) === null || _15 === void 0 ? void 0 : _15.events) === null || _16 === void 0 ? void 0 : _16.couponRemoved;
830
822
  const payload = {
831
823
  cart_id: props === null || props === void 0 ? void 0 : props.cartId,
832
824
  coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
@@ -841,8 +833,8 @@ export class ChordAnalytics {
841
833
  return this.track('Coupon Removed', payload, options);
842
834
  });
843
835
  this.trackEmailCaptured = (props, options) => __awaiter(this, void 0, void 0, function* () {
844
- var _20, _21, _22;
845
- const formatter = (_22 = (_21 = (_20 = this.options) === null || _20 === void 0 ? void 0 : _20.formatters) === null || _21 === void 0 ? void 0 : _21.events) === null || _22 === void 0 ? void 0 : _22.emailCaptured;
836
+ var _17, _18, _19;
837
+ const formatter = (_19 = (_18 = (_17 = this.options) === null || _17 === void 0 ? void 0 : _17.formatters) === null || _18 === void 0 ? void 0 : _18.events) === null || _19 === void 0 ? void 0 : _19.emailCaptured;
846
838
  const payload = {
847
839
  email: props === null || props === void 0 ? void 0 : props.email,
848
840
  placement_component: props === null || props === void 0 ? void 0 : props.placementComponent,
@@ -855,13 +847,13 @@ export class ChordAnalytics {
855
847
  return this.track('Email Captured', payload, options);
856
848
  });
857
849
  this.trackProductAdded = (props, options) => __awaiter(this, void 0, void 0, function* () {
858
- var _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
859
- const formatter = (_25 = (_24 = (_23 = this.options) === null || _23 === void 0 ? void 0 : _23.formatters) === null || _24 === void 0 ? void 0 : _24.events) === null || _25 === void 0 ? void 0 : _25.productAdded;
860
- const product = (_29 = (_28 = (_27 = (_26 = this.options) === null || _26 === void 0 ? void 0 : _26.formatters) === null || _27 === void 0 ? void 0 : _27.objects) === null || _28 === void 0 ? void 0 : _28.product) === null || _29 === void 0 ? void 0 : _29.call(_28, props === null || props === void 0 ? void 0 : props.product);
861
- const cart = (_33 = (_32 = (_31 = (_30 = this.options) === null || _30 === void 0 ? void 0 : _30.formatters) === null || _31 === void 0 ? void 0 : _31.objects) === null || _32 === void 0 ? void 0 : _32.cart) === null || _33 === void 0 ? void 0 : _33.call(_32, {
850
+ var _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
851
+ const formatter = (_22 = (_21 = (_20 = this.options) === null || _20 === void 0 ? void 0 : _20.formatters) === null || _21 === void 0 ? void 0 : _21.events) === null || _22 === void 0 ? void 0 : _22.productAdded;
852
+ const product = (_26 = (_25 = (_24 = (_23 = this.options) === null || _23 === void 0 ? void 0 : _23.formatters) === null || _24 === void 0 ? void 0 : _24.objects) === null || _25 === void 0 ? void 0 : _25.product) === null || _26 === void 0 ? void 0 : _26.call(_25, props === null || props === void 0 ? void 0 : props.product);
853
+ const cart = (_30 = (_29 = (_28 = (_27 = this.options) === null || _27 === void 0 ? void 0 : _27.formatters) === null || _28 === void 0 ? void 0 : _28.objects) === null || _29 === void 0 ? void 0 : _29.cart) === null || _30 === void 0 ? void 0 : _30.call(_29, {
862
854
  cart: props === null || props === void 0 ? void 0 : props.cart,
863
855
  });
864
- const quantity = ((_34 = props === null || props === void 0 ? void 0 : props.product) === null || _34 === void 0 ? void 0 : _34.quantity) || 1;
856
+ const quantity = ((_31 = props === null || props === void 0 ? void 0 : props.product) === null || _31 === void 0 ? void 0 : _31.quantity) || 1;
865
857
  const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], total: product.price * (quantity || 1), value: product.price * (quantity || 1) });
866
858
  if (typeof formatter === 'function') {
867
859
  const formattedPayload = formatter(props, payload);
@@ -870,14 +862,14 @@ export class ChordAnalytics {
870
862
  return this.track('Product Added', payload, options);
871
863
  });
872
864
  this.trackProductClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
873
- var _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47;
874
- const formatter = (_37 = (_36 = (_35 = this.options) === null || _35 === void 0 ? void 0 : _35.formatters) === null || _36 === void 0 ? void 0 : _36.events) === null || _37 === void 0 ? void 0 : _37.productClicked;
875
- const product = (_41 = (_40 = (_39 = (_38 = this.options) === null || _38 === void 0 ? void 0 : _38.formatters) === null || _39 === void 0 ? void 0 : _39.objects) === null || _40 === void 0 ? void 0 : _40.product) === null || _41 === void 0 ? void 0 : _41.call(_40, props === null || props === void 0 ? void 0 : props.product);
876
- const cart = (_45 = (_44 = (_43 = (_42 = this.options) === null || _42 === void 0 ? void 0 : _42.formatters) === null || _43 === void 0 ? void 0 : _43.objects) === null || _44 === void 0 ? void 0 : _44.cart) === null || _45 === void 0 ? void 0 : _45.call(_44, {
865
+ var _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
866
+ const formatter = (_34 = (_33 = (_32 = this.options) === null || _32 === void 0 ? void 0 : _32.formatters) === null || _33 === void 0 ? void 0 : _33.events) === null || _34 === void 0 ? void 0 : _34.productClicked;
867
+ const product = (_38 = (_37 = (_36 = (_35 = this.options) === null || _35 === void 0 ? void 0 : _35.formatters) === null || _36 === void 0 ? void 0 : _36.objects) === null || _37 === void 0 ? void 0 : _37.product) === null || _38 === void 0 ? void 0 : _38.call(_37, props === null || props === void 0 ? void 0 : props.product);
868
+ const cart = (_42 = (_41 = (_40 = (_39 = this.options) === null || _39 === void 0 ? void 0 : _39.formatters) === null || _40 === void 0 ? void 0 : _40.objects) === null || _41 === void 0 ? void 0 : _41.cart) === null || _42 === void 0 ? void 0 : _42.call(_41, {
877
869
  cart: props === null || props === void 0 ? void 0 : props.cart,
878
870
  });
879
- const quantity = ((_46 = props === null || props === void 0 ? void 0 : props.product) === null || _46 === void 0 ? void 0 : _46.quantity) || 1;
880
- const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, item_list_id: (_47 = props === null || props === void 0 ? void 0 : props.listId) === null || _47 === void 0 ? void 0 : _47.toString(), item_list_name: props === null || props === void 0 ? void 0 : props.listName, products: [Object.assign(Object.assign({}, product), { quantity })] });
871
+ const quantity = ((_43 = props === null || props === void 0 ? void 0 : props.product) === null || _43 === void 0 ? void 0 : _43.quantity) || 1;
872
+ const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, item_list_id: (_44 = props === null || props === void 0 ? void 0 : props.listId) === null || _44 === void 0 ? void 0 : _44.toString(), item_list_name: props === null || props === void 0 ? void 0 : props.listName, products: [Object.assign(Object.assign({}, product), { quantity })] });
881
873
  if (typeof formatter === 'function') {
882
874
  const formattedPayload = formatter(props, payload);
883
875
  return this.track('Product Clicked', formattedPayload, options);
@@ -885,13 +877,13 @@ export class ChordAnalytics {
885
877
  return this.track('Product Clicked', payload, options);
886
878
  });
887
879
  this.trackVariantClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
888
- var _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59;
889
- const formatter = (_50 = (_49 = (_48 = this.options) === null || _48 === void 0 ? void 0 : _48.formatters) === null || _49 === void 0 ? void 0 : _49.events) === null || _50 === void 0 ? void 0 : _50.variantClicked;
890
- const product = (_54 = (_53 = (_52 = (_51 = this.options) === null || _51 === void 0 ? void 0 : _51.formatters) === null || _52 === void 0 ? void 0 : _52.objects) === null || _53 === void 0 ? void 0 : _53.product) === null || _54 === void 0 ? void 0 : _54.call(_53, props === null || props === void 0 ? void 0 : props.product);
891
- const cart = (_58 = (_57 = (_56 = (_55 = this.options) === null || _55 === void 0 ? void 0 : _55.formatters) === null || _56 === void 0 ? void 0 : _56.objects) === null || _57 === void 0 ? void 0 : _57.cart) === null || _58 === void 0 ? void 0 : _58.call(_57, {
880
+ var _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56;
881
+ const formatter = (_47 = (_46 = (_45 = this.options) === null || _45 === void 0 ? void 0 : _45.formatters) === null || _46 === void 0 ? void 0 : _46.events) === null || _47 === void 0 ? void 0 : _47.variantClicked;
882
+ const product = (_51 = (_50 = (_49 = (_48 = this.options) === null || _48 === void 0 ? void 0 : _48.formatters) === null || _49 === void 0 ? void 0 : _49.objects) === null || _50 === void 0 ? void 0 : _50.product) === null || _51 === void 0 ? void 0 : _51.call(_50, props === null || props === void 0 ? void 0 : props.product);
883
+ const cart = (_55 = (_54 = (_53 = (_52 = this.options) === null || _52 === void 0 ? void 0 : _52.formatters) === null || _53 === void 0 ? void 0 : _53.objects) === null || _54 === void 0 ? void 0 : _54.cart) === null || _55 === void 0 ? void 0 : _55.call(_54, {
892
884
  cart: props === null || props === void 0 ? void 0 : props.cart,
893
885
  });
894
- const quantity = ((_59 = props === null || props === void 0 ? void 0 : props.product) === null || _59 === void 0 ? void 0 : _59.quantity) || 1;
886
+ const quantity = ((_56 = props === null || props === void 0 ? void 0 : props.product) === null || _56 === void 0 ? void 0 : _56.quantity) || 1;
895
887
  const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, quantity: quantity, line_item_id: props === null || props === void 0 ? void 0 : props.lineItemId, coupon: props === null || props === void 0 ? void 0 : props.coupon });
896
888
  if (typeof formatter === 'function') {
897
889
  const formattedPayload = formatter(props, payload);
@@ -900,13 +892,13 @@ export class ChordAnalytics {
900
892
  return this.track('Variant Clicked', payload, options);
901
893
  });
902
894
  this.trackProductListFiltered = (props, options) => __awaiter(this, void 0, void 0, function* () {
903
- var _60, _61, _62, _63, _64;
904
- const formatter = (_62 = (_61 = (_60 = this.options) === null || _60 === void 0 ? void 0 : _60.formatters) === null || _61 === void 0 ? void 0 : _61.events) === null || _62 === void 0 ? void 0 : _62.productListFiltered;
895
+ var _57, _58, _59, _60, _61;
896
+ const formatter = (_59 = (_58 = (_57 = this.options) === null || _57 === void 0 ? void 0 : _57.formatters) === null || _58 === void 0 ? void 0 : _58.events) === null || _59 === void 0 ? void 0 : _59.productListFiltered;
905
897
  const payload = {
906
898
  category: props === null || props === void 0 ? void 0 : props.category,
907
899
  filters: props === null || props === void 0 ? void 0 : props.filters,
908
- list_id: (_63 = props === null || props === void 0 ? void 0 : props.listId) === null || _63 === void 0 ? void 0 : _63.toString(),
909
- item_list_id: (_64 = props === null || props === void 0 ? void 0 : props.listId) === null || _64 === void 0 ? void 0 : _64.toString(),
900
+ list_id: (_60 = props === null || props === void 0 ? void 0 : props.listId) === null || _60 === void 0 ? void 0 : _60.toString(),
901
+ item_list_id: (_61 = props === null || props === void 0 ? void 0 : props.listId) === null || _61 === void 0 ? void 0 : _61.toString(),
910
902
  item_list_name: props === null || props === void 0 ? void 0 : props.listName,
911
903
  sorts: props === null || props === void 0 ? void 0 : props.sorts,
912
904
  };
@@ -917,14 +909,14 @@ export class ChordAnalytics {
917
909
  return this.track('Product List Filtered', payload, options);
918
910
  });
919
911
  this.trackProductListViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
920
- var _65, _66, _67, _68, _69, _70;
921
- const formatter = (_67 = (_66 = (_65 = this.options) === null || _65 === void 0 ? void 0 : _65.formatters) === null || _66 === void 0 ? void 0 : _66.events) === null || _67 === void 0 ? void 0 : _67.productListViewed;
912
+ var _62, _63, _64, _65, _66, _67;
913
+ const formatter = (_64 = (_63 = (_62 = this.options) === null || _62 === void 0 ? void 0 : _62.formatters) === null || _63 === void 0 ? void 0 : _63.events) === null || _64 === void 0 ? void 0 : _64.productListViewed;
922
914
  const payload = {
923
915
  category: props === null || props === void 0 ? void 0 : props.category,
924
- list_id: (_68 = props === null || props === void 0 ? void 0 : props.listId) === null || _68 === void 0 ? void 0 : _68.toString(),
925
- item_list_id: (_69 = props === null || props === void 0 ? void 0 : props.listId) === null || _69 === void 0 ? void 0 : _69.toString(),
916
+ list_id: (_65 = props === null || props === void 0 ? void 0 : props.listId) === null || _65 === void 0 ? void 0 : _65.toString(),
917
+ item_list_id: (_66 = props === null || props === void 0 ? void 0 : props.listId) === null || _66 === void 0 ? void 0 : _66.toString(),
926
918
  item_list_name: props === null || props === void 0 ? void 0 : props.listName,
927
- products: (_70 = props === null || props === void 0 ? void 0 : props.products) === null || _70 === void 0 ? void 0 : _70.map((p, i) => {
919
+ products: (_67 = props === null || props === void 0 ? void 0 : props.products) === null || _67 === void 0 ? void 0 : _67.map((p, i) => {
928
920
  var _a, _b, _c, _d;
929
921
  return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
930
922
  }),
@@ -937,8 +929,8 @@ export class ChordAnalytics {
937
929
  return this.track('Product List Viewed', payload, options);
938
930
  });
939
931
  this.trackProductRemoved = (props, options) => __awaiter(this, void 0, void 0, function* () {
940
- var _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85;
941
- const formatter = (_73 = (_72 = (_71 = this.options) === null || _71 === void 0 ? void 0 : _71.formatters) === null || _72 === void 0 ? void 0 : _72.events) === null || _73 === void 0 ? void 0 : _73.productRemoved;
932
+ var _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82;
933
+ const formatter = (_70 = (_69 = (_68 = this.options) === null || _68 === void 0 ? void 0 : _68.formatters) === null || _69 === void 0 ? void 0 : _69.events) === null || _70 === void 0 ? void 0 : _70.productRemoved;
942
934
  /*
943
935
  const product = this.options?.formatters?.objects?.product?.({
944
936
  position: props?.position,
@@ -947,13 +939,13 @@ export class ChordAnalytics {
947
939
  variantId: props?.variantId,
948
940
  })
949
941
  */
950
- const lineItem = (_77 = (_76 = (_75 = (_74 = this.options) === null || _74 === void 0 ? void 0 : _74.formatters) === null || _75 === void 0 ? void 0 : _75.objects) === null || _76 === void 0 ? void 0 : _76.lineItem) === null || _77 === void 0 ? void 0 : _77.call(_76, {
942
+ const lineItem = (_74 = (_73 = (_72 = (_71 = this.options) === null || _71 === void 0 ? void 0 : _71.formatters) === null || _72 === void 0 ? void 0 : _72.objects) === null || _73 === void 0 ? void 0 : _73.lineItem) === null || _74 === void 0 ? void 0 : _74.call(_73, {
951
943
  lineItem: props === null || props === void 0 ? void 0 : props.lineItem,
952
944
  });
953
- const cart = (_81 = (_80 = (_79 = (_78 = this.options) === null || _78 === void 0 ? void 0 : _78.formatters) === null || _79 === void 0 ? void 0 : _79.objects) === null || _80 === void 0 ? void 0 : _80.cart) === null || _81 === void 0 ? void 0 : _81.call(_80, {
945
+ const cart = (_78 = (_77 = (_76 = (_75 = this.options) === null || _75 === void 0 ? void 0 : _75.formatters) === null || _76 === void 0 ? void 0 : _76.objects) === null || _77 === void 0 ? void 0 : _77.cart) === null || _78 === void 0 ? void 0 : _78.call(_77, {
954
946
  cart: props === null || props === void 0 ? void 0 : props.cart,
955
947
  });
956
- const payload = Object.assign(Object.assign({}, lineItem), { cart_id: cart.cart_id, currency: cart.currency, products: [lineItem], total: ((_82 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _82 !== void 0 ? _82 : 0) * ((_83 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _83 !== void 0 ? _83 : 1), value: ((_84 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _84 !== void 0 ? _84 : 0) * ((_85 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _85 !== void 0 ? _85 : 1) });
948
+ const payload = Object.assign(Object.assign({}, lineItem), { cart_id: cart.cart_id, currency: cart.currency, products: [lineItem], total: ((_79 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _79 !== void 0 ? _79 : 0) * ((_80 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _80 !== void 0 ? _80 : 1), value: ((_81 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _81 !== void 0 ? _81 : 0) * ((_82 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _82 !== void 0 ? _82 : 1) });
957
949
  if (typeof formatter === 'function') {
958
950
  const formattedPayload = formatter(props, payload);
959
951
  return this.track('Product Removed', formattedPayload, options);
@@ -961,14 +953,14 @@ export class ChordAnalytics {
961
953
  return this.track('Product Removed', payload, options);
962
954
  });
963
955
  this.trackProductViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
964
- var _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98;
965
- const formatter = (_88 = (_87 = (_86 = this.options) === null || _86 === void 0 ? void 0 : _86.formatters) === null || _87 === void 0 ? void 0 : _87.events) === null || _88 === void 0 ? void 0 : _88.productViewed;
966
- const product = (_92 = (_91 = (_90 = (_89 = this.options) === null || _89 === void 0 ? void 0 : _89.formatters) === null || _90 === void 0 ? void 0 : _90.objects) === null || _91 === void 0 ? void 0 : _91.product) === null || _92 === void 0 ? void 0 : _92.call(_91, props === null || props === void 0 ? void 0 : props.product);
967
- const cart = (_96 = (_95 = (_94 = (_93 = this.options) === null || _93 === void 0 ? void 0 : _93.formatters) === null || _94 === void 0 ? void 0 : _94.objects) === null || _95 === void 0 ? void 0 : _95.cart) === null || _96 === void 0 ? void 0 : _96.call(_95, {
956
+ var _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95;
957
+ const formatter = (_85 = (_84 = (_83 = this.options) === null || _83 === void 0 ? void 0 : _83.formatters) === null || _84 === void 0 ? void 0 : _84.events) === null || _85 === void 0 ? void 0 : _85.productViewed;
958
+ const product = (_89 = (_88 = (_87 = (_86 = this.options) === null || _86 === void 0 ? void 0 : _86.formatters) === null || _87 === void 0 ? void 0 : _87.objects) === null || _88 === void 0 ? void 0 : _88.product) === null || _89 === void 0 ? void 0 : _89.call(_88, props === null || props === void 0 ? void 0 : props.product);
959
+ const cart = (_93 = (_92 = (_91 = (_90 = this.options) === null || _90 === void 0 ? void 0 : _90.formatters) === null || _91 === void 0 ? void 0 : _91.objects) === null || _92 === void 0 ? void 0 : _92.cart) === null || _93 === void 0 ? void 0 : _93.call(_92, {
968
960
  cart: props === null || props === void 0 ? void 0 : props.cart,
969
961
  });
970
- const quantity = ((_97 = props === null || props === void 0 ? void 0 : props.product) === null || _97 === void 0 ? void 0 : _97.quantity) || 1;
971
- const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], value: product.price * (((_98 = props === null || props === void 0 ? void 0 : props.product) === null || _98 === void 0 ? void 0 : _98.quantity) || 1) });
962
+ const quantity = ((_94 = props === null || props === void 0 ? void 0 : props.product) === null || _94 === void 0 ? void 0 : _94.quantity) || 1;
963
+ const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], value: product.price * (((_95 = props === null || props === void 0 ? void 0 : props.product) === null || _95 === void 0 ? void 0 : _95.quantity) || 1) });
972
964
  if (typeof formatter === 'function') {
973
965
  const formattedPayload = formatter(props, payload);
974
966
  return this.track('Product Viewed', formattedPayload, options);
@@ -976,12 +968,12 @@ export class ChordAnalytics {
976
968
  return this.track('Product Viewed', payload, options);
977
969
  });
978
970
  this.trackProductsSearched = (props, options) => __awaiter(this, void 0, void 0, function* () {
979
- var _99, _100, _101, _102;
980
- const formatter = (_101 = (_100 = (_99 = this.options) === null || _99 === void 0 ? void 0 : _99.formatters) === null || _100 === void 0 ? void 0 : _100.events) === null || _101 === void 0 ? void 0 : _101.productsSearched;
971
+ var _96, _97, _98, _99;
972
+ const formatter = (_98 = (_97 = (_96 = this.options) === null || _96 === void 0 ? void 0 : _96.formatters) === null || _97 === void 0 ? void 0 : _97.events) === null || _98 === void 0 ? void 0 : _98.productsSearched;
981
973
  const payload = {
982
974
  currency: props === null || props === void 0 ? void 0 : props.currency,
983
975
  price: typeof (props === null || props === void 0 ? void 0 : props.price) !== 'undefined' ? Number(props === null || props === void 0 ? void 0 : props.price) : undefined,
984
- product_id: (_102 = props === null || props === void 0 ? void 0 : props.productId) === null || _102 === void 0 ? void 0 : _102.toString(),
976
+ product_id: (_99 = props === null || props === void 0 ? void 0 : props.productId) === null || _99 === void 0 ? void 0 : _99.toString(),
985
977
  quantity: props === null || props === void 0 ? void 0 : props.quantity,
986
978
  query: props === null || props === void 0 ? void 0 : props.query,
987
979
  };
@@ -992,8 +984,8 @@ export class ChordAnalytics {
992
984
  return this.track('Products Searched', payload, options);
993
985
  });
994
986
  this.trackSignedIn = (props, options) => __awaiter(this, void 0, void 0, function* () {
995
- var _103, _104, _105;
996
- const formatter = (_105 = (_104 = (_103 = this.options) === null || _103 === void 0 ? void 0 : _103.formatters) === null || _104 === void 0 ? void 0 : _104.events) === null || _105 === void 0 ? void 0 : _105.signedIn;
987
+ var _100, _101, _102;
988
+ const formatter = (_102 = (_101 = (_100 = this.options) === null || _100 === void 0 ? void 0 : _100.formatters) === null || _101 === void 0 ? void 0 : _101.events) === null || _102 === void 0 ? void 0 : _102.signedIn;
997
989
  const payload = {
998
990
  email: props === null || props === void 0 ? void 0 : props.email,
999
991
  method: props === null || props === void 0 ? void 0 : props.method,
@@ -1005,8 +997,8 @@ export class ChordAnalytics {
1005
997
  return this.track('Signed In', payload, options);
1006
998
  });
1007
999
  this.trackSignedOut = (props, options) => __awaiter(this, void 0, void 0, function* () {
1008
- var _106, _107, _108;
1009
- const formatter = (_108 = (_107 = (_106 = this.options) === null || _106 === void 0 ? void 0 : _106.formatters) === null || _107 === void 0 ? void 0 : _107.events) === null || _108 === void 0 ? void 0 : _108.signedOut;
1000
+ var _103, _104, _105;
1001
+ const formatter = (_105 = (_104 = (_103 = this.options) === null || _103 === void 0 ? void 0 : _103.formatters) === null || _104 === void 0 ? void 0 : _104.events) === null || _105 === void 0 ? void 0 : _105.signedOut;
1010
1002
  const payload = {
1011
1003
  email: props === null || props === void 0 ? void 0 : props.email,
1012
1004
  };
@@ -1017,8 +1009,8 @@ export class ChordAnalytics {
1017
1009
  return this.track('Signed Out', payload, options);
1018
1010
  });
1019
1011
  this.trackSignedUp = (props, options) => __awaiter(this, void 0, void 0, function* () {
1020
- var _109, _110, _111;
1021
- const formatter = (_111 = (_110 = (_109 = this.options) === null || _109 === void 0 ? void 0 : _109.formatters) === null || _110 === void 0 ? void 0 : _110.events) === null || _111 === void 0 ? void 0 : _111.signedUp;
1012
+ var _106, _107, _108;
1013
+ const formatter = (_108 = (_107 = (_106 = this.options) === null || _106 === void 0 ? void 0 : _106.formatters) === null || _107 === void 0 ? void 0 : _107.events) === null || _108 === void 0 ? void 0 : _108.signedUp;
1022
1014
  const payload = {
1023
1015
  email: props === null || props === void 0 ? void 0 : props.email,
1024
1016
  method: props === null || props === void 0 ? void 0 : props.method,
@@ -1030,8 +1022,8 @@ export class ChordAnalytics {
1030
1022
  return this.track('Signed Up', payload, options);
1031
1023
  });
1032
1024
  this.trackLoginStarted = (props, options) => __awaiter(this, void 0, void 0, function* () {
1033
- var _112, _113, _114;
1034
- const formatter = (_114 = (_113 = (_112 = this.options) === null || _112 === void 0 ? void 0 : _112.formatters) === null || _113 === void 0 ? void 0 : _113.events) === null || _114 === void 0 ? void 0 : _114.loginStarted;
1025
+ var _109, _110, _111;
1026
+ const formatter = (_111 = (_110 = (_109 = this.options) === null || _109 === void 0 ? void 0 : _109.formatters) === null || _110 === void 0 ? void 0 : _110.events) === null || _111 === void 0 ? void 0 : _111.loginStarted;
1035
1027
  const payload = {
1036
1028
  email: props === null || props === void 0 ? void 0 : props.email,
1037
1029
  };
@@ -1042,8 +1034,8 @@ export class ChordAnalytics {
1042
1034
  return this.track('Login Started', payload, options);
1043
1035
  });
1044
1036
  this.trackSubscriptionCancelled = (props, options) => __awaiter(this, void 0, void 0, function* () {
1045
- var _115, _116, _117, _118;
1046
- const formatter = (_117 = (_116 = (_115 = this.options) === null || _115 === void 0 ? void 0 : _115.formatters) === null || _116 === void 0 ? void 0 : _116.events) === null || _117 === void 0 ? void 0 : _117.subscriptionCancelled;
1037
+ var _112, _113, _114, _115;
1038
+ const formatter = (_114 = (_113 = (_112 = this.options) === null || _112 === void 0 ? void 0 : _112.formatters) === null || _113 === void 0 ? void 0 : _113.events) === null || _114 === void 0 ? void 0 : _114.subscriptionCancelled;
1047
1039
  const payload = {
1048
1040
  actionable_date: props === null || props === void 0 ? void 0 : props.actionableDate,
1049
1041
  address: props === null || props === void 0 ? void 0 : props.address,
@@ -1052,7 +1044,7 @@ export class ChordAnalytics {
1052
1044
  end_date: props === null || props === void 0 ? void 0 : props.endDate,
1053
1045
  interval_length: props === null || props === void 0 ? void 0 : props.intervalLength,
1054
1046
  interval_units: props === null || props === void 0 ? void 0 : props.intervalUnits,
1055
- products: (_118 = props === null || props === void 0 ? void 0 : props.products) === null || _118 === void 0 ? void 0 : _118.map((p, i) => {
1047
+ products: (_115 = props === null || props === void 0 ? void 0 : props.products) === null || _115 === void 0 ? void 0 : _115.map((p, i) => {
1056
1048
  var _a, _b, _c, _d;
1057
1049
  return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
1058
1050
  }),
@@ -1067,8 +1059,8 @@ export class ChordAnalytics {
1067
1059
  return this.track('Subscription Cancelled', payload, options);
1068
1060
  });
1069
1061
  this.trackNavigationClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
1070
- var _119, _120, _121;
1071
- const formatter = (_121 = (_120 = (_119 = this.options) === null || _119 === void 0 ? void 0 : _119.formatters) === null || _120 === void 0 ? void 0 : _120.events) === null || _121 === void 0 ? void 0 : _121.navigationClicked;
1062
+ var _116, _117, _118;
1063
+ const formatter = (_118 = (_117 = (_116 = this.options) === null || _116 === void 0 ? void 0 : _116.formatters) === null || _117 === void 0 ? void 0 : _117.events) === null || _118 === void 0 ? void 0 : _118.navigationClicked;
1072
1064
  const payload = {
1073
1065
  category: props === null || props === void 0 ? void 0 : props.category,
1074
1066
  label: props === null || props === void 0 ? void 0 : props.label,
@@ -1083,15 +1075,15 @@ export class ChordAnalytics {
1083
1075
  return this.track('Navigation Clicked', payload, options);
1084
1076
  });
1085
1077
  this.trackPaymentInfoEntered = (props, options) => __awaiter(this, void 0, void 0, function* () {
1086
- var _122, _123, _124, _125;
1087
- const formatter = (_124 = (_123 = (_122 = this.options) === null || _122 === void 0 ? void 0 : _122.formatters) === null || _123 === void 0 ? void 0 : _123.events) === null || _124 === void 0 ? void 0 : _124.paymentInfoEntered;
1078
+ var _119, _120, _121, _122;
1079
+ const formatter = (_121 = (_120 = (_119 = this.options) === null || _119 === void 0 ? void 0 : _119.formatters) === null || _120 === void 0 ? void 0 : _120.events) === null || _121 === void 0 ? void 0 : _121.paymentInfoEntered;
1088
1080
  const payload = {
1089
1081
  checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
1090
1082
  coupon: props === null || props === void 0 ? void 0 : props.coupon,
1091
1083
  currency: props === null || props === void 0 ? void 0 : props.currency,
1092
1084
  order_id: props === null || props === void 0 ? void 0 : props.orderId,
1093
1085
  payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
1094
- products: (_125 = props === null || props === void 0 ? void 0 : props.products) === null || _125 === void 0 ? void 0 : _125.map((p, i) => {
1086
+ products: (_122 = props === null || props === void 0 ? void 0 : props.products) === null || _122 === void 0 ? void 0 : _122.map((p, i) => {
1095
1087
  var _a, _b, _c, _d;
1096
1088
  return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
1097
1089
  }),
@@ -1106,8 +1098,8 @@ export class ChordAnalytics {
1106
1098
  return this.track('Payment Info Entered', payload, options);
1107
1099
  });
1108
1100
  this.trackOrderCompleted = (props, options) => __awaiter(this, void 0, void 0, function* () {
1109
- var _126, _127, _128, _129;
1110
- const formatter = (_128 = (_127 = (_126 = this.options) === null || _126 === void 0 ? void 0 : _126.formatters) === null || _127 === void 0 ? void 0 : _127.events) === null || _128 === void 0 ? void 0 : _128.orderCompleted;
1101
+ var _123, _124, _125, _126;
1102
+ const formatter = (_125 = (_124 = (_123 = this.options) === null || _123 === void 0 ? void 0 : _123.formatters) === null || _124 === void 0 ? void 0 : _124.events) === null || _125 === void 0 ? void 0 : _125.orderCompleted;
1111
1103
  const payload = {
1112
1104
  affiliation: props === null || props === void 0 ? void 0 : props.affiliation,
1113
1105
  campaign_id: props === null || props === void 0 ? void 0 : props.campaignId,
@@ -1127,7 +1119,7 @@ export class ChordAnalytics {
1127
1119
  order_date: props === null || props === void 0 ? void 0 : props.orderDate,
1128
1120
  order_id: props === null || props === void 0 ? void 0 : props.orderId,
1129
1121
  phone: props === null || props === void 0 ? void 0 : props.phone,
1130
- products: (_129 = props === null || props === void 0 ? void 0 : props.products) === null || _129 === void 0 ? void 0 : _129.map((p, i) => {
1122
+ products: (_126 = props === null || props === void 0 ? void 0 : props.products) === null || _126 === void 0 ? void 0 : _126.map((p, i) => {
1131
1123
  var _a;
1132
1124
  return ({
1133
1125
  affiliation: p === null || p === void 0 ? void 0 : p.affiliation,
@@ -1207,12 +1199,6 @@ export class ChordAnalytics {
1207
1199
  if (shouldEnableWebPixel) {
1208
1200
  this.setupWebPixelListener();
1209
1201
  }
1210
- // Sync identifiers to cart: explicit true/false takes precedence,
1211
- // otherwise auto-detect by checking for window.Shopify.shop (Liquid storefront)
1212
- const shouldEnableIdentifierSync = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.enableIdentifierSync) !== null && _f !== void 0 ? _f : (typeof window !== 'undefined' && !!((_g = window.Shopify) === null || _g === void 0 ? void 0 : _g.shop));
1213
- if (shouldEnableIdentifierSync) {
1214
- this.syncIdentifiersToCart();
1215
- }
1216
1202
  }
1217
1203
  /**
1218
1204
  * Initialize CDP snippet and wait for it to be ready.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './client/index.js';
2
- export * from './client/identifiers.js';
3
2
  export * from './types/index.js';
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './client/index.js';
2
- export * from './client/identifiers.js';
3
2
  export * from './types/index.js';
@@ -34,20 +34,7 @@ export interface ChordAnalyticsOptions<T extends ObjectTypes = ObjectTypes> {
34
34
  awaitConsent?: boolean;
35
35
  debug?: boolean;
36
36
  enableLogging?: boolean;
37
- /**
38
- * Controls the postMessage listener for events from the Shopify Custom Web
39
- * Pixel sandbox. Enabled by default in browser environments. The listener
40
- * only processes messages with source === 'chord-web-pixel', so it is safe
41
- * to leave enabled on non-Shopify sites. Set to false to explicitly disable.
42
- */
43
37
  enableWebPixelListener?: boolean;
44
- /**
45
- * Controls syncing CDP anonymous ID and Google Client ID to Shopify cart
46
- * attributes. When true, always enables sync. When false, always disables it.
47
- * When undefined (default), auto-detects by checking for window.Shopify.shop
48
- * which is present on Shopify Liquid storefronts.
49
- */
50
- enableIdentifierSync?: boolean;
51
38
  formatters: ChordAnalyticsFormatters<T>;
52
39
  namespace?: string;
53
40
  stripNull?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chordcommerce/analytics",
3
3
  "description": "Chord Commerce event tracking",
4
- "version": "1.22.0-beta.3",
4
+ "version": "1.22.0",
5
5
  "author": "Chord Commerce <help@chord.co> (https://www.chord.co)",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",