@zonos/elements 1.3.176 → 1.3.178

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 (98) hide show
  1. package/dist/cjs/{cart-e648a65f.js → cart-29feab56.js} +52 -8
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{paypal-2390cfb2.js → paypal-b426662c.js} +7 -3
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +18 -6
  6. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +31 -15
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +7 -3
  8. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-elements.cjs.js +1 -1
  12. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +10 -5
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +14 -7
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +5 -1
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +7 -2
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +9 -4
  20. package/dist/collection/components/store/checkout/cart.js +17 -2
  21. package/dist/collection/components/store/checkout/paypal.js +6 -2
  22. package/dist/collection/components/store/checkout/stripe.js +14 -5
  23. package/dist/collection/components/stripe/zonos-address/zonos-address.js +22 -6
  24. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +9 -3
  25. package/dist/collection/components/utils/api/trackConversionEvent.js +24 -3
  26. package/dist/esm/{cart-dc171e7f.js → cart-7e26e0bc.js} +52 -8
  27. package/dist/esm/index.js +7 -7
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/esm/{paypal-1beec534.js → paypal-f365b438.js} +7 -3
  30. package/dist/esm/zonos-address_7.entry.js +18 -6
  31. package/dist/esm/zonos-cart-items_13.entry.js +31 -15
  32. package/dist/esm/zonos-checkout.entry.js +7 -3
  33. package/dist/esm/zonos-controller.entry.js +1 -1
  34. package/dist/esm/zonos-country-flag.entry.js +1 -1
  35. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  36. package/dist/esm/zonos-elements.js +1 -1
  37. package/dist/esm/zonos-empty-state-payment_4.entry.js +10 -5
  38. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  39. package/dist/esm/zonos-hello.entry.js +1 -1
  40. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  41. package/dist/esm-es5/{cart-dc171e7f.js → cart-7e26e0bc.js} +1 -1
  42. package/dist/esm-es5/index.js +1 -1
  43. package/dist/esm-es5/loader.js +1 -1
  44. package/dist/esm-es5/{paypal-1beec534.js → paypal-f365b438.js} +2 -2
  45. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  46. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  47. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  48. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  49. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  50. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  51. package/dist/esm-es5/zonos-elements.js +1 -1
  52. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  53. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  54. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  55. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  56. package/dist/scripts/index.js +1 -1
  57. package/dist/scripts/loadZonos.js +1 -1
  58. package/dist/scripts/zonos.js +1 -1
  59. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +5 -0
  60. package/dist/types/components/utils/api/trackConversionEvent.d.ts +5 -1
  61. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  62. package/dist/zonos-elements/index.esm.js +1 -1
  63. package/dist/zonos-elements/p-06fb8a1d.entry.js +1 -0
  64. package/dist/zonos-elements/p-215afb3c.entry.js +1 -0
  65. package/dist/zonos-elements/{p-aa651c8f.entry.js → p-24fd72f3.entry.js} +1 -1
  66. package/dist/zonos-elements/p-3b864e9c.js +17 -0
  67. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  68. package/dist/zonos-elements/{p-35bfc9d1.system.entry.js → p-4e6c5167.system.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-a7d2a768.system.entry.js → p-52ab67d9.system.entry.js} +1 -1
  70. package/dist/zonos-elements/{p-655bc743.system.entry.js → p-590f4df3.system.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-117eb67d.entry.js → p-5cccf332.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-f4eaf289.entry.js → p-5cf886fc.entry.js} +1 -1
  73. package/dist/zonos-elements/p-67118a1b.entry.js +1 -0
  74. package/dist/zonos-elements/p-755f1a87.system.entry.js +1 -0
  75. package/dist/zonos-elements/{p-a334b6d8.system.entry.js → p-797c2e00.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-0a6aa4cf.system.entry.js → p-9165c2c1.system.entry.js} +1 -1
  77. package/dist/zonos-elements/{p-f4d9f007.entry.js → p-960140ed.entry.js} +1 -1
  78. package/dist/zonos-elements/{p-ef7d14a3.system.js → p-9719a7ef.system.js} +2 -2
  79. package/dist/zonos-elements/{p-e9f8edbb.entry.js → p-98715a5b.entry.js} +1 -1
  80. package/dist/zonos-elements/{p-7dd0d6b4.system.entry.js → p-ace74aa3.system.entry.js} +1 -1
  81. package/dist/zonos-elements/{p-5372fed8.system.js → p-b00d4c95.system.js} +1 -1
  82. package/dist/zonos-elements/p-bfde653a.system.entry.js +1 -0
  83. package/dist/zonos-elements/p-c4ab09cd.entry.js +1 -0
  84. package/dist/zonos-elements/p-c831bfcd.system.entry.js +1 -0
  85. package/dist/zonos-elements/{p-e3f9a12b.js → p-c8b106a5.js} +1 -1
  86. package/dist/zonos-elements/{p-0ef83bec.entry.js → p-dacb8c7c.entry.js} +1 -1
  87. package/dist/zonos-elements/{p-08fa3875.system.entry.js → p-df027c13.system.entry.js} +1 -1
  88. package/dist/zonos-elements/{p-40e5359c.system.js → p-e21e93e9.system.js} +1 -1
  89. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/zonos-elements/p-007a4d24.entry.js +0 -1
  92. package/dist/zonos-elements/p-24d4f2ec.entry.js +0 -1
  93. package/dist/zonos-elements/p-30ff0a71.entry.js +0 -1
  94. package/dist/zonos-elements/p-60ab9c4c.system.entry.js +0 -1
  95. package/dist/zonos-elements/p-6ef7451f.system.entry.js +0 -1
  96. package/dist/zonos-elements/p-80dd3fb6.entry.js +0 -1
  97. package/dist/zonos-elements/p-bdf93de1.system.entry.js +0 -1
  98. package/dist/zonos-elements/p-d53968eb.js +0 -17
@@ -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-e648a65f.js');
9
+ const cart = require('./cart-29feab56.js');
10
10
  const handleFetch = require('./handleFetch-969d05d8.js');
11
- const paypal = require('./paypal-2390cfb2.js');
11
+ const paypal = require('./paypal-b426662c.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">
@@ -168,8 +168,13 @@ const ZonosPayment = class {
168
168
  var _a;
169
169
  // Only send event once when payment info is filled
170
170
  if (this.isPaymentInfoFilled && !this.trackingSent) {
171
- void cart.trackConversionEvent('checkout_paymentInfoFilled', {
172
- paymentMethod: (_a = cart.stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type,
171
+ const checkoutSessionId = cart.cartStore.checkoutSessionId;
172
+ void cart.trackConversionEvent({
173
+ checkoutSessionId,
174
+ eventName: 'checkout_paymentInfoFilled',
175
+ metadata: {
176
+ paymentMethod: (_a = cart.stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type,
177
+ },
173
178
  });
174
179
  this.trackingSent = true;
175
180
  }
@@ -203,7 +208,7 @@ const ZonosPayment = class {
203
208
  }
204
209
  render() {
205
210
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
206
- return (index.h(index.Host, { key: '3e9f3439e139f6d040bcf8fc101f19d011debdc8', class: "zonos--payment zonos--elements" }, this.titleText && (index.h("zonos-text", { key: '2f22806f4f9380e610899a997ce9ed2bfe997be4', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), index.h("div", { key: '4d5dbd7828b3037d69adb50d4fee4ea9abf3b59b', class: "zonos--payment-component" }), index.h("div", { key: '32ee62f62a028da8481d95781a7368c60ae42614', class: "zonos--payment-paypal-container" })));
211
+ return (index.h(index.Host, { key: '1b5147acd9da752ef77ece211e645b020766a90e', class: "zonos--payment zonos--elements" }, this.titleText && (index.h("zonos-text", { key: 'c4580453c1fc730efb119f514333ccf47dd29787', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), index.h("div", { key: 'aed7ef3a604bf37319a9574ad46fc0dc06bbe35b', class: "zonos--payment-component" }), index.h("div", { key: '95809b939837a929497394602981bf2bb16908a6', class: "zonos--payment-paypal-container" })));
207
212
  }
208
213
  get el() { return index.getElement(this); }
209
214
  static get watchers() { return {
@@ -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-e648a65f.js');
6
+ const cart = require('./cart-29feab56.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-e648a65f.js');
7
+ const cart = require('./cart-29feab56.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-e648a65f.js');
6
+ const cart = require('./cart-29feab56.js');
7
7
  const zonosStore = require('./zonosStore-3812b318.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-969d05d8.js');
@@ -270,7 +270,11 @@ export class ZonosCheckoutFinish {
270
270
  // Save new order info in case the user reloads before we get order info
271
271
  this.saveOrderIdForDuplicationIssue();
272
272
  submitGtag('zonos-checkout-success');
273
- void trackConversionEvent('checkout_orderCompleted');
273
+ const checkoutSessionId = cartStore.checkoutSessionId;
274
+ void trackConversionEvent({
275
+ checkoutSessionId,
276
+ eventName: 'checkout_orderCompleted',
277
+ });
274
278
  const successEvent = createCustomEvent('zonos-checkout-success', {
275
279
  message: 'Zonos Checkout successfully processed order',
276
280
  });
@@ -313,8 +317,11 @@ export class ZonosCheckoutFinish {
313
317
  this.isLoading = false;
314
318
  if (paypalStore.orderIdCreated) {
315
319
  submitGtag('zonos-checkout-success');
316
- // Make sure to send the event when order is completed
317
- await trackConversionEvent('checkout_orderCompleted');
320
+ const checkoutSessionId = cartStore.checkoutSessionId;
321
+ void trackConversionEvent({
322
+ checkoutSessionId,
323
+ eventName: 'checkout_orderCompleted',
324
+ });
318
325
  this.notificationType = 'success';
319
326
  this.notificationTitle = translate("You're all set!");
320
327
  this.notificationMessages =
@@ -381,11 +388,11 @@ export class ZonosCheckoutFinish {
381
388
  }
382
389
  render() {
383
390
  const isTestMode = getIsTestMode();
384
- return (h(Host, { key: '4bb26161ad400a7bbd7b7e9f0568ac5de8f18004', class: "zonos--checkout-finish zonos--elements", style: {
391
+ return (h(Host, { key: 'e8ae24f1668c71f405bf18de82e7703928b02a78', class: "zonos--checkout-finish zonos--elements", style: {
385
392
  '--zonos--border-radius': getBorderRadius({
386
393
  overrideBorderStyle: this.borderRadius,
387
394
  }),
388
- } }, !this.isLoading && (h("div", { key: '85d3bf11c73dfd2b18d0a6d996f2c1f4a01a2288', class: "zonos--finish-details" }, h("div", { key: '0e4fb2b7cd03a4464dde3cce69932b8482da0d02', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '0ced9d9d83576979ae785be52c0ae07dca0fd5de', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: 'd14a6fbe02dc836512b41859cc8de573653c4884', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '5a80853fd1374fc72ccc2b416b62f6c52e4916dd',
395
+ } }, !this.isLoading && (h("div", { key: '6e92d1870eac3f644c3f26d85e3f0108f3cca097', class: "zonos--finish-details" }, h("div", { key: '6979d24f7570631baccdf844f83a85b6da781da7', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '2b422f086008ca3a9c9634e5cb34a230de51e890', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '9f4207e526d03fae6207eb7124358c418413c378', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: 'f6df9c924b93f9149db88a2963c63799549bdc49',
389
396
  // Only show loading spinner if it's not an error notification
390
397
  loading: this.isWaitingToRedirect &&
391
398
  this.notificationType !== 'error', onClick: () => {
@@ -397,9 +404,9 @@ export class ZonosCheckoutFinish {
397
404
  }
398
405
  this.closeClickHandler();
399
406
  }, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
400
- this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: 'ba2fca63de8f04c76fa4d1bc96d06863fbad78cf', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
407
+ this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '8ec8365d0f3a541530e85318744fbb4c85dc385e', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
401
408
  cartStore.step === 'finish' &&
402
- this.notificationType === 'success' && (h("div", { key: '1e3cb2f2f5874b93886247af585566dbaad9a45f', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: 'f8603ae4e116da9f8adabe648a6f626b994f208a', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '91df622529ff650464b3694780e65d2d929548f9', onClick: () => {
409
+ this.notificationType === 'success' && (h("div", { key: '2c91cb3d40eb585513656bcc09dc3144d854af5c', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '883827fbe550c0d9132c27e4a5b984d8d45aa2bc', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'aa3ebf41507ce95dd02778a4b55863b0e880af14', onClick: () => {
403
410
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
404
411
  this.redirectToUrl(isZonosDashboard
405
412
  ? '/orders/all'
@@ -498,7 +498,11 @@ export class ZonosCheckout {
498
498
  sessionTimeout: CHECKOUT_SESSION_TIMEOUT,
499
499
  });
500
500
  submitGtag('zonos-checkout-start');
501
- void trackConversionEvent('checkout_open');
501
+ const checkoutSessionId = cartStore.checkoutSessionId;
502
+ void trackConversionEvent({
503
+ checkoutSessionId,
504
+ eventName: 'checkout_open',
505
+ });
502
506
  const { enabled } = await isStoreDiscountEnabled();
503
507
  // Hide discount input if there's no active discount configured for the store
504
508
  cartStore.shouldHideDiscountInput = !enabled;
@@ -1,4 +1,5 @@
1
1
  import { h, Host, } from "@stencil/core";
2
+ import { cartStore } from "../../../store/checkout/cart";
2
3
  import { stripeStore, stripeStoreTranslateAddressToLatin, } from "../../../store/checkout/stripe";
3
4
  import { translate } from "../../../store/translationStore";
4
5
  import { getZonosStoreTheme, zonosStore, } from "../../../store/zonosStore";
@@ -83,10 +84,14 @@ export class ZonosCustomerInfo {
83
84
  if (hasInvalidCharacters) {
84
85
  return;
85
86
  }
86
- this.continueClicked.emit();
87
87
  // submit google tag when the form is complete
88
88
  submitGtag('zonos-checkout-customer-info');
89
- void trackConversionEvent('checkout_customerInfoCompleted');
89
+ const checkoutSessionId = cartStore.checkoutSessionId;
90
+ void trackConversionEvent({
91
+ checkoutSessionId,
92
+ eventName: 'checkout_customerInfoCompleted',
93
+ });
94
+ this.continueClicked.emit();
90
95
  };
91
96
  this.isTaxIdRequired = () => {
92
97
  const requireTaxIdCountry = ['MX'];
@@ -50,13 +50,18 @@ export class ZonosShipping {
50
50
  this.showErrorBanner = true;
51
51
  return;
52
52
  }
53
- this.showErrorBanner = false;
54
- this.continueClicked.emit();
55
53
  // submit google tag when the form is complete
56
54
  submitGtag('zonos-checkout-shipping-info');
57
- void trackConversionEvent('checkout_shippingInfoCompleted', {
58
- serviceLevelId: (_a = this.selectedShippingMethod) === null || _a === void 0 ? void 0 : _a.value,
55
+ const checkoutSessionId = cartStore.checkoutSessionId;
56
+ void trackConversionEvent({
57
+ checkoutSessionId,
58
+ eventName: 'checkout_shippingInfoCompleted',
59
+ metadata: {
60
+ serviceLevelId: (_a = this.selectedShippingMethod) === null || _a === void 0 ? void 0 : _a.value,
61
+ },
59
62
  });
63
+ this.showErrorBanner = false;
64
+ this.continueClicked.emit();
60
65
  };
61
66
  this.getLandedCostMethodLabelSuffix = (method) => {
62
67
  var _a;
@@ -4,8 +4,9 @@ import { localizationStore } from "../hello/localization";
4
4
  import { translate } from "../translationStore";
5
5
  import { zonosStore } from "../zonosStore";
6
6
  import { getIsStagingMode } from "../../utils/checkout/getIsStagingMode";
7
- import { log } from "../../utils/logging/log";
7
+ import { allLogs, log } from "../../utils/logging/log";
8
8
  import { logError } from "../../utils/logging/logError";
9
+ import { sendErrorLog } from "../../utils/logging/sendErrorLog";
9
10
  const { onChange, reset, state: cartStore, } = createStore(() => ({
10
11
  adjustmentTotal: 0,
11
12
  adjustments: [],
@@ -174,7 +175,21 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
174
175
  checkoutSession.customerSessionClientSecret;
175
176
  stripeStore.customerProfile = checkoutSession.customerProfile;
176
177
  cartStore.checkoutSession = checkoutSession;
177
- cartStore.checkoutSessionId = checkoutSession.id;
178
+ if (!checkoutSession.id) {
179
+ // Log error to track down the issue
180
+ void sendErrorLog({
181
+ endpoint: 'cartStoreSetCheckoutSession',
182
+ errors: ['Missing checkout session id in checkout session'],
183
+ metadata: {
184
+ allLogs,
185
+ checkoutSession,
186
+ },
187
+ });
188
+ }
189
+ // Only update checkout session id if it's not empty
190
+ if (checkoutSession.id) {
191
+ cartStore.checkoutSessionId = checkoutSession.id;
192
+ }
178
193
  // Check if there is a redirect URL in the metadata to override
179
194
  const externalConfirmationPageURL = ((_c = (_b = (_a = cartStore.checkoutSession) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _c === void 0 ? void 0 : _c.value) ||
180
195
  (
@@ -79,8 +79,12 @@ const paypalButtonOptions = ({ checkoutSessionId, onPaypalFail, onPaypalSessionD
79
79
  return {
80
80
  createOrder: async () => {
81
81
  // Clicking on the paypal button should trigger the paymentInfoCompleted event
82
- void trackConversionEvent('checkout_paymentInfoCompleted', {
83
- paymentMethod: 'paypal',
82
+ void trackConversionEvent({
83
+ checkoutSessionId,
84
+ eventName: 'checkout_paymentInfoCompleted',
85
+ metadata: {
86
+ paymentMethod: 'paypal',
87
+ },
84
88
  });
85
89
  const checkoutSessionStatus = await validateCheckoutSession();
86
90
  if (!checkoutSessionStatus.valid) {
@@ -218,8 +218,12 @@ const stripeCalculateLandedCost = async () => {
218
218
  return Object.assign(Object.assign({}, checkoutSession), { landedCost: foundLandedCost });
219
219
  }).filter(Boolean)) || [];
220
220
  // Send event when we get the quote back after the customer clicked "Continue to shipping"
221
+ const checkoutSessionId = cartStore.checkoutSessionId;
221
222
  if (checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.length) {
222
- void trackConversionEvent('checkout_quoteReceived');
223
+ void trackConversionEvent({
224
+ checkoutSessionId,
225
+ eventName: 'checkout_quoteReceived',
226
+ });
223
227
  }
224
228
  // update adjustmentTotal
225
229
  // highlight promocode input error if promocode is applied but no adjustment applied in landed cost
@@ -502,14 +506,15 @@ const stripeStoreConfirmPayment = async () => {
502
506
  stripeStore.customErrorMessage = checkoutSessionStatus.errorMessage;
503
507
  throw new Error(checkoutSessionStatus.errorMessage);
504
508
  }
509
+ const checkoutSessionId = cartStore.checkoutSessionId;
505
510
  if (stripe &&
506
511
  stripeElements &&
507
512
  stripePaymentReady &&
508
513
  stripeClientSecret &&
509
- cartStore.checkoutSessionId) {
514
+ checkoutSessionId) {
510
515
  const buildUrl = new URL(window.location.href);
511
516
  buildUrl.searchParams.set('payment_intent_client_secret', stripeClientSecret);
512
- buildUrl.searchParams.set('zonosCheckoutSessionId', cartStore.checkoutSessionId);
517
+ buildUrl.searchParams.set('zonosCheckoutSessionId', checkoutSessionId);
513
518
  const { error, paymentIntent } = await stripe.confirmPayment({
514
519
  confirmParams: {
515
520
  return_url: buildUrl.toString(),
@@ -517,8 +522,12 @@ const stripeStoreConfirmPayment = async () => {
517
522
  elements: stripeElements,
518
523
  redirect: 'if_required',
519
524
  });
520
- void trackConversionEvent('checkout_paymentInfoCompleted', {
521
- paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
525
+ void trackConversionEvent({
526
+ checkoutSessionId,
527
+ eventName: 'checkout_paymentInfoCompleted',
528
+ metadata: {
529
+ paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
530
+ },
522
531
  });
523
532
  log('Payment intent confirmed', 'info', { error, paymentIntent });
524
533
  if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === 'requires_action') {
@@ -1,4 +1,5 @@
1
1
  import { h, Host, } from "@stencil/core";
2
+ import { cartStore } from "../../store/checkout/cart";
2
3
  import { stripeStore } from "../../store/checkout/stripe";
3
4
  import { getFallbackDefaultCountryCode, localizationStore, } from "../../store/hello/localization";
4
5
  import { translate } from "../../store/translationStore";
@@ -25,6 +26,7 @@ export class ZonosAddress {
25
26
  this.defaultAddress = [];
26
27
  this.stripe = window.Zonos.stripe;
27
28
  this.isDirtyAddress = false;
29
+ this.isAddressFilled = false;
28
30
  }
29
31
  getStripeAddressInstance() {
30
32
  if (this.type === 'billing') {
@@ -46,15 +48,21 @@ export class ZonosAddress {
46
48
  stripeStore.stripeBillingAddressEventData = event;
47
49
  break;
48
50
  default: {
49
- if (event.complete && !this.trackingSent) {
50
- void trackConversionEvent('checkout_customerInfoFilled');
51
- this.trackingSent = true;
52
- }
53
51
  stripeStore.stripeAddressEventData = event;
54
52
  break;
55
53
  }
56
54
  }
57
55
  }
56
+ isAddressFilledChanged(_oldIsAddressFilled, newIsAddressFilled) {
57
+ if (newIsAddressFilled && !this.trackingSent) {
58
+ const checkoutSessionId = cartStore.checkoutSessionId;
59
+ void trackConversionEvent({
60
+ checkoutSessionId,
61
+ eventName: 'checkout_customerInfoFilled',
62
+ });
63
+ this.trackingSent = true;
64
+ }
65
+ }
58
66
  updateAddressElement({ stripeAddressElement, type, }) {
59
67
  if (type === 'shipping') {
60
68
  stripeStore.stripeAddressElement = stripeAddressElement;
@@ -197,8 +205,12 @@ export class ZonosAddress {
197
205
  void this.watchInitStripe();
198
206
  }
199
207
  render() {
208
+ var _a;
209
+ if ((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
210
+ this.isAddressFilled = true;
211
+ }
200
212
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
201
- return (h(Host, { key: '9fd8e0ac4b86c10004c24e9d33f40ec577bd2a73', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'e7c3cbcab6f175354f26a8426d0dbf01afca736d', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '48ccbb019255c5362adf4c7954a7c2e3b015bfa5', class: "zonos--address-component" })));
213
+ return (h(Host, { key: 'cfd982cf11b4a3ad3a4f4545f9517a6d12828338', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '6c044a178075bbf6d440e5cfb4288f0c2832dad6', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '6addaf6962d34b440afcedb7562eb7e84d157c67', class: "zonos--address-component" })));
202
214
  }
203
215
  static get is() { return "zonos-address"; }
204
216
  static get encapsulation() { return "scoped"; }
@@ -281,7 +293,8 @@ export class ZonosAddress {
281
293
  static get states() {
282
294
  return {
283
295
  "stripe": {},
284
- "isDirtyAddress": {}
296
+ "isDirtyAddress": {},
297
+ "isAddressFilled": {}
285
298
  };
286
299
  }
287
300
  static get events() {
@@ -305,6 +318,9 @@ export class ZonosAddress {
305
318
  static get elementRef() { return "el"; }
306
319
  static get watchers() {
307
320
  return [{
321
+ "propName": "isAddressFilled",
322
+ "methodName": "isAddressFilledChanged"
323
+ }, {
308
324
  "propName": "stripe",
309
325
  "methodName": "watchInitStripe"
310
326
  }, {
@@ -1,4 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
+ import { cartStore } from "../../store/checkout/cart";
2
3
  import { stripeStore } from "../../store/checkout/stripe";
3
4
  import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
4
5
  import { logError } from "../../utils/logging/logError";
@@ -17,8 +18,13 @@ export class ZonosPayment {
17
18
  var _a;
18
19
  // Only send event once when payment info is filled
19
20
  if (this.isPaymentInfoFilled && !this.trackingSent) {
20
- void trackConversionEvent('checkout_paymentInfoFilled', {
21
- paymentMethod: (_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type,
21
+ const checkoutSessionId = cartStore.checkoutSessionId;
22
+ void trackConversionEvent({
23
+ checkoutSessionId,
24
+ eventName: 'checkout_paymentInfoFilled',
25
+ metadata: {
26
+ paymentMethod: (_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type,
27
+ },
22
28
  });
23
29
  this.trackingSent = true;
24
30
  }
@@ -52,7 +58,7 @@ export class ZonosPayment {
52
58
  }
53
59
  render() {
54
60
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
55
- return (h(Host, { key: '3e9f3439e139f6d040bcf8fc101f19d011debdc8', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '2f22806f4f9380e610899a997ce9ed2bfe997be4', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '4d5dbd7828b3037d69adb50d4fee4ea9abf3b59b', class: "zonos--payment-component" }), h("div", { key: '32ee62f62a028da8481d95781a7368c60ae42614', class: "zonos--payment-paypal-container" })));
61
+ return (h(Host, { key: '1b5147acd9da752ef77ece211e645b020766a90e', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: 'c4580453c1fc730efb119f514333ccf47dd29787', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: 'aed7ef3a604bf37319a9574ad46fc0dc06bbe35b', class: "zonos--payment-component" }), h("div", { key: '95809b939837a929497394602981bf2bb16908a6', class: "zonos--payment-paypal-container" })));
56
62
  }
57
63
  static get is() { return "zonos-payment"; }
58
64
  static get encapsulation() { return "scoped"; }
@@ -1,10 +1,10 @@
1
- import { cartStore } from "../../store/checkout/cart";
2
1
  import { localizationStore } from "../../store/hello/localization";
3
2
  import { zonosStore } from "../../store/zonosStore";
4
3
  import { getIsStagingMode } from "../checkout/getIsStagingMode";
5
4
  import { getIsTestMode } from "../checkout/getIsTestMode";
6
5
  import { handleFetch } from "../handleFetch";
7
- export const trackConversionEvent = async (eventName, metadata) => {
6
+ import { sendErrorLog } from "../logging/sendErrorLog";
7
+ export const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, }) => {
8
8
  var _a, _b;
9
9
  const isDevelopment = window.location.href.includes('zonos.com') ||
10
10
  !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.zonosQaUrl) ||
@@ -17,11 +17,32 @@ export const trackConversionEvent = async (eventName, metadata) => {
17
17
  }
18
18
  const countryCode = localizationStore.selectedCountryCode;
19
19
  const organizationId = zonosStore.organizationId;
20
- const checkoutSessionId = cartStore.checkoutSessionId;
21
20
  if (!checkoutSessionId) {
21
+ void sendErrorLog({
22
+ endpoint: 'trackConversionEventMetric',
23
+ errors: [`Event "${eventName}" - No checkout session id found`],
24
+ metadata: {
25
+ checkoutSessionId,
26
+ eventName,
27
+ metadata,
28
+ organizationId,
29
+ },
30
+ });
22
31
  // checkoutSessionId is required for tracking conversion events to work properly
23
32
  return;
24
33
  }
34
+ if (!organizationId) {
35
+ void sendErrorLog({
36
+ endpoint: 'trackConversionEventMetric',
37
+ errors: [`Event "${eventName}" - No organization id found`],
38
+ metadata: {
39
+ checkoutSessionId,
40
+ eventName,
41
+ metadata,
42
+ organizationId,
43
+ },
44
+ });
45
+ }
25
46
  const body = {
26
47
  checkoutSessionId,
27
48
  countryCode,
@@ -10692,7 +10692,7 @@ const calculateLandedCostNormalized = async (abortController) => {
10692
10692
  return Object.assign(Object.assign({}, rest), { itemCreateWorkflow: cartWorkflow.items });
10693
10693
  };
10694
10694
 
10695
- const trackConversionEvent = async (eventName, metadata) => {
10695
+ const trackConversionEvent = async ({ checkoutSessionId, eventName, metadata, }) => {
10696
10696
  var _a, _b;
10697
10697
  const isDevelopment = window.location.href.includes('zonos.com') ||
10698
10698
  !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.zonosQaUrl) ||
@@ -10705,11 +10705,32 @@ const trackConversionEvent = async (eventName, metadata) => {
10705
10705
  }
10706
10706
  const countryCode = localizationStore.selectedCountryCode;
10707
10707
  const organizationId = zonosStore.organizationId;
10708
- const checkoutSessionId = cartStore.checkoutSessionId;
10709
10708
  if (!checkoutSessionId) {
10709
+ void sendErrorLog({
10710
+ endpoint: 'trackConversionEventMetric',
10711
+ errors: [`Event "${eventName}" - No checkout session id found`],
10712
+ metadata: {
10713
+ checkoutSessionId,
10714
+ eventName,
10715
+ metadata,
10716
+ organizationId,
10717
+ },
10718
+ });
10710
10719
  // checkoutSessionId is required for tracking conversion events to work properly
10711
10720
  return;
10712
10721
  }
10722
+ if (!organizationId) {
10723
+ void sendErrorLog({
10724
+ endpoint: 'trackConversionEventMetric',
10725
+ errors: [`Event "${eventName}" - No organization id found`],
10726
+ metadata: {
10727
+ checkoutSessionId,
10728
+ eventName,
10729
+ metadata,
10730
+ organizationId,
10731
+ },
10732
+ });
10733
+ }
10713
10734
  const body = {
10714
10735
  checkoutSessionId,
10715
10736
  countryCode,
@@ -11154,8 +11175,12 @@ const stripeCalculateLandedCost = async () => {
11154
11175
  return Object.assign(Object.assign({}, checkoutSession), { landedCost: foundLandedCost });
11155
11176
  }).filter(Boolean)) || [];
11156
11177
  // Send event when we get the quote back after the customer clicked "Continue to shipping"
11178
+ const checkoutSessionId = cartStore.checkoutSessionId;
11157
11179
  if (checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.length) {
11158
- void trackConversionEvent('checkout_quoteReceived');
11180
+ void trackConversionEvent({
11181
+ checkoutSessionId,
11182
+ eventName: 'checkout_quoteReceived',
11183
+ });
11159
11184
  }
11160
11185
  // update adjustmentTotal
11161
11186
  // highlight promocode input error if promocode is applied but no adjustment applied in landed cost
@@ -11438,14 +11463,15 @@ const stripeStoreConfirmPayment = async () => {
11438
11463
  stripeStore.customErrorMessage = checkoutSessionStatus.errorMessage;
11439
11464
  throw new Error(checkoutSessionStatus.errorMessage);
11440
11465
  }
11466
+ const checkoutSessionId = cartStore.checkoutSessionId;
11441
11467
  if (stripe &&
11442
11468
  stripeElements &&
11443
11469
  stripePaymentReady &&
11444
11470
  stripeClientSecret &&
11445
- cartStore.checkoutSessionId) {
11471
+ checkoutSessionId) {
11446
11472
  const buildUrl = new URL(window.location.href);
11447
11473
  buildUrl.searchParams.set('payment_intent_client_secret', stripeClientSecret);
11448
- buildUrl.searchParams.set('zonosCheckoutSessionId', cartStore.checkoutSessionId);
11474
+ buildUrl.searchParams.set('zonosCheckoutSessionId', checkoutSessionId);
11449
11475
  const { error, paymentIntent } = await stripe.confirmPayment({
11450
11476
  confirmParams: {
11451
11477
  return_url: buildUrl.toString(),
@@ -11453,8 +11479,12 @@ const stripeStoreConfirmPayment = async () => {
11453
11479
  elements: stripeElements,
11454
11480
  redirect: 'if_required',
11455
11481
  });
11456
- void trackConversionEvent('checkout_paymentInfoCompleted', {
11457
- paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
11482
+ void trackConversionEvent({
11483
+ checkoutSessionId,
11484
+ eventName: 'checkout_paymentInfoCompleted',
11485
+ metadata: {
11486
+ paymentMethod: paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.payment_method,
11487
+ },
11458
11488
  });
11459
11489
  log('Payment intent confirmed', 'info', { error, paymentIntent });
11460
11490
  if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === 'requires_action') {
@@ -11965,7 +11995,21 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
11965
11995
  checkoutSession.customerSessionClientSecret;
11966
11996
  stripeStore.customerProfile = checkoutSession.customerProfile;
11967
11997
  cartStore.checkoutSession = checkoutSession;
11968
- cartStore.checkoutSessionId = checkoutSession.id;
11998
+ if (!checkoutSession.id) {
11999
+ // Log error to track down the issue
12000
+ void sendErrorLog({
12001
+ endpoint: 'cartStoreSetCheckoutSession',
12002
+ errors: ['Missing checkout session id in checkout session'],
12003
+ metadata: {
12004
+ allLogs,
12005
+ checkoutSession,
12006
+ },
12007
+ });
12008
+ }
12009
+ // Only update checkout session id if it's not empty
12010
+ if (checkoutSession.id) {
12011
+ cartStore.checkoutSessionId = checkoutSession.id;
12012
+ }
11969
12013
  // Check if there is a redirect URL in the metadata to override
11970
12014
  const externalConfirmationPageURL = ((_c = (_b = (_a = cartStore.checkoutSession) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'externalConfirmationPageURL')) === null || _c === void 0 ? void 0 : _c.value) ||
11971
12015
  (
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.176.js.zonos.com";
129
+ const cdnUrl = "https://v1.3.178.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.176.js.zonos.com";
366
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.176";
367
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.176";
368
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.176";
365
+ const ZONOS_URL = "https://v1.3.178.js.zonos.com";
366
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.178";
367
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.178";
368
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.178";
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 = "1743432435915";
383
+ Zonos.releaseDate = "1743692597895";
384
384
  Zonos.isLegacyCheckout = false;
385
385
  Zonos.domain = typeof window !== 'undefined'
386
386
  ? // domain that embeds the iframe
@@ -396,7 +396,7 @@ 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.176"}`;
399
+ Zonos.version = `v${"1.3.178"}`;
400
400
  Zonos.modeAlerted = false;
401
401
  Zonos.cartData = null;
402
402
  Zonos.paypal = null;