@zonos/elements 1.4.2 → 1.5.0
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 +7 -7
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +66 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +20 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +10 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +7 -10
- package/dist/collection/components/utils/checkout/isHostedVsNativeTestAllowed.js +13 -0
- package/dist/collection/components/utils/checkout/itemCustomization.js +53 -0
- package/dist/collection/components/utils/checkout/parseItemCustomizations.js +6 -0
- package/dist/collection/types/checkout/itemCustomization.js +1 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/zonos-cart-items_12.entry.js +66 -3
- package/dist/esm/zonos-checkout.entry.js +20 -10
- package/dist/esm-es5/index.js +4 -4
- package/dist/esm-es5/zonos-cart-items_12.entry.js +23 -10
- package/dist/esm-es5/zonos-checkout.entry.js +6 -6
- 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/checkout/isHostedVsNativeTestAllowed.d.ts +11 -0
- package/dist/types/components/utils/checkout/itemCustomization.d.ts +23 -0
- package/dist/types/components/utils/checkout/parseItemCustomizations.d.ts +7 -0
- package/dist/types/types/checkout/itemCustomization.d.ts +4 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-30b3c9d3.entry.js +1 -0
- package/dist/zonos-elements/p-5873ab8e.entry.js +1 -0
- package/dist/zonos-elements/{p-be1237fc.system.entry.js → p-7f031592.system.entry.js} +55 -55
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-DCS8qcL6.system.js → p-CXxvn4GX.system.js} +4 -4
- package/dist/zonos-elements/{p-5016d71b.system.entry.js → p-d82fd8a9.system.entry.js} +68 -54
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/item-customization.d.ts +25 -0
- package/item-customization.js +52 -0
- package/package.json +7 -4
- package/dist/zonos-elements/p-0457f579.entry.js +0 -1
- package/dist/zonos-elements/p-34656e6c.entry.js +0 -1
package/dist/cjs/index.cjs.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.
|
|
134
|
+
const cdnUrl = "https://v1.5.0.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.') ||
|
|
@@ -420,10 +420,10 @@ const zonosLoadUrl = (() => {
|
|
|
420
420
|
return null;
|
|
421
421
|
})();
|
|
422
422
|
const startLoadTime = Date.now();
|
|
423
|
-
const ZONOS_URL = "https://v1.
|
|
424
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.
|
|
425
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.
|
|
426
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.
|
|
423
|
+
const ZONOS_URL = "https://v1.5.0.js.zonos.com";
|
|
424
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.0";
|
|
425
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.0";
|
|
426
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.0";
|
|
427
427
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
428
428
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
429
429
|
class Zonos {
|
|
@@ -441,7 +441,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
441
441
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
442
442
|
: null;
|
|
443
443
|
Zonos.isBigCommerce = false;
|
|
444
|
-
Zonos.releaseDate = "
|
|
444
|
+
Zonos.releaseDate = "1792773585238";
|
|
445
445
|
Zonos.isLegacyCheckout = false;
|
|
446
446
|
Zonos.googleAnalyticId = null;
|
|
447
447
|
Zonos.googleAnalyticReady = false;
|
|
@@ -466,7 +466,7 @@ Zonos.isNpm = true;
|
|
|
466
466
|
Zonos.zonosQaUrl = null;
|
|
467
467
|
Zonos.zonosQaUrlApi = null;
|
|
468
468
|
Zonos.trackEventLogs = [];
|
|
469
|
-
Zonos.version = `v${"1.
|
|
469
|
+
Zonos.version = `v${"1.5.0"}`;
|
|
470
470
|
Zonos.modeAlerted = false;
|
|
471
471
|
Zonos.cartData = null;
|
|
472
472
|
Zonos.paypal = null;
|
|
@@ -30,7 +30,67 @@ require('./debounce-Cd2emZPn.js');
|
|
|
30
30
|
require('./debounce-vY0QYT6o.js');
|
|
31
31
|
require('./ShortAddressCode-C5l520-F.js');
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Import-free so `scripts/buildItemCustomization.mjs` can emit one module.
|
|
35
|
+
* demo-app imports the generated `item-customization.js`, not this file.
|
|
36
|
+
*/
|
|
37
|
+
const ITEM_CUSTOMIZATION_ATTRIBUTE_KEY = 'itemCustomization';
|
|
38
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
39
|
+
/** Drops an empty name, a non-string value, and the unselected value "0". */
|
|
40
|
+
const readDisplayableItemCustomization = (value) => {
|
|
41
|
+
if (!isRecord(value)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const { name } = value;
|
|
45
|
+
if (typeof name !== 'string' || name === '') {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const choiceValue = value.value;
|
|
49
|
+
if (typeof choiceValue !== 'string' || choiceValue === '0') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
value: choiceValue,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const parseJson = (value) => {
|
|
58
|
+
try {
|
|
59
|
+
// The generated package entry cannot import the shared jsonParse helper.
|
|
60
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
61
|
+
return JSON.parse(value);
|
|
62
|
+
}
|
|
63
|
+
catch (_a) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
/** Selected customization entries, with the original object for extra ids. */
|
|
68
|
+
const readItemCustomizationEntries = (attributes) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const rawValue = (_a = attributes === null || attributes === void 0 ? void 0 : attributes.find(attribute => (attribute === null || attribute === void 0 ? void 0 : attribute.key) === ITEM_CUSTOMIZATION_ATTRIBUTE_KEY)) === null || _a === void 0 ? void 0 : _a.value;
|
|
71
|
+
if (!rawValue) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
const parsed = parseJson(rawValue);
|
|
75
|
+
if (!Array.isArray(parsed)) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
return parsed.flatMap(entry => {
|
|
79
|
+
const choice = readDisplayableItemCustomization(entry);
|
|
80
|
+
if (!choice || !isRecord(entry)) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return [{ choice, raw: entry }];
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Reads a cart row's `itemCustomization` attribute into display pairs.
|
|
89
|
+
* Unreadable data is an empty list.
|
|
90
|
+
*/
|
|
91
|
+
const parseItemCustomizations = (attributes) => readItemCustomizationEntries(attributes).map(entry => entry.choice);
|
|
92
|
+
|
|
93
|
+
const zonosCartItemsCss = () => `:host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--cart-table td{vertical-align:top}:host .zonos--cart-item-name{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:12px}:host .zonos--cart-item-name .zonos--cart-item-choices{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:4px;min-width:0}:host .zonos--cart-item-name .zonos--cart-item-choices zonos-text{overflow-wrap:break-word;white-space:normal}:host .zonos--cart-item-name .zonos--cart-item-quantity>*{display:inline-block}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host img{min-width:40px;margin-top:6px}`;
|
|
34
94
|
|
|
35
95
|
const ZonosCartItems = class {
|
|
36
96
|
constructor(hostRef) {
|
|
@@ -40,15 +100,18 @@ const ZonosCartItems = class {
|
|
|
40
100
|
render() {
|
|
41
101
|
const emptyItemImg = index.getAssetPath('./assets/empty-item.jpeg');
|
|
42
102
|
const nonRestrictedItems = cart.cartStore.items.filter(item => !item.isRestricted);
|
|
43
|
-
return (index.h(index.Host, { key: '
|
|
103
|
+
return (index.h(index.Host, { key: 'eeb10f76fbab43d256e6130fe2ab88a33c1598aa', class: "zonos--cart-items zonos--elements" }, index.h("table", { key: '61ae44a57c1386f5ca6afb17c388ae9fcf29d8a1', class: "zonos--cart-table" }, index.h("tbody", { key: '8471ae46186543cee754685e0182c4057d982967' }, nonRestrictedItems.map(item => {
|
|
44
104
|
const itemImg = item.imageUrl;
|
|
45
105
|
const cleanedItemNames = cleanHtmlMarkdown.cleanHtmlMarkdown(item.name);
|
|
106
|
+
const choices = parseItemCustomizations(item.attributes);
|
|
46
107
|
const amount = item.amount * item.quantity;
|
|
47
108
|
return (index.h("tr", { class: "zonos--cart-item" }, index.h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (index.h("img", { alt: item.name, onError: () => {
|
|
48
109
|
this.errorImages = [...this.errorImages, itemImg];
|
|
49
110
|
}, src: item.imageUrl, style: {
|
|
50
111
|
'min-width': '40px',
|
|
51
|
-
}, width: 40 })) : (index.h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("div", null, cleanedItemNames.map(name => (index.h("zonos-text", { type: "label" }, name)))),
|
|
112
|
+
}, width: 40 })) : (index.h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), index.h("td", { class: "zonos--column zonos--cart-item-name" }, index.h("div", null, cleanedItemNames.map(name => (index.h("zonos-text", { type: "label" }, name)))), choices.length > 0 && (index.h("div", { class: "zonos--cart-item-choices" }, choices.map(choice => (index.h("zonos-text", { textColor: "gray-600", type: "caption" }, choice.value === ''
|
|
113
|
+
? choice.name
|
|
114
|
+
: `${choice.name}: ${choice.value}`))))), index.h("zonos-text", { textColor: "gray-600", type: "caption" }, localization.translate('Quantity'), ": ", item.quantity)), index.h("td", { class: "zonos--column zonos--cart-item-price" }, index.h("zonos-text", { type: "semiBoldLabel", weight: 600 }, renderCheckoutCurrency.renderCheckoutCurrency({
|
|
52
115
|
amount,
|
|
53
116
|
isForeign: false,
|
|
54
117
|
})))));
|
|
@@ -675,6 +675,20 @@ const isDisabledCountry = (showLog = true) => {
|
|
|
675
675
|
return false;
|
|
676
676
|
};
|
|
677
677
|
|
|
678
|
+
/**
|
|
679
|
+
* BigCommerce checkout depends on storefront callbacks (clear cart, inventory).
|
|
680
|
+
* The hosted variant leaves the storefront, so the test does not apply there.
|
|
681
|
+
*/
|
|
682
|
+
const isHostedVsNativeTestAllowed = ({ createCartId, enabledTestKeys, isBigCommerce, }) => {
|
|
683
|
+
if (isBigCommerce) {
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
if (typeof createCartId !== 'function') {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
return enabledTestKeys.includes('hosted_vs_native');
|
|
690
|
+
};
|
|
691
|
+
|
|
678
692
|
const isShippableCountry = (showLog = true,
|
|
679
693
|
/**
|
|
680
694
|
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
@@ -1682,16 +1696,12 @@ const ZonosCheckout = class {
|
|
|
1682
1696
|
};
|
|
1683
1697
|
};
|
|
1684
1698
|
this.shouldAllowHostedVsNativeTest = () => {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
if (!hostedVsNativeTest) {
|
|
1692
|
-
return false;
|
|
1693
|
-
}
|
|
1694
|
-
return true;
|
|
1699
|
+
var _a;
|
|
1700
|
+
return isHostedVsNativeTestAllowed({
|
|
1701
|
+
createCartId: zonosStore.zonosStore.checkoutSettings.createCartId,
|
|
1702
|
+
enabledTestKeys: zonosStore.zonosStore.enabledVariantTestKeys,
|
|
1703
|
+
isBigCommerce: Boolean((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.isBigCommerce),
|
|
1704
|
+
});
|
|
1695
1705
|
};
|
|
1696
1706
|
// Register test hosted vs native if needed to get the variant selection for this test
|
|
1697
1707
|
this.registerTestHostedVsNative = async () => {
|
package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css
CHANGED
|
@@ -56,6 +56,16 @@
|
|
|
56
56
|
flex-direction: column;
|
|
57
57
|
gap: 12px;
|
|
58
58
|
}
|
|
59
|
+
:host .zonos--cart-item-name .zonos--cart-item-choices {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 4px;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
}
|
|
65
|
+
:host .zonos--cart-item-name .zonos--cart-item-choices zonos-text {
|
|
66
|
+
overflow-wrap: break-word;
|
|
67
|
+
white-space: normal;
|
|
68
|
+
}
|
|
59
69
|
:host .zonos--cart-item-name .zonos--cart-item-quantity > * {
|
|
60
70
|
display: inline-block;
|
|
61
71
|
}
|
package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getAssetPath, h, Host } from "@stencil/core";
|
|
2
2
|
import { cartStore } from "../../../store/checkout/cart";
|
|
3
3
|
import { translate } from "../../../store/translationStore";
|
|
4
|
+
import { parseItemCustomizations } from "../../../utils/checkout/parseItemCustomizations";
|
|
4
5
|
import { renderCheckoutCurrency } from "../../../utils/checkout/renderCheckoutCurrency";
|
|
5
6
|
import { cleanHtmlMarkdown } from "../../../utils/cleanHtmlMarkdown";
|
|
6
7
|
export class ZonosCartItems {
|
|
@@ -10,15 +11,18 @@ export class ZonosCartItems {
|
|
|
10
11
|
render() {
|
|
11
12
|
const emptyItemImg = getAssetPath('./assets/empty-item.jpeg');
|
|
12
13
|
const nonRestrictedItems = cartStore.items.filter(item => !item.isRestricted);
|
|
13
|
-
return (h(Host, { key: '
|
|
14
|
+
return (h(Host, { key: 'eeb10f76fbab43d256e6130fe2ab88a33c1598aa', class: "zonos--cart-items zonos--elements" }, h("table", { key: '61ae44a57c1386f5ca6afb17c388ae9fcf29d8a1', class: "zonos--cart-table" }, h("tbody", { key: '8471ae46186543cee754685e0182c4057d982967' }, nonRestrictedItems.map(item => {
|
|
14
15
|
const itemImg = item.imageUrl;
|
|
15
16
|
const cleanedItemNames = cleanHtmlMarkdown(item.name);
|
|
17
|
+
const choices = parseItemCustomizations(item.attributes);
|
|
16
18
|
const amount = item.amount * item.quantity;
|
|
17
19
|
return (h("tr", { class: "zonos--cart-item" }, h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (h("img", { alt: item.name, onError: () => {
|
|
18
20
|
this.errorImages = [...this.errorImages, itemImg];
|
|
19
21
|
}, src: item.imageUrl, style: {
|
|
20
22
|
'min-width': '40px',
|
|
21
|
-
}, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, cleanedItemNames.map(name => (h("zonos-text", { type: "label" }, name)))),
|
|
23
|
+
}, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, cleanedItemNames.map(name => (h("zonos-text", { type: "label" }, name)))), choices.length > 0 && (h("div", { class: "zonos--cart-item-choices" }, choices.map(choice => (h("zonos-text", { textColor: "gray-600", type: "caption" }, choice.value === ''
|
|
24
|
+
? choice.name
|
|
25
|
+
: `${choice.name}: ${choice.value}`))))), h("zonos-text", { textColor: "gray-600", type: "caption" }, translate('Quantity'), ": ", item.quantity)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel", weight: 600 }, renderCheckoutCurrency({
|
|
22
26
|
amount,
|
|
23
27
|
isForeign: false,
|
|
24
28
|
})))));
|
|
@@ -27,6 +27,7 @@ import { getIsStagingMode } from "../../utils/checkout/getIsStagingMode";
|
|
|
27
27
|
import { getIsTestMode } from "../../utils/checkout/getIsTestMode";
|
|
28
28
|
import { isCheckoutMobile } from "../../utils/checkout/isCheckoutMobile";
|
|
29
29
|
import { isDisabledCountry } from "../../utils/checkout/isDisabledCountry";
|
|
30
|
+
import { isHostedVsNativeTestAllowed } from "../../utils/checkout/isHostedVsNativeTestAllowed";
|
|
30
31
|
import { isShippableCountry } from "../../utils/checkout/isShippableCountry";
|
|
31
32
|
import { watchImmediateBigcommerceDomesticCheckoutRedirect } from "../../utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect";
|
|
32
33
|
import { classes } from "../../utils/classes";
|
|
@@ -296,16 +297,12 @@ export class ZonosCheckout {
|
|
|
296
297
|
};
|
|
297
298
|
};
|
|
298
299
|
this.shouldAllowHostedVsNativeTest = () => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (!hostedVsNativeTest) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
return true;
|
|
300
|
+
var _a;
|
|
301
|
+
return isHostedVsNativeTestAllowed({
|
|
302
|
+
createCartId: zonosStore.checkoutSettings.createCartId,
|
|
303
|
+
enabledTestKeys: zonosStore.enabledVariantTestKeys,
|
|
304
|
+
isBigCommerce: Boolean((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.isBigCommerce),
|
|
305
|
+
});
|
|
309
306
|
};
|
|
310
307
|
// Register test hosted vs native if needed to get the variant selection for this test
|
|
311
308
|
this.registerTestHostedVsNative = async () => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BigCommerce checkout depends on storefront callbacks (clear cart, inventory).
|
|
3
|
+
* The hosted variant leaves the storefront, so the test does not apply there.
|
|
4
|
+
*/
|
|
5
|
+
export const isHostedVsNativeTestAllowed = ({ createCartId, enabledTestKeys, isBigCommerce, }) => {
|
|
6
|
+
if (isBigCommerce) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (typeof createCartId !== 'function') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return enabledTestKeys.includes('hosted_vs_native');
|
|
13
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import-free so `scripts/buildItemCustomization.mjs` can emit one module.
|
|
3
|
+
* demo-app imports the generated `item-customization.js`, not this file.
|
|
4
|
+
*/
|
|
5
|
+
export const ITEM_CUSTOMIZATION_ATTRIBUTE_KEY = 'itemCustomization';
|
|
6
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
+
/** Drops an empty name, a non-string value, and the unselected value "0". */
|
|
8
|
+
export const readDisplayableItemCustomization = (value) => {
|
|
9
|
+
if (!isRecord(value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const { name } = value;
|
|
13
|
+
if (typeof name !== 'string' || name === '') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const choiceValue = value.value;
|
|
17
|
+
if (typeof choiceValue !== 'string' || choiceValue === '0') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
name,
|
|
22
|
+
value: choiceValue,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const parseJson = (value) => {
|
|
26
|
+
try {
|
|
27
|
+
// The generated package entry cannot import the shared jsonParse helper.
|
|
28
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
29
|
+
return JSON.parse(value);
|
|
30
|
+
}
|
|
31
|
+
catch (_a) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** Selected customization entries, with the original object for extra ids. */
|
|
36
|
+
export const readItemCustomizationEntries = (attributes) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const rawValue = (_a = attributes === null || attributes === void 0 ? void 0 : attributes.find(attribute => (attribute === null || attribute === void 0 ? void 0 : attribute.key) === ITEM_CUSTOMIZATION_ATTRIBUTE_KEY)) === null || _a === void 0 ? void 0 : _a.value;
|
|
39
|
+
if (!rawValue) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const parsed = parseJson(rawValue);
|
|
43
|
+
if (!Array.isArray(parsed)) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return parsed.flatMap(entry => {
|
|
47
|
+
const choice = readDisplayableItemCustomization(entry);
|
|
48
|
+
if (!choice || !isRecord(entry)) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return [{ choice, raw: entry }];
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { readItemCustomizationEntries, } from "./itemCustomization";
|
|
2
|
+
/**
|
|
3
|
+
* Reads a cart row's `itemCustomization` attribute into display pairs.
|
|
4
|
+
* Unreadable data is an empty list.
|
|
5
|
+
*/
|
|
6
|
+
export const parseItemCustomizations = (attributes) => readItemCustomizationEntries(attributes).map(entry => entry.choice);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,6 +14,7 @@ export * from './checkout/api/StoreDiscountEnabled';
|
|
|
14
14
|
export * from './checkout/api/ValidateAddress';
|
|
15
15
|
export * from './checkout/api/VarianceTest';
|
|
16
16
|
export * from './checkout/CheckoutConfig';
|
|
17
|
+
export * from './checkout/itemCustomization';
|
|
17
18
|
export * from './checkout/ShortAddressCode';
|
|
18
19
|
export * from './checkout/TaxId';
|
|
19
20
|
export * from './ConversionEvent';
|
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.
|
|
134
|
+
const cdnUrl = "https://v1.5.0.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.') ||
|
|
@@ -420,10 +420,10 @@ const zonosLoadUrl = (() => {
|
|
|
420
420
|
return null;
|
|
421
421
|
})();
|
|
422
422
|
const startLoadTime = Date.now();
|
|
423
|
-
const ZONOS_URL = "https://v1.
|
|
424
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.
|
|
425
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.
|
|
426
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.
|
|
423
|
+
const ZONOS_URL = "https://v1.5.0.js.zonos.com";
|
|
424
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.0";
|
|
425
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.0";
|
|
426
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.0";
|
|
427
427
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
428
428
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
429
429
|
class Zonos {
|
|
@@ -441,7 +441,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
441
441
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
442
442
|
: null;
|
|
443
443
|
Zonos.isBigCommerce = false;
|
|
444
|
-
Zonos.releaseDate = "
|
|
444
|
+
Zonos.releaseDate = "1792773585238";
|
|
445
445
|
Zonos.isLegacyCheckout = false;
|
|
446
446
|
Zonos.googleAnalyticId = null;
|
|
447
447
|
Zonos.googleAnalyticReady = false;
|
|
@@ -466,7 +466,7 @@ Zonos.isNpm = true;
|
|
|
466
466
|
Zonos.zonosQaUrl = null;
|
|
467
467
|
Zonos.zonosQaUrlApi = null;
|
|
468
468
|
Zonos.trackEventLogs = [];
|
|
469
|
-
Zonos.version = `v${"1.
|
|
469
|
+
Zonos.version = `v${"1.5.0"}`;
|
|
470
470
|
Zonos.modeAlerted = false;
|
|
471
471
|
Zonos.cartData = null;
|
|
472
472
|
Zonos.paypal = null;
|
|
@@ -28,7 +28,67 @@ import './debounce-CrmpwbEE.js';
|
|
|
28
28
|
import './debounce-BR3PaG8X.js';
|
|
29
29
|
import './ShortAddressCode-nJ6oI8-n.js';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Import-free so `scripts/buildItemCustomization.mjs` can emit one module.
|
|
33
|
+
* demo-app imports the generated `item-customization.js`, not this file.
|
|
34
|
+
*/
|
|
35
|
+
const ITEM_CUSTOMIZATION_ATTRIBUTE_KEY = 'itemCustomization';
|
|
36
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
37
|
+
/** Drops an empty name, a non-string value, and the unselected value "0". */
|
|
38
|
+
const readDisplayableItemCustomization = (value) => {
|
|
39
|
+
if (!isRecord(value)) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const { name } = value;
|
|
43
|
+
if (typeof name !== 'string' || name === '') {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const choiceValue = value.value;
|
|
47
|
+
if (typeof choiceValue !== 'string' || choiceValue === '0') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
name,
|
|
52
|
+
value: choiceValue,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const parseJson = (value) => {
|
|
56
|
+
try {
|
|
57
|
+
// The generated package entry cannot import the shared jsonParse helper.
|
|
58
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
59
|
+
return JSON.parse(value);
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/** Selected customization entries, with the original object for extra ids. */
|
|
66
|
+
const readItemCustomizationEntries = (attributes) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const rawValue = (_a = attributes === null || attributes === void 0 ? void 0 : attributes.find(attribute => (attribute === null || attribute === void 0 ? void 0 : attribute.key) === ITEM_CUSTOMIZATION_ATTRIBUTE_KEY)) === null || _a === void 0 ? void 0 : _a.value;
|
|
69
|
+
if (!rawValue) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
const parsed = parseJson(rawValue);
|
|
73
|
+
if (!Array.isArray(parsed)) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
return parsed.flatMap(entry => {
|
|
77
|
+
const choice = readDisplayableItemCustomization(entry);
|
|
78
|
+
if (!choice || !isRecord(entry)) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
return [{ choice, raw: entry }];
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Reads a cart row's `itemCustomization` attribute into display pairs.
|
|
87
|
+
* Unreadable data is an empty list.
|
|
88
|
+
*/
|
|
89
|
+
const parseItemCustomizations = (attributes) => readItemCustomizationEntries(attributes).map(entry => entry.choice);
|
|
90
|
+
|
|
91
|
+
const zonosCartItemsCss = () => `:host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--cart-table td{vertical-align:top}:host .zonos--cart-item-name{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:12px}:host .zonos--cart-item-name .zonos--cart-item-choices{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:4px;min-width:0}:host .zonos--cart-item-name .zonos--cart-item-choices zonos-text{overflow-wrap:break-word;white-space:normal}:host .zonos--cart-item-name .zonos--cart-item-quantity>*{display:inline-block}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host img{min-width:40px;margin-top:6px}`;
|
|
32
92
|
|
|
33
93
|
const ZonosCartItems = class {
|
|
34
94
|
constructor(hostRef) {
|
|
@@ -38,15 +98,18 @@ const ZonosCartItems = class {
|
|
|
38
98
|
render() {
|
|
39
99
|
const emptyItemImg = getAssetPath('./assets/empty-item.jpeg');
|
|
40
100
|
const nonRestrictedItems = cartStore.items.filter(item => !item.isRestricted);
|
|
41
|
-
return (h(Host, { key: '
|
|
101
|
+
return (h(Host, { key: 'eeb10f76fbab43d256e6130fe2ab88a33c1598aa', class: "zonos--cart-items zonos--elements" }, h("table", { key: '61ae44a57c1386f5ca6afb17c388ae9fcf29d8a1', class: "zonos--cart-table" }, h("tbody", { key: '8471ae46186543cee754685e0182c4057d982967' }, nonRestrictedItems.map(item => {
|
|
42
102
|
const itemImg = item.imageUrl;
|
|
43
103
|
const cleanedItemNames = cleanHtmlMarkdown(item.name);
|
|
104
|
+
const choices = parseItemCustomizations(item.attributes);
|
|
44
105
|
const amount = item.amount * item.quantity;
|
|
45
106
|
return (h("tr", { class: "zonos--cart-item" }, h("td", { class: "zonos--column zonos--cart-item-image" }, itemImg && !this.errorImages.includes(itemImg) ? (h("img", { alt: item.name, onError: () => {
|
|
46
107
|
this.errorImages = [...this.errorImages, itemImg];
|
|
47
108
|
}, src: item.imageUrl, style: {
|
|
48
109
|
'min-width': '40px',
|
|
49
|
-
}, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, cleanedItemNames.map(name => (h("zonos-text", { type: "label" }, name)))),
|
|
110
|
+
}, width: 40 })) : (h("img", { alt: item.name, src: emptyItemImg, width: 40 }))), h("td", { class: "zonos--column zonos--cart-item-name" }, h("div", null, cleanedItemNames.map(name => (h("zonos-text", { type: "label" }, name)))), choices.length > 0 && (h("div", { class: "zonos--cart-item-choices" }, choices.map(choice => (h("zonos-text", { textColor: "gray-600", type: "caption" }, choice.value === ''
|
|
111
|
+
? choice.name
|
|
112
|
+
: `${choice.name}: ${choice.value}`))))), h("zonos-text", { textColor: "gray-600", type: "caption" }, translate('Quantity'), ": ", item.quantity)), h("td", { class: "zonos--column zonos--cart-item-price" }, h("zonos-text", { type: "semiBoldLabel", weight: 600 }, renderCheckoutCurrency({
|
|
50
113
|
amount,
|
|
51
114
|
isForeign: false,
|
|
52
115
|
})))));
|
|
@@ -673,6 +673,20 @@ const isDisabledCountry = (showLog = true) => {
|
|
|
673
673
|
return false;
|
|
674
674
|
};
|
|
675
675
|
|
|
676
|
+
/**
|
|
677
|
+
* BigCommerce checkout depends on storefront callbacks (clear cart, inventory).
|
|
678
|
+
* The hosted variant leaves the storefront, so the test does not apply there.
|
|
679
|
+
*/
|
|
680
|
+
const isHostedVsNativeTestAllowed = ({ createCartId, enabledTestKeys, isBigCommerce, }) => {
|
|
681
|
+
if (isBigCommerce) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
if (typeof createCartId !== 'function') {
|
|
685
|
+
return false;
|
|
686
|
+
}
|
|
687
|
+
return enabledTestKeys.includes('hosted_vs_native');
|
|
688
|
+
};
|
|
689
|
+
|
|
676
690
|
const isShippableCountry = (showLog = true,
|
|
677
691
|
/**
|
|
678
692
|
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
@@ -1680,16 +1694,12 @@ const ZonosCheckout = class {
|
|
|
1680
1694
|
};
|
|
1681
1695
|
};
|
|
1682
1696
|
this.shouldAllowHostedVsNativeTest = () => {
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
if (!hostedVsNativeTest) {
|
|
1690
|
-
return false;
|
|
1691
|
-
}
|
|
1692
|
-
return true;
|
|
1697
|
+
var _a;
|
|
1698
|
+
return isHostedVsNativeTestAllowed({
|
|
1699
|
+
createCartId: zonosStore.checkoutSettings.createCartId,
|
|
1700
|
+
enabledTestKeys: zonosStore.enabledVariantTestKeys,
|
|
1701
|
+
isBigCommerce: Boolean((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.isBigCommerce),
|
|
1702
|
+
});
|
|
1693
1703
|
};
|
|
1694
1704
|
// Register test hosted vs native if needed to get the variant selection for this test
|
|
1695
1705
|
this.registerTestHostedVsNative = async () => {
|
package/dist/esm-es5/index.js
CHANGED
|
@@ -54,7 +54,7 @@ var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t
|
|
|
54
54
|
* When developing, if the script load is from `dev.elements.zonos.com`,
|
|
55
55
|
* it would load script from that same domain instead of loading from cdn
|
|
56
56
|
*/
|
|
57
|
-
var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.
|
|
57
|
+
var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.5.0.js.zonos.com";
|
|
58
58
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
59
59
|
if(!n&&(o.includes("test.")||
|
|
60
60
|
// Vercel git domain
|
|
@@ -99,15 +99,15 @@ return[4/*yield*/,new Promise((function(e){return setTimeout(e,500)}))];case 2:
|
|
|
99
99
|
e.sent();return[2/*return*/,getCartInfoById({cartId:l,retries:d-1})];case 3:if(c){return[2/*return*/,null]}return[2/*return*/,Object.assign(Object.assign({},s),{zonosMode:u})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2/*return*/,null]}return[4/*yield*/,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2/*return*/,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2/*return*/,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;
|
|
100
100
|
/**
|
|
101
101
|
* Get the load version and url based on the loadScriptSrc, if the domain that used to load `zonos.js` is in white listed domains, use currentLoadScriptUrl as the load url instead, if zonosQaUrl exists, it would also fall under the white listed domain
|
|
102
|
-
*/var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.
|
|
102
|
+
*/var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.5.0.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.0";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.5.0";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.0";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=/** @class */function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;
|
|
103
103
|
// if query 'zonosDebug=1' param from url, debug mode is on
|
|
104
|
-
Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="
|
|
104
|
+
Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1792773585238";Zonos.isLegacyCheckout=false;Zonos.googleAnalyticId=null;Zonos.googleAnalyticReady=false;Zonos.facebookPixelId=null;Zonos.facebookPixelReady=false;Zonos.startLoadTime=startLoadTime;Zonos.domain=typeof window!=="undefined"?// domain that embeds the iframe
|
|
105
105
|
window.location!=window.parent.location&&document.referrer||
|
|
106
106
|
// current domain
|
|
107
107
|
document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isInvoice=false;
|
|
108
108
|
/**
|
|
109
109
|
* By default, the package will load from npm
|
|
110
|
-
*/Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.
|
|
110
|
+
*/Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.5.0");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,u,c,l,d,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,u=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();
|
|
111
111
|
// Expose the checkout cart callbacks on the global so Stripe loading can be
|
|
112
112
|
// gated on whether at least one of them is configured.
|
|
113
113
|
_a.createCartId=o===null||o===void 0?void 0:o.createCartId;
|