@zonos/elements 1.3.261 → 1.3.262

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 (105) hide show
  1. package/dist/cjs/index.cjs.js +12 -9
  2. package/dist/cjs/{paypal-73a542cb.js → paypal-e278f405.js} +140 -6
  3. package/dist/cjs/submitGtag-4241212b.js +167 -0
  4. package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
  5. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +30 -21
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +7 -7
  7. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +8 -8
  8. package/dist/cjs/zonos-collect.cjs.entry.js +2 -2
  9. package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
  10. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +8 -8
  11. package/dist/cjs/zonos-invoice.cjs.entry.js +2 -2
  12. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +12 -12
  13. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +7 -0
  14. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +7 -3
  15. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -6
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +7 -0
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +5 -1
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +7 -0
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +6 -3
  20. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +6 -6
  21. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +2 -2
  22. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +6 -6
  23. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +2 -2
  24. package/dist/collection/components/main/zonos-controller.js +2 -2
  25. package/dist/collection/components/store/checkout/paypal.js +4 -4
  26. package/dist/collection/components/utils/analytics/analyticsRelayState.js +112 -0
  27. package/dist/collection/components/utils/analytics/mapToFbEvent.js +66 -0
  28. package/dist/collection/components/utils/submitAnalytics.js +16 -0
  29. package/dist/collection/components/utils/submitFbq.js +56 -0
  30. package/dist/collection/components/utils/submitGtag.js +15 -78
  31. package/dist/collection/scripts/_zonosBase.js +5 -2
  32. package/dist/collection/types/analyticsRelay.js +2 -2
  33. package/dist/esm/index.js +12 -9
  34. package/dist/esm/{paypal-38ca5d21.js → paypal-d8804da5.js} +142 -9
  35. package/dist/esm/submitGtag-7f5c5bb5.js +162 -0
  36. package/dist/esm/zonos-card_5.entry.js +2 -2
  37. package/dist/esm/zonos-cart-items_12.entry.js +30 -21
  38. package/dist/esm/zonos-checkout.entry.js +7 -7
  39. package/dist/esm/zonos-collect-finish_6.entry.js +8 -8
  40. package/dist/esm/zonos-collect.entry.js +2 -2
  41. package/dist/esm/zonos-controller.entry.js +3 -3
  42. package/dist/esm/zonos-invoice-finish_5.entry.js +8 -8
  43. package/dist/esm/zonos-invoice.entry.js +2 -2
  44. package/dist/esm-es5/index.js +1 -1
  45. package/dist/esm-es5/paypal-d8804da5.js +17 -0
  46. package/dist/esm-es5/submitGtag-7f5c5bb5.js +1 -0
  47. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  48. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  49. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  50. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  51. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  52. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  53. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  54. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  55. package/dist/scripts/analyticsRelayOnInit.js +1 -1
  56. package/dist/scripts/index.d.ts +11 -0
  57. package/dist/scripts/index.js +1 -1
  58. package/dist/scripts/loadZonos.js +1 -1
  59. package/dist/scripts/zonos.js +1 -1
  60. package/dist/types/components/utils/analytics/analyticsRelayState.d.ts +43 -0
  61. package/dist/types/components/utils/analytics/mapToFbEvent.d.ts +11 -0
  62. package/dist/types/components/utils/submitAnalytics.d.ts +12 -0
  63. package/dist/types/components/utils/submitFbq.d.ts +14 -0
  64. package/dist/types/components/utils/submitGtag.d.ts +4 -9
  65. package/dist/types/scripts/_zonosBase.d.ts +11 -0
  66. package/dist/types/types/analyticsRelay.d.ts +19 -3
  67. package/dist/zonos-elements/index.esm.js +1 -1
  68. package/dist/zonos-elements/p-022ddd4a.system.entry.js +1 -0
  69. package/dist/zonos-elements/{p-6726fee0.entry.js → p-06ef4d79.entry.js} +1 -1
  70. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  71. package/dist/zonos-elements/{p-e684e68f.entry.js → p-3deb91cb.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-eca03303.system.entry.js → p-56c11359.system.entry.js} +1 -1
  73. package/dist/zonos-elements/p-5dd78b4b.js +1 -0
  74. package/dist/zonos-elements/{p-d2ef0416.system.entry.js → p-66934a78.system.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-e14f421d.system.entry.js → p-7237f43b.system.entry.js} +1 -1
  76. package/dist/zonos-elements/p-72a181b5.entry.js +1 -0
  77. package/dist/zonos-elements/p-75a27c68.entry.js +1 -0
  78. package/dist/zonos-elements/{p-3c3139d2.system.entry.js → p-7df3e44b.system.entry.js} +1 -1
  79. package/dist/zonos-elements/p-838e335c.entry.js +1 -0
  80. package/dist/zonos-elements/p-947f5092.js +17 -0
  81. package/dist/zonos-elements/{p-1917202e.system.entry.js → p-9de27162.system.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-be1032ab.system.entry.js → p-a2b3c1ef.system.entry.js} +1 -1
  83. package/dist/zonos-elements/p-a98b8b68.system.js +18 -0
  84. package/dist/zonos-elements/p-ca411d97.entry.js +1 -0
  85. package/dist/zonos-elements/p-cab6bd98.system.js +1 -0
  86. package/dist/zonos-elements/p-dee6adff.system.js +1 -0
  87. package/dist/zonos-elements/{p-2c9714e8.system.entry.js → p-e36e724b.system.entry.js} +1 -1
  88. package/dist/zonos-elements/{p-8df3c6a0.entry.js → p-e673a4d9.entry.js} +1 -1
  89. package/dist/zonos-elements/{p-7793d334.entry.js → p-f2909fb8.entry.js} +1 -1
  90. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/cjs/submitGtag-9ac5a42e.js +0 -116
  93. package/dist/esm/submitGtag-543058f9.js +0 -113
  94. package/dist/esm-es5/paypal-38ca5d21.js +0 -17
  95. package/dist/esm-es5/submitGtag-543058f9.js +0 -1
  96. package/dist/zonos-elements/p-03e53ef5.entry.js +0 -1
  97. package/dist/zonos-elements/p-17a8a514.system.js +0 -1
  98. package/dist/zonos-elements/p-24407504.js +0 -17
  99. package/dist/zonos-elements/p-31bd3851.system.js +0 -1
  100. package/dist/zonos-elements/p-387f6a4d.js +0 -1
  101. package/dist/zonos-elements/p-47bde0ba.system.js +0 -18
  102. package/dist/zonos-elements/p-5dff9d51.system.entry.js +0 -1
  103. package/dist/zonos-elements/p-9cfd1dc3.entry.js +0 -1
  104. package/dist/zonos-elements/p-eeff2b04.entry.js +0 -1
  105. package/dist/zonos-elements/p-f4030586.entry.js +0 -1
@@ -14,7 +14,7 @@ import { handleFetch } from "../../../utils/handleFetch";
14
14
  import { jsonParse } from "../../../utils/jsonParse";
15
15
  import { allLogs, log } from "../../../utils/logging/log";
16
16
  import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
17
- import { submitGtag, } from "../../../utils/submitGtag";
17
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
18
18
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
19
19
  import RemoveIcon from "./assets/RemoveIcon.svg";
20
20
  /* Need to use relative import because inline-svg-stencil couldn't resolve absolute path */
@@ -386,7 +386,7 @@ export class ZonosCheckoutFinish {
386
386
  window.history.replaceState({}, '', url.toString());
387
387
  // Payment doesn't go through
388
388
  if (error && (messages === null || messages === void 0 ? void 0 : messages.length)) {
389
- submitGtag({
389
+ submitAnalytics({
390
390
  event: 'zonos-checkout-payment-fail',
391
391
  metadata: {
392
392
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -407,14 +407,14 @@ export class ZonosCheckoutFinish {
407
407
  // Save new order info in case the user reloads before we get order info
408
408
  this.saveOrderIdForDuplicationIssue();
409
409
  const checkoutSessionId = storageStore.checkoutSessionId;
410
- submitGtag({
410
+ submitAnalytics({
411
411
  event: 'zonos-checkout-success',
412
412
  metadata: this.buildPurchaseMetadata({
413
413
  checkoutSessionId: checkoutSessionId || '',
414
414
  currency: currency === null || currency === void 0 ? void 0 : currency.toUpperCase(),
415
415
  }),
416
416
  });
417
- submitGtag({
417
+ submitAnalytics({
418
418
  event: 'purchase',
419
419
  metadata: this.buildPurchaseMetadata({
420
420
  checkoutSessionId: checkoutSessionId || '',
@@ -466,13 +466,13 @@ export class ZonosCheckoutFinish {
466
466
  // show success message right away when order id is already created
467
467
  this.isLoading = false;
468
468
  if (paypalStore.orderIdCreated) {
469
- submitGtag({
469
+ submitAnalytics({
470
470
  event: 'zonos-checkout-success',
471
471
  metadata: this.buildPurchaseMetadata({
472
472
  checkoutSessionId: storageStore.checkoutSessionId || '',
473
473
  }),
474
474
  });
475
- submitGtag({
475
+ submitAnalytics({
476
476
  event: 'purchase',
477
477
  metadata: this.buildPurchaseMetadata({
478
478
  checkoutSessionId: storageStore.checkoutSessionId || '',
@@ -503,13 +503,13 @@ export class ZonosCheckoutFinish {
503
503
  this.isLoading = false;
504
504
  if (storeCreditStore.orderIdCreated) {
505
505
  const checkoutSessionId = storageStore.checkoutSessionId;
506
- submitGtag({
506
+ submitAnalytics({
507
507
  event: 'zonos-checkout-success',
508
508
  metadata: this.buildPurchaseMetadata({
509
509
  checkoutSessionId: checkoutSessionId || '',
510
510
  }),
511
511
  });
512
- submitGtag({
512
+ submitAnalytics({
513
513
  event: 'purchase',
514
514
  metadata: this.buildPurchaseMetadata({
515
515
  checkoutSessionId: checkoutSessionId || '',
@@ -583,11 +583,11 @@ export class ZonosCheckoutFinish {
583
583
  }
584
584
  render() {
585
585
  const isTestMode = getIsTestMode();
586
- return (h(Host, { key: '52582ef091037ac1fda75df03ae6b54ffaecb06b', class: "zonos--checkout-finish zonos--elements", style: {
586
+ return (h(Host, { key: '97291e81aef62884ec0519d93dcc7ff184b2913d', class: "zonos--checkout-finish zonos--elements", style: {
587
587
  '--zonos--border-radius': getBorderRadius({
588
588
  overrideBorderStyle: this.borderRadius,
589
589
  }),
590
- } }, this.isImmediateRedirecting && (h("div", { key: '3b0f1089e87e0a82539e9f3e25447b3b4f50cb8f', class: "loading-wrapper" }, h("zonos-spinner", { key: 'fa6f61d8b496b90af9c2a8feb1a89df0fb784827', size: 48 }))), !this.isLoading && !this.isImmediateRedirecting && (h("div", { key: '94cf155bd31b1806cc96f88ff504b870dfe4e661', class: "zonos--finish-details" }, h("div", { key: 'f103079e27fa441467e16fb0dc0ac2ba1a69ed64', 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: '8d85373cbaf7ab2e3372889f07e55e6546e13b72', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: 'cf120f43b009bfa2af326548b89d8139a2e0d954', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '10c9b15539d63c502dc8a8d6ccbd6f927dd24cc1',
590
+ } }, this.isImmediateRedirecting && (h("div", { key: '40569271fb67acb22a4a0fa3c0fc8e1c0c641061', class: "loading-wrapper" }, h("zonos-spinner", { key: '8b431c7751e5e32fe97f4244151ece7de3c6d9bc', size: 48 }))), !this.isLoading && !this.isImmediateRedirecting && (h("div", { key: '0f5c89c285acf8c4f79e058c69cde9011df7e1a2', class: "zonos--finish-details" }, h("div", { key: '7491b15a90941476338ec6b1738312ffd4ebd2c0', 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: '87e0d022014596b02d813ee510917b7ec9b55e09', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '456bd678d5ba6f5b74da34f906bbe9f4bed870ac', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: 'ebde02a73e71ad88d7d68629f2cd8a34d961aa63',
591
591
  // Only show loading spinner if it's not an error notification
592
592
  loading: this.isWaitingToRedirect &&
593
593
  this.notificationType !== 'error', onClick: () => {
@@ -599,9 +599,9 @@ export class ZonosCheckoutFinish {
599
599
  }
600
600
  this.closeClickHandler();
601
601
  }, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
602
- this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: 'b2fc437d0bd21d38ad09cdcdf8b5907b7604ed31', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
602
+ this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '2b86a3d9fb705ad080af532e645fd26aa844a14a', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
603
603
  cartStore.step === 'finish' &&
604
- this.notificationType === 'success' && (h("div", { key: '6c1258c8d66d5127a14ae3ee5eb5477127a395aa', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: 'b3e0a8bf9eb0026595552563fd036a1894c726f8', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'c66ff9fb1998318eaa518c053998de662e53abff', onClick: () => {
604
+ this.notificationType === 'success' && (h("div", { key: '83a9dc9fb81baaf9e223dfa9fe0fc0fc4c106635', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: 'edf8057b0430e3e4bb8fd675554659781e1724ae', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '3c40eee58d8a2ad5951dfdfc7c8d485052b6ba73', onClick: () => {
605
605
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
606
606
  this.redirectToUrl(isZonosDashboard
607
607
  ? '/orders/all'
@@ -95,4 +95,11 @@
95
95
  :host .zonos--test-cards {
96
96
  margin-top: auto;
97
97
  padding-top: 16px;
98
+ }
99
+
100
+ :host(.mobile.mobile) {
101
+ overscroll-behavior: auto;
102
+ }
103
+ :host(.mobile.mobile) .zonos--group {
104
+ overscroll-behavior: auto;
98
105
  }
@@ -10,9 +10,10 @@ import { placeTestOrder } from "../../../utils/api/placeTestOrder";
10
10
  import { getIsStagingMode } from "../../../utils/checkout/getIsStagingMode";
11
11
  import { getIsTestMode } from "../../../utils/checkout/getIsTestMode";
12
12
  import { renderCheckoutCurrency } from "../../../utils/checkout/renderCheckoutCurrency";
13
+ import { classes } from "../../../utils/classes";
13
14
  import { isDarkColor } from "../../../utils/isDarkColor";
14
15
  import { log } from "../../../utils/logging/log";
15
- import { submitGtag } from "../../../utils/submitGtag";
16
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
16
17
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
17
18
  import CheckmarkLineIcon from "./assets/CheckmarkLineIcon.svg";
18
19
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
@@ -68,7 +69,7 @@ export class ZonosCheckoutPayment {
68
69
  }
69
70
  stripeStore.checkoutSettlementCurrency = currencyCode;
70
71
  // submit google tag when the form is complete
71
- submitGtag({
72
+ submitAnalytics({
72
73
  event: 'zonos-checkout-payment-info',
73
74
  metadata: {
74
75
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -196,7 +197,10 @@ export class ZonosCheckoutPayment {
196
197
  display: isPaypalTabSelected ? 'block' : 'none',
197
198
  } }))), isTestMode && (h("zonos-card", { backgroundColor: "gray-100", borderRadius: 12, class: "zonos--test-cards" }, h("zonos-v-stack", { spacing: 16 }, h("div", null, h("zonos-text", { type: "semiBoldLabel" }, translate('Test cards')), h("zonos-text", { textColor: "gray-700" }, translate('Click to copy the card number. Use any future expiration date and three number CVC.'))), h("zonos-button", { icon: h("zonos-icon", { content: CheckmarkLineIcon }), justifyContent: "flex-start", onClick: () => this.copyCardToClipboard('4242424242424242') }, translate('Success'), " (****4242)"), h("zonos-button", { icon: h("zonos-icon", { content: RemoveLineIcon }), justifyContent: "flex-start", onClick: () => this.copyCardToClipboard('4000000000000002') }, translate('Failure'), " (****0002)")), h("zonos-notification", null)))));
198
199
  };
199
- return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), renderPayment())));
200
+ return (h(Host, { class: classes([
201
+ 'zonos--checkout-payment zonos--elements',
202
+ this.isMobile && 'mobile',
203
+ ]) }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), renderPayment())));
200
204
  }
201
205
  static get is() { return "zonos-checkout-payment"; }
202
206
  static get encapsulation() { return "scoped"; }
@@ -41,7 +41,7 @@ import { sendLoadCheckoutFacadeLog } from "../../utils/logging/sendLoadCheckoutF
41
41
  import { sendLoadNativeCheckoutLog } from "../../utils/logging/sendLoadNativeCheckoutLog";
42
42
  import { mergeConfig } from "../../utils/mergeConfig";
43
43
  import { styles } from "../../utils/styles";
44
- import { submitGtag } from "../../utils/submitGtag";
44
+ import { submitAnalytics } from "../../utils/submitAnalytics";
45
45
  import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
46
46
  import { filterExpiredTests } from "../../utils/varianceTest/filterExpiredTests";
47
47
  import { getSelectedTestVariant } from "../../utils/varianceTest/getSelectedTestVariant";
@@ -504,7 +504,7 @@ export class ZonosCheckout {
504
504
  }
505
505
  // Close the confirm dialog
506
506
  this.confirmDialogOpen = false;
507
- submitGtag({
507
+ submitAnalytics({
508
508
  event: 'zonos-checkout-close',
509
509
  metadata: {
510
510
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -831,7 +831,7 @@ export class ZonosCheckout {
831
831
  isPreview: this.preview,
832
832
  sessionTimeout: CHECKOUT_SESSION_TIMEOUT,
833
833
  });
834
- submitGtag({
834
+ submitAnalytics({
835
835
  event: 'zonos-checkout-start',
836
836
  metadata: {
837
837
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -1230,7 +1230,7 @@ export class ZonosCheckout {
1230
1230
  async handleCustomerInfoContinue() {
1231
1231
  var _a, _b, _c, _d;
1232
1232
  // submit google tag when the form is complete
1233
- submitGtag({
1233
+ submitAnalytics({
1234
1234
  event: 'zonos-checkout-customer-info',
1235
1235
  metadata: {
1236
1236
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -1404,7 +1404,7 @@ export class ZonosCheckout {
1404
1404
  }
1405
1405
  catch (err) {
1406
1406
  logError(err);
1407
- submitGtag({
1407
+ submitAnalytics({
1408
1408
  event: 'zonos-checkout-payment-fail',
1409
1409
  metadata: {
1410
1410
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -1423,7 +1423,7 @@ export class ZonosCheckout {
1423
1423
  }
1424
1424
  catch (err) {
1425
1425
  logError(err);
1426
- submitGtag({
1426
+ submitAnalytics({
1427
1427
  event: 'zonos-checkout-payment-fail',
1428
1428
  metadata: {
1429
1429
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -99,4 +99,11 @@
99
99
  }
100
100
  :host .zonos--group-btn zonos-button {
101
101
  width: 100%;
102
+ }
103
+
104
+ :host(.mobile.mobile) {
105
+ overscroll-behavior: auto;
106
+ }
107
+ :host(.mobile.mobile) .zonos--group {
108
+ overscroll-behavior: auto;
102
109
  }
@@ -6,6 +6,7 @@ import { storageStore } from "../../../store/storageStore";
6
6
  import { translate } from "../../../store/translationStore";
7
7
  import { getZonosStoreTheme, zonosStore, zonosStoreOnChange, } from "../../../store/zonosStore";
8
8
  import { updateCheckoutSessionAttributes } from "../../../utils/api/updateCheckoutSessionAttributes";
9
+ import { classes } from "../../../utils/classes";
9
10
  import { containsNonLatinChars } from "../../../utils/containsNonLatinChars";
10
11
  import { extractName } from "../../../utils/extractName";
11
12
  import { log } from "../../../utils/logging/log";
@@ -503,7 +504,10 @@ export class ZonosCustomerInfo {
503
504
  const defaultEmail = ((_b = this.defaultAddress.find(Boolean)) === null || _b === void 0 ? void 0 : _b.email) ||
504
505
  ((_e = (_d = (_c = stripeStore.customerProfile) === null || _c === void 0 ? void 0 : _c.locations) === null || _d === void 0 ? void 0 : _d.find(Boolean)) === null || _e === void 0 ? void 0 : _e.email) ||
505
506
  ((_f = stripeStore.customerProfile) === null || _f === void 0 ? void 0 : _f.email);
506
- return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), h("zonos-link-authentication", { defaultEmail: defaultEmail, isEmailError: this.isEmailError, onLinkAuthenticationChange: this.handleEmailValidation, titleText: translate('Contact') }), this.renderAddressComponent('shipping'), h("zonos-checkbox", { class: "zonos--shipping-same-as-billing-cbx", isChecked: stripeStore.stripeShippingSameAsBilling, label: translate('Shipping address same as billing'), onCheckboxSelected: e => {
507
+ return (h(Host, { class: classes([
508
+ 'zonos--customer-info zonos--elements',
509
+ this.isMobile && 'mobile',
510
+ ]) }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), h("zonos-link-authentication", { defaultEmail: defaultEmail, isEmailError: this.isEmailError, onLinkAuthenticationChange: this.handleEmailValidation, titleText: translate('Contact') }), this.renderAddressComponent('shipping'), h("zonos-checkbox", { class: "zonos--shipping-same-as-billing-cbx", isChecked: stripeStore.stripeShippingSameAsBilling, label: translate('Shipping address same as billing'), onCheckboxSelected: e => {
507
511
  stripeStore.stripeShippingSameAsBilling = e.detail;
508
512
  } }), h("zonos-collapse", { collapsed: !showBilling }, this.renderAddressComponent('billing')), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
509
513
  // use primary type when on mobile mode
@@ -132,4 +132,11 @@
132
132
  display: flex;
133
133
  flex-direction: column;
134
134
  gap: 24px;
135
+ }
136
+
137
+ :host(.mobile.mobile) {
138
+ overscroll-behavior: auto;
139
+ }
140
+ :host(.mobile.mobile) .zonos--group {
141
+ overscroll-behavior: auto;
135
142
  }
@@ -8,7 +8,7 @@ import { trackConversionEvent } from "../../../utils/api/trackConversionEvent";
8
8
  import { renderCheckoutCurrency } from "../../../utils/checkout/renderCheckoutCurrency";
9
9
  import { sortServiceLevelOptionsByAmount } from "../../../utils/checkout/sortServiceLevelOptionsByAmount";
10
10
  import { classes } from "../../../utils/classes";
11
- import { submitGtag } from "../../../utils/submitGtag";
11
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
12
12
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
13
13
  import ChevronUpIcon from "./assets/ChevronUpIcon.svg";
14
14
  export class ZonosShipping {
@@ -81,7 +81,7 @@ export class ZonosShipping {
81
81
  return;
82
82
  }
83
83
  // submit google tag when the form is complete
84
- submitGtag({
84
+ submitAnalytics({
85
85
  event: 'zonos-checkout-shipping-info',
86
86
  metadata: {
87
87
  checkoutSessionId: storageStore.checkoutSessionId,
@@ -237,7 +237,10 @@ export class ZonosShipping {
237
237
  this.collapsedDAPOptions = !this.collapsedDAPOptions;
238
238
  } }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { isMobile: this.isMobile, items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod })))));
239
239
  };
240
- return (h(Host, { class: "zonos--shipping zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!this.serviceLevelsAll.length && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !this.serviceLevelsAll.length ? (h("zonos-banner", { bannerTitle: cartStore.customQuotingError
240
+ return (h(Host, { class: classes([
241
+ 'zonos--shipping zonos--elements',
242
+ this.isMobile && 'mobile',
243
+ ]) }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!this.serviceLevelsAll.length && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !this.serviceLevelsAll.length ? (h("zonos-banner", { bannerTitle: cartStore.customQuotingError
241
244
  ? cartStore.customQuotingError
242
245
  : translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, renderServiceLevels())), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
243
246
  // use primary type when on mobile mode
@@ -12,7 +12,7 @@ import { getBorderRadius } from "../../../utils/getBorderRadius";
12
12
  import { handleFetch } from "../../../utils/handleFetch";
13
13
  import { allLogs, log } from "../../../utils/logging/log";
14
14
  import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
15
- import { submitGtag } from "../../../utils/submitGtag";
15
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
16
16
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
17
17
  import RemoveIcon from "./assets/RemoveIcon.svg";
18
18
  /* Need to use relative import because inline-svg-stencil couldn't resolve absolute path */
@@ -146,7 +146,7 @@ export class ZonosCollectFinish {
146
146
  window.history.replaceState({}, '', url.toString());
147
147
  // Payment doesn't go through
148
148
  if (error && (messages === null || messages === void 0 ? void 0 : messages.length)) {
149
- submitGtag({ event: 'zonos-checkout-payment-fail' });
149
+ submitAnalytics({ event: 'zonos-checkout-payment-fail' });
150
150
  void sendErrorLog({
151
151
  endpoint: 'Stripe payment failed',
152
152
  errors: [
@@ -159,7 +159,7 @@ export class ZonosCollectFinish {
159
159
  });
160
160
  }
161
161
  else {
162
- submitGtag({ event: 'zonos-checkout-success' });
162
+ submitAnalytics({ event: 'zonos-checkout-success' });
163
163
  const checkoutSessionId = storageStore.checkoutSessionId;
164
164
  void trackConversionEvent({
165
165
  checkoutSessionId,
@@ -204,7 +204,7 @@ export class ZonosCollectFinish {
204
204
  // show success message right away when order id is already created
205
205
  this.isLoading = false;
206
206
  if (paypalStore.orderIdCreated) {
207
- submitGtag({ event: 'zonos-checkout-success' });
207
+ submitAnalytics({ event: 'zonos-checkout-success' });
208
208
  const checkoutSessionId = storageStore.checkoutSessionId;
209
209
  void trackConversionEvent({
210
210
  checkoutSessionId,
@@ -260,11 +260,11 @@ export class ZonosCollectFinish {
260
260
  }
261
261
  render() {
262
262
  const cartId = window.Zonos.cartId;
263
- return (h(Host, { key: 'ece5aa1dae1e8e7bb99c0904adeaf6541fbf3ea6', class: "zonos--checkout-finish zonos--elements", style: {
263
+ return (h(Host, { key: '89331d23e3b6b57ce708f091fb4c9cdaae84f838', class: "zonos--checkout-finish zonos--elements", style: {
264
264
  '--zonos--border-radius': getBorderRadius({
265
265
  overrideBorderStyle: this.borderRadius,
266
266
  }),
267
- } }, !this.isLoading && (h("div", { key: 'd48c2384fb55b7b318143f933775c35e29abbe38', class: "zonos--finish-details" }, h("div", { key: '85e03a288ee29bc1f664d03b9c99a164acc51b92', 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: '7fcd228d5144d4f523d15870cdf18491278f0ee6', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), this.confirmationId && (h("zonos-badge", { key: '219365d86b8aef904adffb1fab5e045db174a724', badgeColor: "gray" }, this.confirmationId)), h("zonos-text", { key: '4b2b41bdf35eb2d79b32fa5f7538798e3fd028f5', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.order && cartId && (h("div", { key: '52431496f81706a720406843309646b4fd9b2413', class: "zonos--button-container" }, h("zonos-button", { key: '4ccdbba8da9591c6207a472df29515fec8c0c56f', onClick: () => {
267
+ } }, !this.isLoading && (h("div", { key: '7539e73d3e88c6a486ded338d35ec55398a1f3f4', class: "zonos--finish-details" }, h("div", { key: '4a61f515eff3cf0ce77fc88526424c1e63e5d66a', 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: '6a44ceadf42398e95b3bef73888583cca2d4d076', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), this.confirmationId && (h("zonos-badge", { key: 'aa83de37eaaa4e8a349d6752f11d933584d56c81', badgeColor: "gray" }, this.confirmationId)), h("zonos-text", { key: '26ff76617b31f1726bdc3b7d024a29841692f7b9', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.order && cartId && (h("div", { key: '721ce7b4561f9d82c2a251ac3f595e36567aaac7', class: "zonos--button-container" }, h("zonos-button", { key: '77db63afae505f5472f089e4e5ed9e9c52e48157', onClick: () => {
268
268
  window.open(this.getReceiptUrl({ cartId }), '_blank');
269
269
  }, size: "lg", variant: "primary" }, translate('View receipt')))))))));
270
270
  }
@@ -10,7 +10,7 @@ import { getIsStagingMode } from "../../../utils/checkout/getIsStagingMode";
10
10
  import { getIsTestMode } from "../../../utils/checkout/getIsTestMode";
11
11
  import { renderCheckoutCurrency } from "../../../utils/checkout/renderCheckoutCurrency";
12
12
  import { log } from "../../../utils/logging/log";
13
- import { submitGtag } from "../../../utils/submitGtag";
13
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
14
14
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
15
15
  import CheckmarkLineIcon from "./assets/CheckmarkLineIcon.svg";
16
16
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
@@ -64,7 +64,7 @@ export class ZonosCollectPayment {
64
64
  }
65
65
  stripeStore.checkoutSettlementCurrency = currencyCode;
66
66
  // submit google tag when the form is complete
67
- submitGtag({ event: 'zonos-checkout-payment-info' });
67
+ submitAnalytics({ event: 'zonos-checkout-payment-info' });
68
68
  this.continueClicked.emit();
69
69
  };
70
70
  this.copyCardToClipboard = async (cardNumber) => {
@@ -12,7 +12,7 @@ import { getBorderRadius } from "../../../utils/getBorderRadius";
12
12
  import { handleFetch } from "../../../utils/handleFetch";
13
13
  import { allLogs, log } from "../../../utils/logging/log";
14
14
  import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
15
- import { submitGtag } from "../../../utils/submitGtag";
15
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
16
16
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
17
17
  import RemoveIcon from "./assets/RemoveIcon.svg";
18
18
  /* Need to use relative import because inline-svg-stencil couldn't resolve absolute path */
@@ -146,7 +146,7 @@ export class ZonosInvoiceFinish {
146
146
  window.history.replaceState({}, '', url.toString());
147
147
  // Payment doesn't go through
148
148
  if (error && (messages === null || messages === void 0 ? void 0 : messages.length)) {
149
- submitGtag({ event: 'zonos-checkout-payment-fail' });
149
+ submitAnalytics({ event: 'zonos-checkout-payment-fail' });
150
150
  void sendErrorLog({
151
151
  endpoint: 'Stripe payment failed',
152
152
  errors: [
@@ -159,7 +159,7 @@ export class ZonosInvoiceFinish {
159
159
  });
160
160
  }
161
161
  else {
162
- submitGtag({ event: 'zonos-checkout-success' });
162
+ submitAnalytics({ event: 'zonos-checkout-success' });
163
163
  const checkoutSessionId = storageStore.checkoutSessionId;
164
164
  void trackConversionEvent({
165
165
  checkoutSessionId,
@@ -204,7 +204,7 @@ export class ZonosInvoiceFinish {
204
204
  // show success message right away when order id is already created
205
205
  this.isLoading = false;
206
206
  if (paypalStore.orderIdCreated) {
207
- submitGtag({ event: 'zonos-checkout-success' });
207
+ submitAnalytics({ event: 'zonos-checkout-success' });
208
208
  const checkoutSessionId = storageStore.checkoutSessionId;
209
209
  void trackConversionEvent({
210
210
  checkoutSessionId,
@@ -260,11 +260,11 @@ export class ZonosInvoiceFinish {
260
260
  }
261
261
  render() {
262
262
  const cartId = window.Zonos.cartId;
263
- return (h(Host, { key: '4b4f83358419134c8455c4407f91adf8c1ff37ca', class: "zonos--checkout-finish zonos--elements", style: {
263
+ return (h(Host, { key: '6c0363334a9e6602b93e83a0dfeb733285db7683', class: "zonos--checkout-finish zonos--elements", style: {
264
264
  '--zonos--border-radius': getBorderRadius({
265
265
  overrideBorderStyle: this.borderRadius,
266
266
  }),
267
- } }, !this.isLoading && (h("div", { key: 'fab4606540bf759d9241432f58580b10f1c12b03', class: "zonos--finish-details" }, h("div", { key: 'b619eee9fda1e183b4d761f3576ae28cee2a9619', 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: '30fa51dba81331c9aa7ff4f64c274982d36d8a23', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), this.confirmationId && (h("zonos-badge", { key: 'f10389b65e7910c7b3bd1e0d576afde74bc28e27', badgeColor: "gray" }, this.confirmationId)), h("zonos-text", { key: '5033c51a90cdbccb8b0a333f7b63f3383b70c264', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.order && cartId && (h("div", { key: '83350cb42d4165ec874a8b18dc29e851ca4ae4c8', class: "zonos--button-container" }, h("zonos-button", { key: 'fa05f016f520f65660270c906b7a5940b808cb4b', onClick: () => {
267
+ } }, !this.isLoading && (h("div", { key: '299a9afc37f5e1bbe828f2b68569a686b82baff1', class: "zonos--finish-details" }, h("div", { key: '24a827b96c4a74066b7701c70f6cdf980ff060f5', 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: '74bfa9e0126ea8b0a693fdc2e034cdd6ef352dcb', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), this.confirmationId && (h("zonos-badge", { key: '5cc0089225fac166cfa13cc11e72efeb34ad8567', badgeColor: "gray" }, this.confirmationId)), h("zonos-text", { key: 'fb101b1058adeafe38a03d2a915b6b7f80c44061', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.order && cartId && (h("div", { key: '2ecc8d45967ccd720f0ec4d532aa266ac42acc14', class: "zonos--button-container" }, h("zonos-button", { key: '3f04711341f273a767d5109274f92eec424b1675', onClick: () => {
268
268
  window.open(this.getReceiptUrl({ cartId }), '_blank');
269
269
  }, size: "lg", variant: "primary" }, translate('View receipt')))))))));
270
270
  }
@@ -10,7 +10,7 @@ import { getIsStagingMode } from "../../../utils/checkout/getIsStagingMode";
10
10
  import { getIsTestMode } from "../../../utils/checkout/getIsTestMode";
11
11
  import { renderCheckoutCurrency } from "../../../utils/checkout/renderCheckoutCurrency";
12
12
  import { log } from "../../../utils/logging/log";
13
- import { submitGtag } from "../../../utils/submitGtag";
13
+ import { submitAnalytics } from "../../../utils/submitAnalytics";
14
14
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
15
15
  import CheckmarkLineIcon from "./assets/CheckmarkLineIcon.svg";
16
16
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
@@ -64,7 +64,7 @@ export class ZonosInvoicePayment {
64
64
  }
65
65
  stripeStore.checkoutSettlementCurrency = currencyCode;
66
66
  // submit google tag when the form is complete
67
- submitGtag({ event: 'zonos-checkout-payment-info' });
67
+ submitAnalytics({ event: 'zonos-checkout-payment-info' });
68
68
  this.continueClicked.emit();
69
69
  };
70
70
  this.copyCardToClipboard = async (cardNumber) => {
@@ -143,7 +143,7 @@ export class ZonosController {
143
143
  }
144
144
  document.body.appendChild(scriptToInject);
145
145
  });
146
- // Custom HTML may set window.Zonos.googleAnalyticId; trigger relay ping so parent configures GA
146
+ // Custom HTML may set window.Zonos.googleAnalyticId / window.Zonos.facebookPixelId; trigger relay ping so parent configures GA / FB Pixel
147
147
  ensureAnalyticsRelayPing();
148
148
  }
149
149
  async initGooglePlacesService(settings) {
@@ -331,7 +331,7 @@ export class ZonosController {
331
331
  zonosStore.organizationName = organizationName;
332
332
  }
333
333
  render() {
334
- return h(Host, { key: '4355afb5d8b739bf114a898803287d948fa4539e', class: "zonos--elements" });
334
+ return h(Host, { key: 'd500743a0ed7dc7615e696aaf958216374e7c33b', class: "zonos--elements" });
335
335
  }
336
336
  static get is() { return "zonos-controller"; }
337
337
  static get encapsulation() { return "shadow"; }
@@ -13,7 +13,7 @@ import { isContrastColor } from "../../utils/isContrastColor";
13
13
  import { jsonParse } from "../../utils/jsonParse";
14
14
  import { log } from "../../utils/logging/log";
15
15
  import { logError } from "../../utils/logging/logError";
16
- import { submitGtag } from "../../utils/submitGtag";
16
+ import { submitAnalytics } from "../../utils/submitAnalytics";
17
17
  import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
18
18
  const { onChange: paypalStoreOnChange, reset: paypalStoreReset, state: paypalStore, } = createStore(() => ({
19
19
  intent: 'capture',
@@ -95,7 +95,7 @@ const paypalButtonOptions = ({ checkoutSessionId, onPaypalFail, onPaypalSessionD
95
95
  // reset stripe error message
96
96
  stripeStore.hasPaymentError = false;
97
97
  stripeStore.customErrorMessage = null;
98
- submitGtag({
98
+ submitAnalytics({
99
99
  event: 'zonos-checkout-payment-fail',
100
100
  metadata: {
101
101
  checkoutSessionId,
@@ -160,7 +160,7 @@ const paypalButtonOptions = ({ checkoutSessionId, onPaypalFail, onPaypalSessionD
160
160
  // reset stripe error message
161
161
  stripeStore.hasPaymentError = false;
162
162
  stripeStore.customErrorMessage = null;
163
- submitGtag({
163
+ submitAnalytics({
164
164
  event: 'zonos-checkout-payment-fail',
165
165
  metadata: {
166
166
  checkoutSessionId,
@@ -176,7 +176,7 @@ const paypalButtonOptions = ({ checkoutSessionId, onPaypalFail, onPaypalSessionD
176
176
  // reset paypal error banner
177
177
  paypalStore.paypalErrorMessage = null;
178
178
  // submit google tag when the form is complete
179
- submitGtag({
179
+ submitAnalytics({
180
180
  event: 'zonos-checkout-payment-info',
181
181
  metadata: {
182
182
  checkoutSessionId,
@@ -0,0 +1,112 @@
1
+ import { RELAY_PING_TYPE, RELAY_READY_TYPE, ZONOS_ANALYTIC_TYPE, } from "../../../types/analyticsRelay";
2
+ const providerReady = {
3
+ fbq: false,
4
+ gtag: false,
5
+ };
6
+ const queue = [];
7
+ let listenerAdded = false;
8
+ const isInIframe = () => typeof window !== 'undefined' && window.parent !== window;
9
+ const flushQueue = () => {
10
+ // Walk a copy and rebuild to keep events whose provider isn't ready yet
11
+ const remaining = [];
12
+ while (queue.length > 0) {
13
+ const event = queue.shift();
14
+ if (!providerReady[event.provider]) {
15
+ remaining.push(event);
16
+ continue;
17
+ }
18
+ try {
19
+ window.parent.postMessage({
20
+ event: event.event,
21
+ fbqMode: event.fbqMode,
22
+ metadata: event.payload,
23
+ provider: event.provider,
24
+ type: ZONOS_ANALYTIC_TYPE,
25
+ }, '*');
26
+ }
27
+ catch (_a) {
28
+ // Ignore postMessage failures
29
+ }
30
+ }
31
+ queue.push(...remaining);
32
+ };
33
+ const ensureListener = () => {
34
+ if (listenerAdded)
35
+ return;
36
+ listenerAdded = true;
37
+ window.addEventListener('message', (e) => {
38
+ var _a;
39
+ if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.type) !== RELAY_READY_TYPE)
40
+ return;
41
+ // Older parent scripts may omit `provider`; treat as gtag for backward compatibility.
42
+ const provider = e.data.provider || 'gtag';
43
+ providerReady[provider] = true;
44
+ if (typeof window.Zonos !== 'undefined') {
45
+ if (provider === 'gtag') {
46
+ window.Zonos.googleAnalyticReady = true;
47
+ }
48
+ else {
49
+ window.Zonos.facebookPixelReady = true;
50
+ }
51
+ }
52
+ flushQueue();
53
+ });
54
+ };
55
+ /**
56
+ * Send a ping to the parent so it can inject/configure analytics relays for the providers we care about.
57
+ * Picks up `googleAnalyticId` and `facebookPixelId` from `window.Zonos`, both of which may be set by `customHTML`.
58
+ */
59
+ export const sendRelayPing = () => {
60
+ if (!isInIframe())
61
+ return;
62
+ ensureListener();
63
+ try {
64
+ const z = typeof window.Zonos !== 'undefined' ? window.Zonos : undefined;
65
+ window.parent.postMessage({
66
+ facebookPixelId: z === null || z === void 0 ? void 0 : z.facebookPixelId,
67
+ googleAnalyticId: z === null || z === void 0 ? void 0 : z.googleAnalyticId,
68
+ type: RELAY_PING_TYPE,
69
+ }, '*');
70
+ }
71
+ catch (_a) {
72
+ // Ignore postMessage failures
73
+ }
74
+ };
75
+ /**
76
+ * Sends ping to parent so it can inject/configure analytics relays and respond with ready.
77
+ * Call after customHTML or custom script sets `window.Zonos.googleAnalyticId` / `window.Zonos.facebookPixelId`.
78
+ */
79
+ export const ensureAnalyticsRelayPing = () => {
80
+ if (!isInIframe())
81
+ return;
82
+ // If both providers are already ready, no need to ping again
83
+ if (providerReady.gtag && providerReady.fbq)
84
+ return;
85
+ sendRelayPing();
86
+ };
87
+ /**
88
+ * Queue an analytic event for relay to parent. If the provider's relay is already ready,
89
+ * the event is forwarded immediately; otherwise it waits for the ready signal.
90
+ */
91
+ export const enqueueRelayEvent = (event) => {
92
+ ensureListener();
93
+ if (providerReady[event.provider]) {
94
+ try {
95
+ window.parent.postMessage({
96
+ event: event.event,
97
+ fbqMode: event.fbqMode,
98
+ metadata: event.payload,
99
+ provider: event.provider,
100
+ type: ZONOS_ANALYTIC_TYPE,
101
+ }, '*');
102
+ }
103
+ catch (_a) {
104
+ // Ignore postMessage failures
105
+ }
106
+ return;
107
+ }
108
+ queue.push(event);
109
+ // Re-ping in case the parent hasn't received the ID yet (e.g. customHTML set it after init)
110
+ sendRelayPing();
111
+ };
112
+ export const isAnalyticsRelayInIframe = isInIframe;