@zonos/elements 1.3.260 → 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.
- package/dist/cjs/index.cjs.js +12 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-73a542cb.js → paypal-e278f405.js} +140 -6
- package/dist/cjs/submitGtag-4241212b.js +167 -0
- package/dist/cjs/zonos-address-display_8.cjs.entry.js +17 -17
- package/dist/cjs/zonos-address_4.cjs.entry.js +6 -6
- package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_5.cjs.entry.js +8 -8
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +106 -31
- package/dist/cjs/zonos-checkbox_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-checkout.cjs.entry.js +20 -10
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +4 -4
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +19 -19
- package/dist/cjs/zonos-collect.cjs.entry.js +2 -2
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +9 -9
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +14 -14
- package/dist/cjs/zonos-invoice.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +82 -15
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +7 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +19 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +5 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +6 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.js +1 -1
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +6 -6
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +3 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +2 -2
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +3 -3
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.js +5 -5
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +2 -2
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +6 -6
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +3 -3
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +2 -2
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +3 -3
- package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +2 -2
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
- package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +4 -4
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
- package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/paypal.js +4 -4
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/components/utils/analytics/analyticsRelayState.js +112 -0
- package/dist/collection/components/utils/analytics/mapToFbEvent.js +66 -0
- package/dist/collection/components/utils/submitAnalytics.js +16 -0
- package/dist/collection/components/utils/submitFbq.js +56 -0
- package/dist/collection/components/utils/submitGtag.js +15 -78
- package/dist/collection/scripts/_zonosBase.js +5 -2
- package/dist/collection/types/analyticsRelay.js +2 -2
- package/dist/esm/index.js +12 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-38ca5d21.js → paypal-d8804da5.js} +142 -9
- package/dist/esm/submitGtag-7f5c5bb5.js +162 -0
- package/dist/esm/zonos-address-display_8.entry.js +17 -17
- package/dist/esm/zonos-address_4.entry.js +6 -6
- package/dist/esm/zonos-badge.entry.js +3 -3
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +8 -8
- package/dist/esm/zonos-cart-items_12.entry.js +106 -31
- package/dist/esm/zonos-checkbox_2.entry.js +5 -5
- package/dist/esm/zonos-checkout.entry.js +20 -10
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-collect-cart-items_3.entry.js +4 -4
- package/dist/esm/zonos-collect-finish_6.entry.js +19 -19
- package/dist/esm/zonos-collect.entry.js +2 -2
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +3 -3
- package/dist/esm/zonos-country-select_4.entry.js +9 -9
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +4 -4
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +14 -14
- package/dist/esm/zonos-invoice.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +4 -4
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +4 -4
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/paypal-d8804da5.js +17 -0
- package/dist/esm-es5/submitGtag-7f5c5bb5.js +1 -0
- package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/scripts/analyticsRelayOnInit.js +1 -1
- package/dist/scripts/index.d.ts +18 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +15 -0
- package/dist/types/components/utils/analytics/analyticsRelayState.d.ts +43 -0
- package/dist/types/components/utils/analytics/mapToFbEvent.d.ts +11 -0
- package/dist/types/components/utils/submitAnalytics.d.ts +12 -0
- package/dist/types/components/utils/submitFbq.d.ts +14 -0
- package/dist/types/components/utils/submitGtag.d.ts +4 -9
- package/dist/types/scripts/_zonosBase.d.ts +11 -0
- package/dist/types/types/analyticsRelay.d.ts +19 -3
- package/dist/types/types/checkout/CheckoutConfig.d.ts +7 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-bb6e7e9e.entry.js → p-00bd7e5d.entry.js} +1 -1
- package/dist/zonos-elements/p-022ddd4a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-da5a35a6.entry.js → p-06ef4d79.entry.js} +1 -1
- package/dist/zonos-elements/{p-874ccf1c.system.entry.js → p-072c5e07.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f7ddd288.system.entry.js → p-14f156c6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-66d72216.entry.js → p-155b4425.entry.js} +1 -1
- package/dist/zonos-elements/{p-9161f10d.system.entry.js → p-17476a30.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9dc671f4.entry.js → p-1916c2b0.entry.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-c09540bc.entry.js → p-34fc45e5.entry.js} +1 -1
- package/dist/zonos-elements/{p-e684e68f.entry.js → p-3deb91cb.entry.js} +1 -1
- package/dist/zonos-elements/{p-1368dce7.system.entry.js → p-4a227683.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bcbbe867.entry.js → p-4cee62fb.entry.js} +1 -1
- package/dist/zonos-elements/{p-c1ab70d2.entry.js → p-4d776228.entry.js} +1 -1
- package/dist/zonos-elements/{p-bdaf94a4.system.entry.js → p-50a15e3d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d30e8c3a.entry.js → p-55742c52.entry.js} +1 -1
- package/dist/zonos-elements/{p-20842d8c.system.entry.js → p-56c11359.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d12fa775.entry.js → p-5a79e1f4.entry.js} +1 -1
- package/dist/zonos-elements/{p-df240101.system.entry.js → p-5db00bfa.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5dd78b4b.js +1 -0
- package/dist/zonos-elements/{p-d2ef0416.system.entry.js → p-66934a78.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7237f43b.system.entry.js +1 -0
- package/dist/zonos-elements/p-72a181b5.entry.js +1 -0
- package/dist/zonos-elements/p-75a27c68.entry.js +1 -0
- package/dist/zonos-elements/{p-6f19845a.system.entry.js → p-7dbac3ae.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2ac0fcb8.system.entry.js → p-7df3e44b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5be87ae0.entry.js → p-80e7cab5.entry.js} +1 -1
- package/dist/zonos-elements/p-838e335c.entry.js +1 -0
- package/dist/zonos-elements/{p-dfb4360d.system.entry.js → p-9262a57c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-947f5092.js +17 -0
- package/dist/zonos-elements/{p-3e7dbe9c.system.entry.js → p-9de27162.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bb785f33.entry.js → p-9e761130.entry.js} +1 -1
- package/dist/zonos-elements/{p-c908a7a3.entry.js → p-a1142a95.entry.js} +1 -1
- package/dist/zonos-elements/{p-d4f9e464.system.entry.js → p-a2b3c1ef.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d52ac69.system.entry.js → p-a661dd45.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a98b8b68.system.js +18 -0
- package/dist/zonos-elements/{p-365d4481.system.entry.js → p-aa74b61a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2fa41e93.entry.js → p-ade15fd2.entry.js} +1 -1
- package/dist/zonos-elements/{p-87d89870.system.entry.js → p-b1c76c38.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-770d414a.system.entry.js → p-b2cd18b4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0fc5a2cc.system.entry.js → p-b47fcd8c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c308c5bc.entry.js → p-c263f95f.entry.js} +1 -1
- package/dist/zonos-elements/p-ca411d97.entry.js +1 -0
- package/dist/zonos-elements/p-cab6bd98.system.js +1 -0
- package/dist/zonos-elements/{p-266a86d4.system.entry.js → p-d50fef06.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7a379538.entry.js → p-d983d472.entry.js} +1 -1
- package/dist/zonos-elements/{p-df578aa9.system.entry.js → p-dc4e867e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-dee6adff.system.js +1 -0
- package/dist/zonos-elements/{p-2c9714e8.system.entry.js → p-e36e724b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8df3c6a0.entry.js → p-e673a4d9.entry.js} +1 -1
- package/dist/zonos-elements/{p-d004565d.system.entry.js → p-e76dc266.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3576d900.entry.js → p-ed827ca3.entry.js} +1 -1
- package/dist/zonos-elements/{p-8dae0f0b.entry.js → p-ef12af4b.entry.js} +1 -1
- package/dist/zonos-elements/{p-3a198386.entry.js → p-f0046c48.entry.js} +1 -1
- package/dist/zonos-elements/{p-62dbc5f8.system.entry.js → p-f00a56be.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4416fe27.entry.js → p-f2909fb8.entry.js} +1 -1
- package/dist/zonos-elements/{p-fbc274a8.system.entry.js → p-f7d24382.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-12459b59.entry.js → p-fb87172c.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/submitGtag-9ac5a42e.js +0 -116
- package/dist/esm/submitGtag-543058f9.js +0 -113
- package/dist/esm-es5/paypal-38ca5d21.js +0 -17
- package/dist/esm-es5/submitGtag-543058f9.js +0 -1
- package/dist/zonos-elements/p-0ad75f38.entry.js +0 -1
- package/dist/zonos-elements/p-0f89fc76.system.entry.js +0 -1
- package/dist/zonos-elements/p-17a8a514.system.js +0 -1
- package/dist/zonos-elements/p-24407504.js +0 -17
- package/dist/zonos-elements/p-387f6a4d.js +0 -1
- package/dist/zonos-elements/p-47bde0ba.system.js +0 -18
- package/dist/zonos-elements/p-4aa5f5db.entry.js +0 -1
- package/dist/zonos-elements/p-70e2f9f9.system.entry.js +0 -1
- package/dist/zonos-elements/p-720ae42c.system.js +0 -1
- package/dist/zonos-elements/p-87eef44c.entry.js +0 -1
- package/dist/zonos-elements/p-f2a74e43.entry.js +0 -1
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
179
|
+
submitAnalytics({
|
|
180
180
|
event: 'zonos-checkout-payment-info',
|
|
181
181
|
metadata: {
|
|
182
182
|
checkoutSessionId,
|
|
@@ -352,11 +352,11 @@ export class ZonosAddress {
|
|
|
352
352
|
this.isAddressFilled = true;
|
|
353
353
|
}
|
|
354
354
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
355
|
-
return (h(Host, { key: '
|
|
355
|
+
return (h(Host, { key: '300434f0623d886693dc101b47cb5cd5f9503d3e', class: classes([
|
|
356
356
|
'zonos--address',
|
|
357
357
|
'zonos--elements',
|
|
358
358
|
`zonos--${this.type}-address`,
|
|
359
|
-
]) }, this.titleText && (h("zonos-text", { key: '
|
|
359
|
+
]) }, this.titleText && (h("zonos-text", { key: 'eb7592c563d728af019db397f4d5e7e9f448f4d7', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("slot", { key: 'c9556ead2ad1bf1b462637ae44834dc4f25afa8a', name: "below-title" }), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderShortAddressCodeInput(), h("div", { key: 'cecaa1a9b4a176607125106f55b6e4d6cab31705', class: "zonos--address-component" })));
|
|
360
360
|
}
|
|
361
361
|
static get is() { return "zonos-address"; }
|
|
362
362
|
static get encapsulation() { return "scoped"; }
|
|
@@ -78,9 +78,9 @@ export class ZonosAddressSuggestions {
|
|
|
78
78
|
return segments;
|
|
79
79
|
}
|
|
80
80
|
render() {
|
|
81
|
-
return (h(Host, { key: '
|
|
81
|
+
return (h(Host, { key: 'fe92e3ac70b644dbacda2cfc56e2676ac34632cc', class: "zonos--address-suggestions", role: "group", style: {
|
|
82
82
|
'--zonos--border-radius': getBorderRadius(),
|
|
83
|
-
} }, h("ul", { key: '
|
|
83
|
+
} }, h("ul", { key: 'c042e5d4f563ace9631f3a9d4ad3dd3c9e12cc35', "aria-label": "Suggestions", class: "wrapper", role: "listbox" }, !!this.localSuggestions.length && (h("li", { key: 'b68deb87d190d53b597085f7503c838e0a089227', "aria-selected": false, class: "powered-by option", role: "option" }, h("div", { key: '4dac7702de58610364ad031a181c33d135ec2b1f', class: "powered-by-container" }, h("zonos-text", { key: '74e97d754914267d43e39740ea48634ddcb87355', type: "caption" }, "Suggestions powered by"), h("zonos-text", { key: 'f2771fd3f18665eb414b653740930afe1bb42e4e', type: "semiBoldLabel" }, "Google")), h("zonos-button", { key: '657f036bec0ad31091b83be9927036362f6607a6', "aria-label": "Clear suggestions", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => {
|
|
84
84
|
this.localSuggestions = [];
|
|
85
85
|
} }))), this.localSuggestions.map(suggestion => (
|
|
86
86
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
@@ -924,10 +924,10 @@ export class ZonosAddress {
|
|
|
924
924
|
this.country = localizationStore.selectedCountryCode;
|
|
925
925
|
}
|
|
926
926
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
927
|
-
return (h(Host, { key: '
|
|
927
|
+
return (h(Host, { key: '4874639006b452cc6a2b5e5beabbe97fe7a0fde5', class: classes([
|
|
928
928
|
'zonos--address zonos--elements',
|
|
929
929
|
`zonos--${this.type}-address`,
|
|
930
|
-
]) }, h("zonos-text", { key: '
|
|
930
|
+
]) }, h("zonos-text", { key: 'a365f9de88a9f7602e46e1d87aa180d2b51a4079', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("slot", { key: '66146ab6e78cfce499a10aa4d117a64a49a7f886', name: "below-title" }), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderShortAddressCodeInput(), this.renderCustomAddressForm()));
|
|
931
931
|
}
|
|
932
932
|
static get is() { return "zonos-custom-address"; }
|
|
933
933
|
static get encapsulation() { return "scoped"; }
|
|
@@ -67,7 +67,7 @@ export class ZonosPayment {
|
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
69
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
70
|
-
return (h(Host, { key: '
|
|
70
|
+
return (h(Host, { key: 'd6aba7a614610a64012ef6636e19b345623141ec', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: 'edf8c9ee8d7a9ebf87922a49d9b7420efd80b226', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '3d0d7638a309fdf4dc1ab39bb463a0c35add911d', class: "zonos--payment-component" }), h("div", { key: 'a79f98f63bad2a7c5023eeb5bb28ae39997ada27', class: "zonos--payment-paypal-container" })));
|
|
71
71
|
}
|
|
72
72
|
static get is() { return "zonos-payment"; }
|
|
73
73
|
static get encapsulation() { return "scoped"; }
|
|
@@ -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;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Mapping from our internal event names (GA-style) to Facebook Pixel standard event names.
|
|
15
|
+
* @see https://developers.facebook.com/docs/meta-pixel/reference#standard-events
|
|
16
|
+
*
|
|
17
|
+
* Events without an entry have no FB standard equivalent — they are still fired as a custom event
|
|
18
|
+
* via `fbq('trackCustom', ...)` so merchants can target them.
|
|
19
|
+
*/
|
|
20
|
+
const FB_STANDARD_EVENT_BY_INTERNAL_EVENT = {
|
|
21
|
+
purchase: 'Purchase',
|
|
22
|
+
'zonos-checkout-payment-info': 'AddPaymentInfo',
|
|
23
|
+
'zonos-checkout-start': 'InitiateCheckout',
|
|
24
|
+
};
|
|
25
|
+
export const getFbStandardEventName = (event) => { var _a; return (_a = FB_STANDARD_EVENT_BY_INTERNAL_EVENT[event]) !== null && _a !== void 0 ? _a : null; };
|
|
26
|
+
const isPurchaseMetadata = (metadata) => {
|
|
27
|
+
if (!metadata)
|
|
28
|
+
return false;
|
|
29
|
+
return Array.isArray(metadata.items);
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Convert a GA-style event payload into a Facebook Pixel parameter object.
|
|
33
|
+
*
|
|
34
|
+
* GA `items: [{ item_id, item_name, price, quantity }]` is converted into FB's
|
|
35
|
+
* `contents: [{ id, quantity, item_price }]` with derived `content_ids`, `num_items`,
|
|
36
|
+
* and `content_type: 'product'`. Other primitive params (e.g. `checkoutSessionId`,
|
|
37
|
+
* `paymentMethod`, `serviceLevelId`) are forwarded as-is so merchants can build
|
|
38
|
+
* custom audiences on them.
|
|
39
|
+
*/
|
|
40
|
+
export const buildFbqParams = (metadata) => {
|
|
41
|
+
if (!metadata)
|
|
42
|
+
return {};
|
|
43
|
+
if (!isPurchaseMetadata(metadata)) {
|
|
44
|
+
// Forward primitive metadata as-is for custom events
|
|
45
|
+
return Object.assign({}, metadata);
|
|
46
|
+
}
|
|
47
|
+
const { currency, items, transaction_id, value } = metadata, rest = __rest(metadata, ["currency", "items", "transaction_id", "value"]);
|
|
48
|
+
const contents = items.map(item => ({
|
|
49
|
+
id: item.item_id,
|
|
50
|
+
item_price: item.price,
|
|
51
|
+
quantity: item.quantity,
|
|
52
|
+
}));
|
|
53
|
+
const contentIds = items.map(item => item.item_id);
|
|
54
|
+
const numItems = items.reduce((acc, item) => acc + item.quantity, 0);
|
|
55
|
+
const params = Object.assign(Object.assign({}, rest), { content_ids: contentIds, content_type: 'product', contents, num_items: numItems });
|
|
56
|
+
if (transaction_id) {
|
|
57
|
+
params.order_id = transaction_id;
|
|
58
|
+
}
|
|
59
|
+
if (currency !== undefined) {
|
|
60
|
+
params.currency = currency;
|
|
61
|
+
}
|
|
62
|
+
if (value !== undefined) {
|
|
63
|
+
params.value = value;
|
|
64
|
+
}
|
|
65
|
+
return params;
|
|
66
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { submitFbq } from "./submitFbq";
|
|
2
|
+
import { submitGtag, } from "./submitGtag";
|
|
3
|
+
/**
|
|
4
|
+
* Fan out an analytics event to every enabled provider.
|
|
5
|
+
*
|
|
6
|
+
* - Calls `submitGtag` (Google Analytics) — always sends the original event name.
|
|
7
|
+
* - Calls `submitFbq` (Facebook Pixel) — sends the original event name as a custom event,
|
|
8
|
+
* and additionally fires the matching FB standard event when one exists
|
|
9
|
+
* (e.g. `purchase` → `Purchase`, `zonos-checkout-start` → `InitiateCheckout`).
|
|
10
|
+
*
|
|
11
|
+
* Each submitter no-ops when its provider is disabled in `analyticsProviders` settings.
|
|
12
|
+
*/
|
|
13
|
+
export const submitAnalytics = (input) => {
|
|
14
|
+
submitGtag(input);
|
|
15
|
+
submitFbq(input);
|
|
16
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { zonosStore } from "../store/zonosStore";
|
|
2
|
+
import { enqueueRelayEvent, isAnalyticsRelayInIframe, } from "./analytics/analyticsRelayState";
|
|
3
|
+
import { buildFbqParams, getFbStandardEventName, } from "./analytics/mapToFbEvent";
|
|
4
|
+
import { getIsTestMode } from "./checkout/getIsTestMode";
|
|
5
|
+
import { log } from "./logging/log";
|
|
6
|
+
const isFacebookPixelEnabled = () => {
|
|
7
|
+
const provider = zonosStore.checkoutSettings.analyticsProviders.find(item => item.type === 'FACEBOOK_PIXEL');
|
|
8
|
+
return !!provider && provider.status === 'ENABLED';
|
|
9
|
+
};
|
|
10
|
+
const fireFbq = (mode, event, params) => {
|
|
11
|
+
if (isAnalyticsRelayInIframe()) {
|
|
12
|
+
// fbq does not work in the iframe (Facebook Pixel must be on the parent for proper attribution).
|
|
13
|
+
// Relay to parent which will call fbq() once the FB Pixel script is ready.
|
|
14
|
+
enqueueRelayEvent({
|
|
15
|
+
event,
|
|
16
|
+
fbqMode: mode,
|
|
17
|
+
payload: params,
|
|
18
|
+
provider: 'fbq',
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (typeof window.fbq === 'function') {
|
|
23
|
+
log('Zonos submits fbq event', 'log', `${mode}:${event}`);
|
|
24
|
+
window.fbq(mode, event, params);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Submit a Facebook Pixel event matching the gtag event payload shape.
|
|
29
|
+
*
|
|
30
|
+
* Behavior:
|
|
31
|
+
* - Always fires `fbq('trackCustom', event, params)` so merchants see `zonos-xxx` events.
|
|
32
|
+
* - If the event has a Facebook standard equivalent (e.g. `purchase` → `Purchase`,
|
|
33
|
+
* `zonos-checkout-start` → `InitiateCheckout`, `zonos-checkout-payment-info` →
|
|
34
|
+
* `AddPaymentInfo`), additionally fires `fbq('track', standardEvent, params)` with
|
|
35
|
+
* FB-formatted parameters.
|
|
36
|
+
*
|
|
37
|
+
* @see https://developers.facebook.com/docs/meta-pixel/reference
|
|
38
|
+
*/
|
|
39
|
+
export const submitFbq = ({ event, metadata }) => {
|
|
40
|
+
if (!isFacebookPixelEnabled()) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const isTestMode = getIsTestMode();
|
|
44
|
+
const baseParams = buildFbqParams(metadata);
|
|
45
|
+
const params = Object.assign(Object.assign({}, baseParams), (isTestMode && { isTestMode: true }));
|
|
46
|
+
// filter null values
|
|
47
|
+
const filteredParams = Object.fromEntries(Object.entries(params).filter(([_, value]) => value !== null));
|
|
48
|
+
// 1) Always emit the original event as a custom event so merchants can target zonos-xxx names.
|
|
49
|
+
fireFbq('trackCustom', event, filteredParams);
|
|
50
|
+
// 2) Emit FB standard equivalent if one exists. Skipped when the event itself is the standard
|
|
51
|
+
// name to avoid double-firing (e.g. 'purchase' -> 'Purchase').
|
|
52
|
+
const fbStandardEvent = getFbStandardEventName(event);
|
|
53
|
+
if (fbStandardEvent && fbStandardEvent !== event) {
|
|
54
|
+
fireFbq('track', fbStandardEvent, filteredParams);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -1,99 +1,36 @@
|
|
|
1
1
|
import { zonosStore } from "../store/zonosStore";
|
|
2
|
+
import { enqueueRelayEvent, ensureAnalyticsRelayPing as ensureAnalyticsRelayPingShared, isAnalyticsRelayInIframe, } from "./analytics/analyticsRelayState";
|
|
2
3
|
import { getIsTestMode } from "./checkout/getIsTestMode";
|
|
3
4
|
import { log } from "./logging/log";
|
|
4
|
-
import { RELAY_PING_TYPE, RELAY_READY_TYPE, ZONOS_ANALYTIC_TYPE, } from "../../types/analyticsRelay";
|
|
5
|
-
let parentGtagReady = false;
|
|
6
|
-
let relayListenerAdded = false;
|
|
7
|
-
const queuedEvents = [];
|
|
8
|
-
function flushQueuedEvents() {
|
|
9
|
-
while (queuedEvents.length > 0) {
|
|
10
|
-
const { event, payload } = queuedEvents.shift();
|
|
11
|
-
try {
|
|
12
|
-
window.parent.postMessage({
|
|
13
|
-
event,
|
|
14
|
-
metadata: payload,
|
|
15
|
-
type: ZONOS_ANALYTIC_TYPE,
|
|
16
|
-
}, '*');
|
|
17
|
-
}
|
|
18
|
-
catch (_a) {
|
|
19
|
-
// Ignore postMessage failures
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function ensureRelayListener() {
|
|
24
|
-
if (relayListenerAdded)
|
|
25
|
-
return;
|
|
26
|
-
relayListenerAdded = true;
|
|
27
|
-
window.addEventListener('message', (e) => {
|
|
28
|
-
var _a;
|
|
29
|
-
if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.type) === RELAY_READY_TYPE) {
|
|
30
|
-
parentGtagReady = true;
|
|
31
|
-
if (typeof window.Zonos !== 'undefined') {
|
|
32
|
-
window.Zonos.googleAnalyticReady = true;
|
|
33
|
-
}
|
|
34
|
-
flushQueuedEvents();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function sendPingToParent() {
|
|
39
|
-
try {
|
|
40
|
-
const googleAnalyticId = typeof window.Zonos !== 'undefined'
|
|
41
|
-
? window.Zonos.googleAnalyticId
|
|
42
|
-
: undefined;
|
|
43
|
-
window.parent.postMessage({ googleAnalyticId, type: RELAY_PING_TYPE }, '*');
|
|
44
|
-
}
|
|
45
|
-
catch (_a) {
|
|
46
|
-
// Ignore postMessage failures
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
5
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
6
|
+
* Re-export of the shared relay ping helper. Kept here for backward compatibility with
|
|
7
|
+
* existing import paths (e.g. `zonos-controller`).
|
|
52
8
|
*/
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
ensureRelayListener();
|
|
60
|
-
sendPingToParent();
|
|
61
|
-
}
|
|
9
|
+
export const ensureAnalyticsRelayPing = ensureAnalyticsRelayPingShared;
|
|
10
|
+
const isGoogleAnalyticsEnabled = () => {
|
|
11
|
+
const provider = zonosStore.checkoutSettings.analyticsProviders.find(item => item.type === 'GOOGLE_ANALYTICS');
|
|
12
|
+
return !!provider && provider.status === 'ENABLED';
|
|
13
|
+
};
|
|
62
14
|
/**
|
|
63
15
|
* Submit a gtag event if the gtag function is available.
|
|
64
16
|
* When running inside an iframe, only posts to parent after the parent has
|
|
65
17
|
* confirmed (via analyticsRelayOnInit) that gtag is available.
|
|
66
18
|
*/
|
|
67
19
|
export const submitGtag = ({ event, metadata }) => {
|
|
68
|
-
|
|
69
|
-
// only submit if googleAnalytic in checkout setting is on.
|
|
70
|
-
if (!googleAnalyticSetting || (googleAnalyticSetting === null || googleAnalyticSetting === void 0 ? void 0 : googleAnalyticSetting.status) === 'DISABLED') {
|
|
20
|
+
if (!isGoogleAnalyticsEnabled()) {
|
|
71
21
|
return;
|
|
72
22
|
}
|
|
73
23
|
const isTestMode = getIsTestMode();
|
|
74
24
|
const payload = Object.assign(Object.assign({}, metadata), (isTestMode && { isTestMode: true }));
|
|
75
25
|
// filter null key
|
|
76
26
|
const filteredPayload = Object.fromEntries(Object.entries(payload).filter(([_, value]) => value !== null));
|
|
77
|
-
|
|
78
|
-
if (isInIframe) {
|
|
27
|
+
if (isAnalyticsRelayInIframe()) {
|
|
79
28
|
// gtag does not work in iframe; must relay to parent via postMessage
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
metadata: filteredPayload,
|
|
86
|
-
type: ZONOS_ANALYTIC_TYPE,
|
|
87
|
-
}, '*');
|
|
88
|
-
}
|
|
89
|
-
catch (_a) {
|
|
90
|
-
// Ignore postMessage failures
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
queuedEvents.push({ event, payload: filteredPayload });
|
|
95
|
-
sendPingToParent();
|
|
96
|
-
}
|
|
29
|
+
enqueueRelayEvent({
|
|
30
|
+
event,
|
|
31
|
+
payload: filteredPayload,
|
|
32
|
+
provider: 'gtag',
|
|
33
|
+
});
|
|
97
34
|
return;
|
|
98
35
|
}
|
|
99
36
|
// Not in iframe: call gtag directly
|
|
@@ -53,6 +53,8 @@ Zonos.releaseDate = process.env.NEXT_PUBLIC_RELEASE_DATE;
|
|
|
53
53
|
Zonos.isLegacyCheckout = false;
|
|
54
54
|
Zonos.googleAnalyticId = null;
|
|
55
55
|
Zonos.googleAnalyticReady = false;
|
|
56
|
+
Zonos.facebookPixelId = null;
|
|
57
|
+
Zonos.facebookPixelReady = false;
|
|
56
58
|
Zonos.startLoadTime = startLoadTime;
|
|
57
59
|
Zonos.domain = typeof window !== 'undefined'
|
|
58
60
|
? // domain that embeds the iframe
|
|
@@ -92,9 +94,10 @@ Zonos.init = async (params) => {
|
|
|
92
94
|
log(`====== ZONOS DEBUG MODE: on (${_a.version}) ======`);
|
|
93
95
|
_a.zonosApiKey = zonosApiKey;
|
|
94
96
|
_a.storeId = storeId;
|
|
95
|
-
// When not in iframe,
|
|
97
|
+
// When not in iframe, providers are ready (gtag/fbq work directly). When in iframe, relay sets these after parent configures.
|
|
96
98
|
if (typeof window !== 'undefined' && window.parent === window) {
|
|
97
99
|
_a.googleAnalyticReady = true;
|
|
100
|
+
_a.facebookPixelReady = true;
|
|
98
101
|
}
|
|
99
102
|
if (_a.isNpm) {
|
|
100
103
|
log('====== ZONOS LOADING FROM NPM ======');
|
|
@@ -200,7 +203,7 @@ Zonos.injectCustomScriptForHostedCheckout = () => {
|
|
|
200
203
|
const metadata = (cartData === null || cartData === void 0 ? void 0 : cartData.metadata) || [];
|
|
201
204
|
const headerScript = metadata.find(meta => meta.key === 'customHeaderScript');
|
|
202
205
|
const footerScript = metadata.find(meta => meta.key === 'customFooterScript');
|
|
203
|
-
// googleAnalyticId
|
|
206
|
+
// googleAnalyticId / facebookPixelId are set by customHTML in checkoutSettings (e.g. <script>window.Zonos.googleAnalyticId = "G-XXX"; window.Zonos.facebookPixelId = "1234567890";</script>), injected by zonos-controller
|
|
204
207
|
// Only inject the script if checkout is on Zonos hosted checkout and custom script is available
|
|
205
208
|
if (!window.Zonos.isLegacyCheckout || (!headerScript && !footerScript)) {
|
|
206
209
|
log('Skip injecting custom script for hosted checkout', 'info', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Message type for zonos-analytic events sent from iframe to parent. */
|
|
2
2
|
export const ZONOS_ANALYTIC_TYPE = 'zonos-analytic';
|
|
3
|
-
/** Ping sent by iframe to configure parent's analytics relay (e.g. GA) and get ready signal. */
|
|
3
|
+
/** Ping sent by iframe to configure parent's analytics relay (e.g. GA, FB Pixel) and get ready signal. */
|
|
4
4
|
export const RELAY_PING_TYPE = 'zonos-analytics-relay-ping';
|
|
5
|
-
/** Response from parent when analytics relay (e.g. gtag) is ready. */
|
|
5
|
+
/** Response from parent when an analytics relay (e.g. gtag, fbq) is ready. */
|
|
6
6
|
export const RELAY_READY_TYPE = 'zonos-analytics-relay-ready';
|
package/dist/esm/index.js
CHANGED
|
@@ -131,7 +131,7 @@ const getZonosQaUrl = () => {
|
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
134
|
-
const cdnUrl = "https://v1.3.
|
|
134
|
+
const cdnUrl = "https://v1.3.262.js.zonos.com";
|
|
135
135
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
136
136
|
if (!qaUrl &&
|
|
137
137
|
(cdnUrl.includes('test.') ||
|
|
@@ -379,10 +379,10 @@ const zonosLoadUrl = (() => {
|
|
|
379
379
|
return null;
|
|
380
380
|
})();
|
|
381
381
|
const startLoadTime = Date.now();
|
|
382
|
-
const ZONOS_URL = "https://v1.3.
|
|
383
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
384
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
385
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
382
|
+
const ZONOS_URL = "https://v1.3.262.js.zonos.com";
|
|
383
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.262";
|
|
384
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.262";
|
|
385
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.262";
|
|
386
386
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
387
387
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
388
388
|
class Zonos {
|
|
@@ -400,10 +400,12 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
400
400
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
401
401
|
: null;
|
|
402
402
|
Zonos.isBigCommerce = false;
|
|
403
|
-
Zonos.releaseDate = "
|
|
403
|
+
Zonos.releaseDate = "1777585626922";
|
|
404
404
|
Zonos.isLegacyCheckout = false;
|
|
405
405
|
Zonos.googleAnalyticId = null;
|
|
406
406
|
Zonos.googleAnalyticReady = false;
|
|
407
|
+
Zonos.facebookPixelId = null;
|
|
408
|
+
Zonos.facebookPixelReady = false;
|
|
407
409
|
Zonos.startLoadTime = startLoadTime;
|
|
408
410
|
Zonos.domain = typeof window !== 'undefined'
|
|
409
411
|
? // domain that embeds the iframe
|
|
@@ -423,7 +425,7 @@ Zonos.isNpm = true;
|
|
|
423
425
|
Zonos.zonosQaUrl = null;
|
|
424
426
|
Zonos.zonosQaUrlApi = null;
|
|
425
427
|
Zonos.trackEventLogs = [];
|
|
426
|
-
Zonos.version = `v${"1.3.
|
|
428
|
+
Zonos.version = `v${"1.3.262"}`;
|
|
427
429
|
Zonos.modeAlerted = false;
|
|
428
430
|
Zonos.cartData = null;
|
|
429
431
|
Zonos.paypal = null;
|
|
@@ -443,9 +445,10 @@ Zonos.init = async (params) => {
|
|
|
443
445
|
log(`====== ZONOS DEBUG MODE: on (${_a.version}) ======`);
|
|
444
446
|
_a.zonosApiKey = zonosApiKey;
|
|
445
447
|
_a.storeId = storeId;
|
|
446
|
-
// When not in iframe,
|
|
448
|
+
// When not in iframe, providers are ready (gtag/fbq work directly). When in iframe, relay sets these after parent configures.
|
|
447
449
|
if (typeof window !== 'undefined' && window.parent === window) {
|
|
448
450
|
_a.googleAnalyticReady = true;
|
|
451
|
+
_a.facebookPixelReady = true;
|
|
449
452
|
}
|
|
450
453
|
if (_a.isNpm) {
|
|
451
454
|
log('====== ZONOS LOADING FROM NPM ======');
|
|
@@ -551,7 +554,7 @@ Zonos.injectCustomScriptForHostedCheckout = () => {
|
|
|
551
554
|
const metadata = (cartData === null || cartData === void 0 ? void 0 : cartData.metadata) || [];
|
|
552
555
|
const headerScript = metadata.find(meta => meta.key === 'customHeaderScript');
|
|
553
556
|
const footerScript = metadata.find(meta => meta.key === 'customFooterScript');
|
|
554
|
-
// googleAnalyticId
|
|
557
|
+
// googleAnalyticId / facebookPixelId are set by customHTML in checkoutSettings (e.g. <script>window.Zonos.googleAnalyticId = "G-XXX"; window.Zonos.facebookPixelId = "1234567890";</script>), injected by zonos-controller
|
|
555
558
|
// Only inject the script if checkout is on Zonos hosted checkout and custom script is available
|
|
556
559
|
if (!window.Zonos.isLegacyCheckout || (!headerScript && !footerScript)) {
|
|
557
560
|
log('Skip injecting custom script for hosted checkout', 'info', {
|