@zonos/elements 1.3.180 → 1.3.181

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.
Files changed (80) hide show
  1. package/dist/cjs/{cart-29feab56.js → cart-dcd068d1.js} +18 -3
  2. package/dist/cjs/index.cjs.js +8 -7
  3. package/dist/cjs/{paypal-e032a7fc.js → paypal-4bbc4779.js} +1 -1
  4. package/dist/cjs/zonos-address_7.cjs.entry.js +4 -3
  5. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  7. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/collection/components/store/checkout/cart.js +1 -0
  15. package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -2
  16. package/dist/collection/components/utils/api/trackConversionEvent.js +18 -3
  17. package/dist/collection/scripts/_zonosBase.js +1 -0
  18. package/dist/esm/{cart-7e26e0bc.js → cart-d2c86d90.js} +18 -3
  19. package/dist/esm/index.js +8 -7
  20. package/dist/esm/{paypal-a1a69765.js → paypal-5c0d6407.js} +1 -1
  21. package/dist/esm/zonos-address_7.entry.js +4 -3
  22. package/dist/esm/zonos-cart-items_13.entry.js +2 -2
  23. package/dist/esm/zonos-checkout.entry.js +2 -2
  24. package/dist/esm/zonos-controller.entry.js +1 -1
  25. package/dist/esm/zonos-country-flag.entry.js +1 -1
  26. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  27. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  28. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  29. package/dist/esm/zonos-hello.entry.js +1 -1
  30. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  31. package/dist/esm-es5/{cart-7e26e0bc.js → cart-d2c86d90.js} +1 -1
  32. package/dist/esm-es5/index.js +1 -1
  33. package/dist/esm-es5/{paypal-a1a69765.js → paypal-5c0d6407.js} +1 -1
  34. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  35. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  36. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  37. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  38. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  39. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  40. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  41. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  42. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  43. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  44. package/dist/scripts/index.d.ts +10 -0
  45. package/dist/scripts/index.js +1 -1
  46. package/dist/scripts/loadZonos.js +1 -1
  47. package/dist/scripts/zonos.js +1 -1
  48. package/dist/types/scripts/_zonosBase.d.ts +11 -0
  49. package/dist/zonos-elements/index.esm.js +1 -1
  50. package/dist/zonos-elements/{p-24fd72f3.entry.js → p-09fbafe4.entry.js} +1 -1
  51. package/dist/zonos-elements/{p-c8b106a5.js → p-18ec705b.js} +1 -1
  52. package/dist/zonos-elements/{p-dacb8c7c.entry.js → p-1cebd67c.entry.js} +1 -1
  53. package/dist/zonos-elements/p-1ea1376e.system.entry.js +1 -0
  54. package/dist/zonos-elements/{p-b7e1254e.entry.js → p-27ce063e.entry.js} +1 -1
  55. package/dist/zonos-elements/{p-ff6e291b.system.entry.js → p-29d9bc4a.system.entry.js} +1 -1
  56. package/dist/zonos-elements/p-2ad5692f.entry.js +1 -0
  57. package/dist/zonos-elements/{p-df027c13.system.entry.js → p-33de55b8.system.entry.js} +1 -1
  58. package/dist/zonos-elements/{p-52ab67d9.system.entry.js → p-42abd4dd.system.entry.js} +1 -1
  59. package/dist/zonos-elements/{p-797fab15.system.entry.js → p-4661c29c.system.entry.js} +1 -1
  60. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  61. package/dist/zonos-elements/{p-b8c2c94d.entry.js → p-5a71d418.entry.js} +1 -1
  62. package/dist/zonos-elements/{p-9165c2c1.system.entry.js → p-5be6b837.system.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-5cccf332.entry.js → p-5c695748.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-ace74aa3.system.entry.js → p-5e1a782a.system.entry.js} +1 -1
  65. package/dist/zonos-elements/{p-797c2e00.system.entry.js → p-753811b7.system.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-e21e93e9.system.js → p-91bc2187.system.js} +1 -1
  67. package/dist/zonos-elements/{p-d6eda1f8.entry.js → p-95921a43.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-5cf886fc.entry.js → p-99f17671.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-bb1d560d.system.js → p-99f50bf3.system.js} +1 -1
  70. package/dist/zonos-elements/{p-f424d6b4.system.entry.js → p-9d014d94.system.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-590f4df3.system.entry.js → p-a2368c1c.system.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-cced0000.js → p-a43fba41.js} +1 -1
  73. package/dist/zonos-elements/p-c4d519cf.system.js +1 -0
  74. package/dist/zonos-elements/{p-98715a5b.entry.js → p-e42e0cdb.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-960140ed.entry.js → p-ff8d9f3a.entry.js} +1 -1
  76. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  77. package/package.json +1 -1
  78. package/dist/zonos-elements/p-464a3633.system.js +0 -1
  79. package/dist/zonos-elements/p-8f9fa09a.system.entry.js +0 -1
  80. package/dist/zonos-elements/p-e5102a1d.entry.js +0 -1
@@ -10696,7 +10696,17 @@ const calculateLandedCostNormalized = async (abortController) => {
10696
10696
 
10697
10697
  const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, }) => {
10698
10698
  var _a, _b;
10699
- const isDevelopment = window.location.href.includes('zonos.com') ||
10699
+ const eventCreated = Date.now();
10700
+ const trackLogMetadata = [...window.Zonos.trackEventLogs];
10701
+ window.Zonos.trackEventLogs.push({
10702
+ checkoutSessionId,
10703
+ eventCreated,
10704
+ eventName,
10705
+ });
10706
+ const isDevelopment =
10707
+ // if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
10708
+ (window.location.href.includes('zonos.com') &&
10709
+ !window.location.href.includes('checkout.zonos.com')) ||
10700
10710
  !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.zonosQaUrl) ||
10701
10711
  !!((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.debug);
10702
10712
  const isTest = handleFetch.getIsTestMode() || handleFetch.getIsStagingMode();
@@ -10712,10 +10722,12 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
10712
10722
  endpoint: 'trackConversionEventMetric',
10713
10723
  errors: [`Event "${eventName}" - No checkout session id found`],
10714
10724
  metadata: {
10725
+ allLogs: handleFetch.allLogs,
10715
10726
  checkoutSessionId,
10716
10727
  eventName,
10717
10728
  metadata,
10718
10729
  organizationId,
10730
+ trackEventLogs: trackLogMetadata,
10719
10731
  },
10720
10732
  });
10721
10733
  // checkoutSessionId is required for tracking conversion events to work properly
@@ -10726,19 +10738,21 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
10726
10738
  endpoint: 'trackConversionEventMetric',
10727
10739
  errors: [`Event "${eventName}" - No organization id found`],
10728
10740
  metadata: {
10741
+ allLogs: handleFetch.allLogs,
10729
10742
  checkoutSessionId,
10730
10743
  eventName,
10731
10744
  metadata,
10732
10745
  organizationId,
10746
+ trackEventLogs: trackLogMetadata,
10733
10747
  },
10734
10748
  });
10735
10749
  }
10736
10750
  const body = {
10737
10751
  checkoutSessionId,
10738
10752
  countryCode,
10739
- eventCreated: Date.now(),
10753
+ eventCreated,
10740
10754
  eventName,
10741
- metadata,
10755
+ metadata: Object.assign(Object.assign({}, metadata), { trackEventLogs: trackLogMetadata }),
10742
10756
  organizationId,
10743
10757
  };
10744
10758
  await handleFetch.handleFetch('/api/zonos-elements/track-conversion-event', {
@@ -12137,6 +12151,7 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
12137
12151
  return updateCalculateStatus;
12138
12152
  };
12139
12153
  onChange('checkoutSessionId', () => {
12154
+ handleFetch.log('checkoutSessionId changed', 'info', cartStore.checkoutSessionId);
12140
12155
  if (!cartStore.checkoutSessionId) {
12141
12156
  sessionStorage.removeItem('zonos--checkout-session-id');
12142
12157
  return;
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
129
129
  return null;
130
130
  }
131
131
  const qaUrl = extractZonosQaUrl(window.location.href);
132
- const cdnUrl = "https://v1.3.180.js.zonos.com";
132
+ const cdnUrl = "https://v1.3.181.js.zonos.com";
133
133
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
134
134
  if (!qaUrl &&
135
135
  (cdnUrl.includes('test.') ||
@@ -365,10 +365,10 @@ const zonosLoadUrl = (() => {
365
365
  }
366
366
  return null;
367
367
  })();
368
- const ZONOS_URL = "https://v1.3.180.js.zonos.com";
369
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.180";
370
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.180";
371
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.180";
368
+ const ZONOS_URL = "https://v1.3.181.js.zonos.com";
369
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.181";
370
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.181";
371
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.181";
372
372
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
373
373
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
374
374
  class Zonos {
@@ -383,7 +383,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
383
383
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
384
384
  Zonos._paypalMockResponse = null;
385
385
  Zonos.isBigCommerce = false;
386
- Zonos.releaseDate = "1743787241697";
386
+ Zonos.releaseDate = "1744037880044";
387
387
  Zonos.isLegacyCheckout = false;
388
388
  Zonos.domain = typeof window !== 'undefined'
389
389
  ? // domain that embeds the iframe
@@ -399,7 +399,8 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
399
399
  Zonos.isNpm = true;
400
400
  Zonos.zonosQaUrl = null;
401
401
  Zonos.zonosQaUrlApi = null;
402
- Zonos.version = `v${"1.3.180"}`;
402
+ Zonos.trackEventLogs = [];
403
+ Zonos.version = `v${"1.3.181"}`;
403
404
  Zonos.modeAlerted = false;
404
405
  Zonos.cartData = null;
405
406
  Zonos.paypal = null;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-3812b318.js');
4
- const cart = require('./cart-29feab56.js');
4
+ const cart = require('./cart-dcd068d1.js');
5
5
  const handleFetch = require('./handleFetch-969d05d8.js');
6
6
  const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
7
7
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const handleFetch = require('./handleFetch-969d05d8.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
@@ -60,7 +60,8 @@ const ZonosAddress = class {
60
60
  }
61
61
  }
62
62
  isAddressFilledChanged(newIsAddressFilled) {
63
- if (newIsAddressFilled && !this.trackingSent) {
63
+ // Only need to track the event if the shipping address is filled
64
+ if (newIsAddressFilled && !this.trackingSent && this.type === 'shipping') {
64
65
  this.trackingSent = true;
65
66
  const checkoutSessionId = cart.cartStore.checkoutSessionId;
66
67
  void cart.trackConversionEvent({
@@ -216,7 +217,7 @@ const ZonosAddress = class {
216
217
  this.isAddressFilled = true;
217
218
  }
218
219
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
219
- return (index.h(index.Host, { key: '69fa6f2d27f2d5e4cd4b3dac502d99783a8ef5ec', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: '9c964d61b5f6302d6c402a502204913d6eb8597d', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), index.h("div", { key: '7bd931a5d908fa8e1f6f15e4eded86d13d5f7b4c', class: "zonos--address-component" })));
220
+ return (index.h(index.Host, { key: 'b20ecdc4dcb204acf336a0b65dac129c791a40c4', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: 'f35bfc501fbea097228c46973bce9c0a0d8fe5f9', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), index.h("div", { key: 'beba8d515a75a9ff31f74c124b6eaa69415ed2b8', class: "zonos--address-component" })));
220
221
  }
221
222
  get el() { return index.getElement(this); }
222
223
  static get watchers() { return {
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-e032a7fc.js');
8
+ const paypal = require('./paypal-4bbc4779.js');
9
9
  const zonosStore = require('./zonosStore-3812b318.js');
10
10
  const handleFetch = require('./handleFetch-969d05d8.js');
11
11
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
7
- const paypal = require('./paypal-e032a7fc.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
+ const paypal = require('./paypal-4bbc4779.js');
8
8
  const zonosStore = require('./zonosStore-3812b318.js');
9
9
  const handleFetch = require('./handleFetch-969d05d8.js');
10
10
  const classes = require('./classes-b7918f56.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const handleFetch = require('./handleFetch-969d05d8.js');
9
9
  require('./isDarkColor-ec4a4e7d.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  require('./handleFetch-969d05d8.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
@@ -6,9 +6,9 @@ const index = require('./index-2f90486e.js');
6
6
  const zonosStore = require('./zonosStore-3812b318.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-94ef609c.js');
9
- const cart = require('./cart-29feab56.js');
9
+ const cart = require('./cart-dcd068d1.js');
10
10
  const handleFetch = require('./handleFetch-969d05d8.js');
11
- const paypal = require('./paypal-e032a7fc.js');
11
+ const paypal = require('./paypal-4bbc4779.js');
12
12
  require('./isDarkColor-ec4a4e7d.js');
13
13
 
14
14
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
6
  const zonosStore = require('./zonosStore-3812b318.js');
7
- const cart = require('./cart-29feab56.js');
7
+ const cart = require('./cart-dcd068d1.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const handleFetch = require('./handleFetch-969d05d8.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-29feab56.js');
6
+ const cart = require('./cart-dcd068d1.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-969d05d8.js');
@@ -315,6 +315,7 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
315
315
  return updateCalculateStatus;
316
316
  };
317
317
  onChange('checkoutSessionId', () => {
318
+ log('checkoutSessionId changed', 'info', cartStore.checkoutSessionId);
318
319
  if (!cartStore.checkoutSessionId) {
319
320
  sessionStorage.removeItem('zonos--checkout-session-id');
320
321
  return;
@@ -54,7 +54,8 @@ export class ZonosAddress {
54
54
  }
55
55
  }
56
56
  isAddressFilledChanged(newIsAddressFilled) {
57
- if (newIsAddressFilled && !this.trackingSent) {
57
+ // Only need to track the event if the shipping address is filled
58
+ if (newIsAddressFilled && !this.trackingSent && this.type === 'shipping') {
58
59
  this.trackingSent = true;
59
60
  const checkoutSessionId = cartStore.checkoutSessionId;
60
61
  void trackConversionEvent({
@@ -210,7 +211,7 @@ export class ZonosAddress {
210
211
  this.isAddressFilled = true;
211
212
  }
212
213
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
213
- return (h(Host, { key: '69fa6f2d27f2d5e4cd4b3dac502d99783a8ef5ec', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '9c964d61b5f6302d6c402a502204913d6eb8597d', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '7bd931a5d908fa8e1f6f15e4eded86d13d5f7b4c', class: "zonos--address-component" })));
214
+ return (h(Host, { key: 'b20ecdc4dcb204acf336a0b65dac129c791a40c4', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'f35bfc501fbea097228c46973bce9c0a0d8fe5f9', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: 'beba8d515a75a9ff31f74c124b6eaa69415ed2b8', class: "zonos--address-component" })));
214
215
  }
215
216
  static get is() { return "zonos-address"; }
216
217
  static get encapsulation() { return "scoped"; }
@@ -3,10 +3,21 @@ import { zonosStore } from "../../store/zonosStore";
3
3
  import { getIsStagingMode } from "../checkout/getIsStagingMode";
4
4
  import { getIsTestMode } from "../checkout/getIsTestMode";
5
5
  import { handleFetch } from "../handleFetch";
6
+ import { allLogs } from "../logging/log";
6
7
  import { sendErrorLog } from "../logging/sendErrorLog";
7
8
  export const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, }) => {
8
9
  var _a, _b;
9
- const isDevelopment = window.location.href.includes('zonos.com') ||
10
+ const eventCreated = Date.now();
11
+ const trackLogMetadata = [...window.Zonos.trackEventLogs];
12
+ window.Zonos.trackEventLogs.push({
13
+ checkoutSessionId,
14
+ eventCreated,
15
+ eventName,
16
+ });
17
+ const isDevelopment =
18
+ // if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
19
+ (window.location.href.includes('zonos.com') &&
20
+ !window.location.href.includes('checkout.zonos.com')) ||
10
21
  !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.zonosQaUrl) ||
11
22
  !!((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.debug);
12
23
  const isTest = getIsTestMode() || getIsStagingMode();
@@ -22,10 +33,12 @@ export const trackConversionEvent = async ({ checkoutSessionId, eventName, metad
22
33
  endpoint: 'trackConversionEventMetric',
23
34
  errors: [`Event "${eventName}" - No checkout session id found`],
24
35
  metadata: {
36
+ allLogs,
25
37
  checkoutSessionId,
26
38
  eventName,
27
39
  metadata,
28
40
  organizationId,
41
+ trackEventLogs: trackLogMetadata,
29
42
  },
30
43
  });
31
44
  // checkoutSessionId is required for tracking conversion events to work properly
@@ -36,19 +49,21 @@ export const trackConversionEvent = async ({ checkoutSessionId, eventName, metad
36
49
  endpoint: 'trackConversionEventMetric',
37
50
  errors: [`Event "${eventName}" - No organization id found`],
38
51
  metadata: {
52
+ allLogs,
39
53
  checkoutSessionId,
40
54
  eventName,
41
55
  metadata,
42
56
  organizationId,
57
+ trackEventLogs: trackLogMetadata,
43
58
  },
44
59
  });
45
60
  }
46
61
  const body = {
47
62
  checkoutSessionId,
48
63
  countryCode,
49
- eventCreated: Date.now(),
64
+ eventCreated,
50
65
  eventName,
51
- metadata,
66
+ metadata: Object.assign(Object.assign({}, metadata), { trackEventLogs: trackLogMetadata }),
52
67
  organizationId,
53
68
  };
54
69
  await handleFetch('/api/zonos-elements/track-conversion-event', {
@@ -59,6 +59,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
59
59
  Zonos.isNpm = true;
60
60
  Zonos.zonosQaUrl = null;
61
61
  Zonos.zonosQaUrlApi = null;
62
+ Zonos.trackEventLogs = [];
62
63
  Zonos.version = `v${process.env.NEXT_PUBLIC_ZONOS_PACKAGE_VERSION}`;
63
64
  Zonos.modeAlerted = false;
64
65
  Zonos.cartData = null;
@@ -10694,7 +10694,17 @@ const calculateLandedCostNormalized = async (abortController) => {
10694
10694
 
10695
10695
  const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, }) => {
10696
10696
  var _a, _b;
10697
- const isDevelopment = window.location.href.includes('zonos.com') ||
10697
+ const eventCreated = Date.now();
10698
+ const trackLogMetadata = [...window.Zonos.trackEventLogs];
10699
+ window.Zonos.trackEventLogs.push({
10700
+ checkoutSessionId,
10701
+ eventCreated,
10702
+ eventName,
10703
+ });
10704
+ const isDevelopment =
10705
+ // if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
10706
+ (window.location.href.includes('zonos.com') &&
10707
+ !window.location.href.includes('checkout.zonos.com')) ||
10698
10708
  !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.zonosQaUrl) ||
10699
10709
  !!((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.debug);
10700
10710
  const isTest = getIsTestMode() || getIsStagingMode();
@@ -10710,10 +10720,12 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
10710
10720
  endpoint: 'trackConversionEventMetric',
10711
10721
  errors: [`Event "${eventName}" - No checkout session id found`],
10712
10722
  metadata: {
10723
+ allLogs,
10713
10724
  checkoutSessionId,
10714
10725
  eventName,
10715
10726
  metadata,
10716
10727
  organizationId,
10728
+ trackEventLogs: trackLogMetadata,
10717
10729
  },
10718
10730
  });
10719
10731
  // checkoutSessionId is required for tracking conversion events to work properly
@@ -10724,19 +10736,21 @@ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, })
10724
10736
  endpoint: 'trackConversionEventMetric',
10725
10737
  errors: [`Event "${eventName}" - No organization id found`],
10726
10738
  metadata: {
10739
+ allLogs,
10727
10740
  checkoutSessionId,
10728
10741
  eventName,
10729
10742
  metadata,
10730
10743
  organizationId,
10744
+ trackEventLogs: trackLogMetadata,
10731
10745
  },
10732
10746
  });
10733
10747
  }
10734
10748
  const body = {
10735
10749
  checkoutSessionId,
10736
10750
  countryCode,
10737
- eventCreated: Date.now(),
10751
+ eventCreated,
10738
10752
  eventName,
10739
- metadata,
10753
+ metadata: Object.assign(Object.assign({}, metadata), { trackEventLogs: trackLogMetadata }),
10740
10754
  organizationId,
10741
10755
  };
10742
10756
  await handleFetch('/api/zonos-elements/track-conversion-event', {
@@ -12135,6 +12149,7 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
12135
12149
  return updateCalculateStatus;
12136
12150
  };
12137
12151
  onChange('checkoutSessionId', () => {
12152
+ log('checkoutSessionId changed', 'info', cartStore.checkoutSessionId);
12138
12153
  if (!cartStore.checkoutSessionId) {
12139
12154
  sessionStorage.removeItem('zonos--checkout-session-id');
12140
12155
  return;
package/dist/esm/index.js CHANGED
@@ -126,7 +126,7 @@ const getZonosQaUrl = () => {
126
126
  return null;
127
127
  }
128
128
  const qaUrl = extractZonosQaUrl(window.location.href);
129
- const cdnUrl = "https://v1.3.180.js.zonos.com";
129
+ const cdnUrl = "https://v1.3.181.js.zonos.com";
130
130
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
131
131
  if (!qaUrl &&
132
132
  (cdnUrl.includes('test.') ||
@@ -362,10 +362,10 @@ const zonosLoadUrl = (() => {
362
362
  }
363
363
  return null;
364
364
  })();
365
- const ZONOS_URL = "https://v1.3.180.js.zonos.com";
366
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.180";
367
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.180";
368
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.180";
365
+ const ZONOS_URL = "https://v1.3.181.js.zonos.com";
366
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.181";
367
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.181";
368
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.181";
369
369
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
370
370
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
371
371
  class Zonos {
@@ -380,7 +380,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
380
380
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
381
381
  Zonos._paypalMockResponse = null;
382
382
  Zonos.isBigCommerce = false;
383
- Zonos.releaseDate = "1743787241697";
383
+ Zonos.releaseDate = "1744037880044";
384
384
  Zonos.isLegacyCheckout = false;
385
385
  Zonos.domain = typeof window !== 'undefined'
386
386
  ? // domain that embeds the iframe
@@ -396,7 +396,8 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
396
396
  Zonos.isNpm = true;
397
397
  Zonos.zonosQaUrl = null;
398
398
  Zonos.zonosQaUrlApi = null;
399
- Zonos.version = `v${"1.3.180"}`;
399
+ Zonos.trackEventLogs = [];
400
+ Zonos.version = `v${"1.3.181"}`;
400
401
  Zonos.modeAlerted = false;
401
402
  Zonos.cartData = null;
402
403
  Zonos.paypal = null;
@@ -1,5 +1,5 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-d3c5a0a5.js';
2
- import { t as trackConversionEvent, F as validateCheckoutSession, f as stripeStore, e as cartStore, z as stripeStoreHandleInventoryCheck, r as translate, x as cartStoreNextStep, k as cartStoreClearCheckoutInterval } from './cart-7e26e0bc.js';
2
+ import { t as trackConversionEvent, F as validateCheckoutSession, f as stripeStore, e as cartStore, z as stripeStoreHandleInventoryCheck, r as translate, x as cartStoreNextStep, k as cartStoreClearCheckoutInterval } from './cart-d2c86d90.js';
3
3
  import { h as handleFetch, l as log, b as logError, j as jsonParse } from './handleFetch-621e45bc.js';
4
4
  import { t as tinycolor } from './isDarkColor-446fccb7.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-d82f06f2.js';
2
- import { f as stripeStore, t as trackConversionEvent, V as getFallbackDefaultCountryCode, r as translate, l as localizationStore, e as cartStore } from './cart-7e26e0bc.js';
2
+ import { f as stripeStore, t as trackConversionEvent, V as getFallbackDefaultCountryCode, r as translate, l as localizationStore, e as cartStore } from './cart-d2c86d90.js';
3
3
  import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { b as logError, l as log, i as isCheckoutMobile } from './handleFetch-621e45bc.js';
5
5
  import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
@@ -56,7 +56,8 @@ const ZonosAddress = class {
56
56
  }
57
57
  }
58
58
  isAddressFilledChanged(newIsAddressFilled) {
59
- if (newIsAddressFilled && !this.trackingSent) {
59
+ // Only need to track the event if the shipping address is filled
60
+ if (newIsAddressFilled && !this.trackingSent && this.type === 'shipping') {
60
61
  this.trackingSent = true;
61
62
  const checkoutSessionId = cartStore.checkoutSessionId;
62
63
  void trackConversionEvent({
@@ -212,7 +213,7 @@ const ZonosAddress = class {
212
213
  this.isAddressFilled = true;
213
214
  }
214
215
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
215
- return (h(Host, { key: '69fa6f2d27f2d5e4cd4b3dac502d99783a8ef5ec', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '9c964d61b5f6302d6c402a502204913d6eb8597d', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '7bd931a5d908fa8e1f6f15e4eded86d13d5f7b4c', class: "zonos--address-component" })));
216
+ return (h(Host, { key: 'b20ecdc4dcb204acf336a0b65dac129c791a40c4', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'f35bfc501fbea097228c46973bce9c0a0d8fe5f9', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: 'beba8d515a75a9ff31f74c124b6eaa69415ed2b8', class: "zonos--address-component" })));
216
217
  }
217
218
  get el() { return getElement(this); }
218
219
  static get watchers() { return {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-d82f06f2.js';
2
- import { e as cartStore, E as currencyFormat, r as translate, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, f as stripeStore, C as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, l as localizationStore, x as cartStoreNextStep, R as stripeStoreTranslateAddressToLatin, S as cartStoreUpdateSelectedShippingOption, T as cartStoreGetShippingTransitInfo, U as sortServiceLevelOptionsByAmount } from './cart-7e26e0bc.js';
2
+ import { e as cartStore, E as currencyFormat, r as translate, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, f as stripeStore, C as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, l as localizationStore, x as cartStoreNextStep, R as stripeStoreTranslateAddressToLatin, S as cartStoreUpdateSelectedShippingOption, T as cartStoreGetShippingTransitInfo, U as sortServiceLevelOptionsByAmount } from './cart-d2c86d90.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
- import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-a1a69765.js';
4
+ import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-5c0d6407.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
6
6
  import { h as handleFetch, l as log, s as sendErrorLog, j as jsonParse, g as getIsTestMode, d as allLogs, i as isCheckoutMobile, b as logError, a as getIsStagingMode } from './handleFetch-621e45bc.js';
7
7
  import { c as createCustomEvent } from './createCustomEvent-58159025.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host, F as Fragment } from './index-d82f06f2.js';
2
- import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as stripeStoreRetrievePayment, e as cartStore, f as stripeStore, g as cartStoreUpdateItems, h as cartStoreReset, j as cartStoreResetTabItems, k as cartStoreClearCheckoutInterval, m as stripeStoreInitCheckoutSession, n as stripeStoreGetPaymentIntent, o as cartStoreStartCheckoutInterval, t as trackConversionEvent, p as getCheckoutSessionBody, q as cartStoreUpdateToErrorState, r as translate, u as getZCountryUrlParam, v as cartStoreSetCheckoutSession, w as stripeStorePrefetchLandedCost, x as cartStoreNextStep, y as stripeStoreUpdateCheckoutSessionBaseCurrency, z as stripeStoreHandleInventoryCheck, A as stripeStoreConfirmPayment, B as stripeStoreHandleInventoryRefund, C as stripeStoreReset, D as localizationStoreOnUpdate, E as currencyFormat } from './cart-7e26e0bc.js';
3
- import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-a1a69765.js';
2
+ import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as stripeStoreRetrievePayment, e as cartStore, f as stripeStore, g as cartStoreUpdateItems, h as cartStoreReset, j as cartStoreResetTabItems, k as cartStoreClearCheckoutInterval, m as stripeStoreInitCheckoutSession, n as stripeStoreGetPaymentIntent, o as cartStoreStartCheckoutInterval, t as trackConversionEvent, p as getCheckoutSessionBody, q as cartStoreUpdateToErrorState, r as translate, u as getZCountryUrlParam, v as cartStoreSetCheckoutSession, w as stripeStorePrefetchLandedCost, x as cartStoreNextStep, y as stripeStoreUpdateCheckoutSessionBaseCurrency, z as stripeStoreHandleInventoryCheck, A as stripeStoreConfirmPayment, B as stripeStoreHandleInventoryRefund, C as stripeStoreReset, D as localizationStoreOnUpdate, E as currencyFormat } from './cart-d2c86d90.js';
3
+ import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-5c0d6407.js';
4
4
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-d3c5a0a5.js';
5
5
  import { h as handleFetch, l as log, b as logError, s as sendErrorLog, c as getElapsedTime, d as allLogs, e as getAdditionalLogMetadata, g as getIsTestMode, j as jsonParse, a as getIsStagingMode, i as isCheckoutMobile } from './handleFetch-621e45bc.js';
6
6
  import { c as classes } from './classes-0d95c529.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-d82f06f2.js';
2
- import { G as isValidSelector, f as stripeStore, H as initLocalizationStore, e as cartStore, a as localizationStoreUpdateSelectedCountryCode } from './cart-7e26e0bc.js';
2
+ import { G as isValidSelector, f as stripeStore, H as initLocalizationStore, e as cartStore, a as localizationStoreUpdateSelectedCountryCode } from './cart-d2c86d90.js';
3
3
  import { z as zonosStore, b as zonosStoreInitSetting, d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { h as handleFetch, b as logError, l as log } from './handleFetch-621e45bc.js';
5
5
  import './isDarkColor-446fccb7.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, d as getElement } from './index-d82f06f2.js';
2
- import { l as localizationStore } from './cart-7e26e0bc.js';
2
+ import { l as localizationStore } from './cart-d2c86d90.js';
3
3
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import './handleFetch-621e45bc.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, d as getElement } from './index-d82f06f2.js';
2
- import { a as localizationStoreUpdateSelectedCountryCode, r as translate, l as localizationStore } from './cart-7e26e0bc.js';
2
+ import { a as localizationStoreUpdateSelectedCountryCode, r as translate, l as localizationStore } from './cart-d2c86d90.js';
3
3
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
5
5
  import { i as isDarkColor } from './isDarkColor-446fccb7.js';
@@ -2,9 +2,9 @@ import { r as registerInstance, h, H as Host, d as getElement, c as createEvent
2
2
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-ada3ccad.js';
5
- import { f as stripeStore, t as trackConversionEvent, e as cartStore } from './cart-7e26e0bc.js';
5
+ import { f as stripeStore, t as trackConversionEvent, e as cartStore } from './cart-d2c86d90.js';
6
6
  import { b as logError, l as log } from './handleFetch-621e45bc.js';
7
- import { d as paypalStoreInitButtons } from './paypal-a1a69765.js';
7
+ import { d as paypalStoreInitButtons } from './paypal-5c0d6407.js';
8
8
  import './isDarkColor-446fccb7.js';
9
9
 
10
10
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-d82f06f2.js';
2
- import { r as translate, l as localizationStore, E as currencyFormat } from './cart-7e26e0bc.js';
2
+ import { r as translate, l as localizationStore, E as currencyFormat } from './cart-d2c86d90.js';
3
3
  import { z as zonosStore } from './zonosStore-d3c5a0a5.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
2
2
  import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1, z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-d3c5a0a5.js';
3
- import { l as localizationStore, G as isValidSelector, r as translate, u as getZCountryUrlParam, I as setZCountryUrlParam, J as currencyDisplay, K as currencyConvertAndFormat, L as currencyConvert, E as currencyFormat } from './cart-7e26e0bc.js';
3
+ import { l as localizationStore, G as isValidSelector, r as translate, u as getZCountryUrlParam, I as setZCountryUrlParam, J as currencyDisplay, K as currencyConvertAndFormat, L as currencyConvert, E as currencyFormat } from './cart-d2c86d90.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import { h as handleFetch, b as logError, l as log } from './handleFetch-621e45bc.js';
6
6
  import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
2
- import { W as localizationStoreUpdateSelectedLocale, r as translate, l as localizationStore } from './cart-7e26e0bc.js';
2
+ import { W as localizationStoreUpdateSelectedLocale, r as translate, l as localizationStore } from './cart-d2c86d90.js';
3
3
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { l as languages } from './ILanguage-cd6acb72.js';
5
5
  import './handleFetch-621e45bc.js';