@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.
- package/dist/cjs/index.cjs.js +12 -9
- package/dist/cjs/{paypal-73a542cb.js → paypal-e278f405.js} +140 -6
- package/dist/cjs/submitGtag-4241212b.js +167 -0
- package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +30 -21
- package/dist/cjs/zonos-checkout.cjs.entry.js +7 -7
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +8 -8
- package/dist/cjs/zonos-collect.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +8 -8
- package/dist/cjs/zonos-invoice.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +12 -12
- 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 +6 -6
- 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-finish/zonos-collect-finish.js +6 -6
- package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.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-payment/zonos-invoice-payment.js +2 -2
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/store/checkout/paypal.js +4 -4
- 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/{paypal-38ca5d21.js → paypal-d8804da5.js} +142 -9
- package/dist/esm/submitGtag-7f5c5bb5.js +162 -0
- package/dist/esm/zonos-card_5.entry.js +2 -2
- package/dist/esm/zonos-cart-items_12.entry.js +30 -21
- package/dist/esm/zonos-checkout.entry.js +7 -7
- package/dist/esm/zonos-collect-finish_6.entry.js +8 -8
- package/dist/esm/zonos-collect.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +3 -3
- package/dist/esm/zonos-invoice-finish_5.entry.js +8 -8
- package/dist/esm/zonos-invoice.entry.js +2 -2
- package/dist/esm-es5/index.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-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.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-controller.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/scripts/analyticsRelayOnInit.js +1 -1
- package/dist/scripts/index.d.ts +11 -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/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/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-022ddd4a.system.entry.js +1 -0
- package/dist/zonos-elements/{p-6726fee0.entry.js → p-06ef4d79.entry.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-e684e68f.entry.js → p-3deb91cb.entry.js} +1 -1
- package/dist/zonos-elements/{p-eca03303.system.entry.js → p-56c11359.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-e14f421d.system.entry.js → p-7237f43b.system.entry.js} +1 -1
- 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-3c3139d2.system.entry.js → p-7df3e44b.system.entry.js} +1 -1
- package/dist/zonos-elements/p-838e335c.entry.js +1 -0
- package/dist/zonos-elements/p-947f5092.js +17 -0
- package/dist/zonos-elements/{p-1917202e.system.entry.js → p-9de27162.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-be1032ab.system.entry.js → p-a2b3c1ef.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a98b8b68.system.js +18 -0
- 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-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-7793d334.entry.js → p-f2909fb8.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-03e53ef5.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-31bd3851.system.js +0 -1
- package/dist/zonos-elements/p-387f6a4d.js +0 -1
- package/dist/zonos-elements/p-47bde0ba.system.js +0 -18
- package/dist/zonos-elements/p-5dff9d51.system.entry.js +0 -1
- package/dist/zonos-elements/p-9cfd1dc3.entry.js +0 -1
- package/dist/zonos-elements/p-eeff2b04.entry.js +0 -1
- 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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
469
|
+
submitAnalytics({
|
|
470
470
|
event: 'zonos-checkout-success',
|
|
471
471
|
metadata: this.buildPurchaseMetadata({
|
|
472
472
|
checkoutSessionId: storageStore.checkoutSessionId || '',
|
|
473
473
|
}),
|
|
474
474
|
});
|
|
475
|
-
|
|
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
|
-
|
|
506
|
+
submitAnalytics({
|
|
507
507
|
event: 'zonos-checkout-success',
|
|
508
508
|
metadata: this.buildPurchaseMetadata({
|
|
509
509
|
checkoutSessionId: checkoutSessionId || '',
|
|
510
510
|
}),
|
|
511
511
|
});
|
|
512
|
-
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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'
|
|
@@ -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 {
|
|
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
|
-
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1426
|
+
submitAnalytics({
|
|
1427
1427
|
event: 'zonos-checkout-payment-fail',
|
|
1428
1428
|
metadata: {
|
|
1429
1429
|
checkoutSessionId: storageStore.checkoutSessionId,
|
|
@@ -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:
|
|
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
|
|
@@ -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 {
|
|
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
|
-
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: '
|
|
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: '
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: '
|
|
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: '
|
|
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 {
|
|
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
|
-
|
|
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: '
|
|
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 {
|
|
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,
|
|
@@ -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;
|