@zonos/elements 1.3.213 → 1.3.214
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-checkout.cjs.entry.js +4 -0
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +14 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +14 -4
- package/dist/esm/index.js +7 -7
- package/dist/esm/zonos-checkout.entry.js +4 -0
- package/dist/esm/zonos-hello-dialog.entry.js +15 -5
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-41ec9531.entry.js +1 -0
- package/dist/zonos-elements/{p-6e5236eb.system.entry.js → p-6c69c5fa.system.entry.js} +1 -1
- package/dist/zonos-elements/p-81b357f7.system.js +1 -1
- package/dist/zonos-elements/p-8d37bb03.entry.js +1 -0
- package/dist/zonos-elements/{p-7567bb2f.system.js → p-a9b63cdb.system.js} +1 -1
- package/dist/zonos-elements/{p-a9ad60a5.system.entry.js → p-ac784ab8.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-a4efb55c.entry.js +0 -1
- package/dist/zonos-elements/p-ec7a6d28.entry.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -132,7 +132,7 @@ const getZonosQaUrl = () => {
|
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
134
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
135
|
-
const cdnUrl = "https://v1.3.
|
|
135
|
+
const cdnUrl = "https://v1.3.214.js.zonos.com";
|
|
136
136
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
137
137
|
if (!qaUrl &&
|
|
138
138
|
(cdnUrl.includes('test.') ||
|
|
@@ -375,10 +375,10 @@ const zonosLoadUrl = (() => {
|
|
|
375
375
|
}
|
|
376
376
|
return null;
|
|
377
377
|
})();
|
|
378
|
-
const ZONOS_URL = "https://v1.3.
|
|
379
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
380
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
381
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
378
|
+
const ZONOS_URL = "https://v1.3.214.js.zonos.com";
|
|
379
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.214";
|
|
380
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.214";
|
|
381
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.214";
|
|
382
382
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
383
383
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
384
384
|
class Zonos {
|
|
@@ -396,7 +396,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
396
396
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
397
397
|
: null;
|
|
398
398
|
Zonos.isBigCommerce = false;
|
|
399
|
-
Zonos.releaseDate = "
|
|
399
|
+
Zonos.releaseDate = "1749479724498";
|
|
400
400
|
Zonos.isLegacyCheckout = false;
|
|
401
401
|
Zonos.domain = typeof window !== 'undefined'
|
|
402
402
|
? // domain that embeds the iframe
|
|
@@ -414,7 +414,7 @@ Zonos.isNpm = true;
|
|
|
414
414
|
Zonos.zonosQaUrl = null;
|
|
415
415
|
Zonos.zonosQaUrlApi = null;
|
|
416
416
|
Zonos.trackEventLogs = [];
|
|
417
|
-
Zonos.version = `v${"1.3.
|
|
417
|
+
Zonos.version = `v${"1.3.214"}`;
|
|
418
418
|
Zonos.modeAlerted = false;
|
|
419
419
|
Zonos.cartData = null;
|
|
420
420
|
Zonos.paypal = null;
|
|
@@ -1299,6 +1299,8 @@ const ZonosCheckout = class {
|
|
|
1299
1299
|
const customerAddress1 = getParam('customerAddress1');
|
|
1300
1300
|
const customerAddress2 = getParam('customerAddress2');
|
|
1301
1301
|
const customerName = getParam('customerName');
|
|
1302
|
+
const customerFirstName = getParam('customerFirstName');
|
|
1303
|
+
const customerLastName = getParam('customerLastName');
|
|
1302
1304
|
const customerPhone = getParam('customerPhone');
|
|
1303
1305
|
const customerZip = getParam('customerZip');
|
|
1304
1306
|
const customerState = getParam('customerState');
|
|
@@ -1308,6 +1310,8 @@ const ZonosCheckout = class {
|
|
|
1308
1310
|
customerCity,
|
|
1309
1311
|
customerCountry,
|
|
1310
1312
|
customerEmail,
|
|
1313
|
+
customerFirstName,
|
|
1314
|
+
customerLastName,
|
|
1311
1315
|
customerName,
|
|
1312
1316
|
customerPhone,
|
|
1313
1317
|
customerState,
|
|
@@ -135,6 +135,11 @@ const ZonosHelloDialog = class {
|
|
|
135
135
|
};
|
|
136
136
|
this.getDutyMessage = () => {
|
|
137
137
|
const countryLandedCost = localization.localizationStore.countryLandedCost;
|
|
138
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that duties will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
139
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
140
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
141
|
+
return localization.translate('Duties will apply to all orders.');
|
|
142
|
+
}
|
|
138
143
|
// Our Robby API spells deminimis wrong here
|
|
139
144
|
const dutyDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.dutyDeminimus)
|
|
140
145
|
? localization.currencyFormat({ amount: countryLandedCost.dutyDeminimus })
|
|
@@ -148,6 +153,11 @@ const ZonosHelloDialog = class {
|
|
|
148
153
|
};
|
|
149
154
|
this.getTaxMessage = () => {
|
|
150
155
|
const { countryLandedCost } = localization.localizationStore;
|
|
156
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that taxes will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
157
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
158
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
159
|
+
return localization.translate('Taxes will apply to all orders.');
|
|
160
|
+
}
|
|
151
161
|
// Our Robby API spells deminimis wrong here
|
|
152
162
|
const taxDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.vatTaxDeminimus)
|
|
153
163
|
? localization.currencyFormat({ amount: countryLandedCost.vatTaxDeminimus })
|
|
@@ -337,18 +347,18 @@ const ZonosHelloDialog = class {
|
|
|
337
347
|
const defaultMessage = formatStringWithLinks.formatStringWithLinks(defaultMessageStr);
|
|
338
348
|
const currentPage = this.getCurrentPageEnum();
|
|
339
349
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
340
|
-
return (index.h(index.Host, { key: '
|
|
350
|
+
return (index.h(index.Host, { key: '048945538b24e429425ba47f0964a2c16a8c2d3d', class: "zonos--elements" }, index.h("div", { key: '539cb35da5f85ec64a166757eb09389262232d3e', class: classes.classes([
|
|
341
351
|
'zonos--hello-dialog',
|
|
342
352
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
343
353
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
344
354
|
!!this.mobileLocationOverride &&
|
|
345
355
|
'zonos--hello-dialog-mobile-override',
|
|
346
356
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
347
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: '
|
|
357
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: 'ef1ad9355d3244d96971217311f1c674adeb6ee3' }, index.h("div", { key: '463e7752c0a1c11c6c86bf0dd8031b81511c0c14', class: "zonos--hello-dialog-content" }, index.h("zonos-button", { key: '89c1ae9d62c5b6c21472597c1afc5733a1cb8512', class: "zonos--close-button", icon: index.h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), index.h("zonos-v-stack", { key: '2657decc4b955f00eeb360018791e18a7a4ac70a', spacing: 24 }, index.h("zonos-country-flag", { key: '57e9c4bdfc7a14e0268097a5c0c79ef508011347', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), index.h("zonos-v-stack", { key: 'cda79b1e8487d72ed6ca33e2298731953ad9620e', class: "zonos--hello-dialog-header", spacing: 4 }, index.h("zonos-text", { key: '17d98d8f62d953c2b41ee46678ae4bea26b09ca5', type: "boldSubheader" }, welcomeMessage), index.h("zonos-text", { key: '856cebfb2d0d34a52d23f3eb8ccc7a64ef16e822', innerHTML: defaultMessage, textColor: "gray-800" })), index.h("zonos-v-stack", { key: '905f5e46a8eba8d9ff69af0ee5f51dadd168878e', spacing: 8 }, this.restrictedItems.map(item => {
|
|
348
358
|
var _a;
|
|
349
359
|
return item && (index.h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (index.h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
350
|
-
}), index.h("zonos-card", { key: '
|
|
351
|
-
additionalInformation.map(info => (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), index.h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), index.h("zonos-hello-dialog-footer", { key: '
|
|
360
|
+
}), index.h("zonos-card", { key: '600e71f5ccd6f2f86d5fe00833f480b5059fa145', spacing: "12px" }, index.h("zonos-v-stack", { key: '75cc0236d7f59ef08e7700ef326c079b2eb273a2', spacing: 12 }, hasInclusivePrices ? (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), index.h("zonos-text", null, inclusivePriceMessage))) : (index.h(index.Fragment, null, dutyDeMinimisMessage && (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Duty de minimis icon", content: ImportIcon }), index.h("zonos-text", { "aria-label": "Duty de minimis message" }, dutyDeMinimisMessage))), taxDeMinimisMessage && (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Tax de minimis icon", content: MoneyIcon }), index.h("zonos-text", { "aria-label": "Tax de minimis message" }, taxDeMinimisMessage))))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
361
|
+
additionalInformation.map(info => (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), index.h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), index.h("zonos-hello-dialog-footer", { key: '70c60065a548ab2e178df64062991b8160d62f55', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (index.h("div", { key: '14da13080459253ab355f60f67216f99741b69a2' }, index.h("zonos-country-select", { key: 'e18e90eb0e68450ceb833aa999f24108fd154eb8', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (index.h("div", { key: '56255cb5629ee7600378d13ee700adf1d3c73f51' }, index.h("zonos-language-select", { key: '3d74f4c28c067ea9f94da2d3274abf4d750bcab7', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
352
362
|
}
|
|
353
363
|
static get assetsDirs() { return ["assets"]; }
|
|
354
364
|
static get watchers() { return {
|
|
@@ -898,6 +898,8 @@ export class ZonosCheckout {
|
|
|
898
898
|
const customerAddress1 = getParam('customerAddress1');
|
|
899
899
|
const customerAddress2 = getParam('customerAddress2');
|
|
900
900
|
const customerName = getParam('customerName');
|
|
901
|
+
const customerFirstName = getParam('customerFirstName');
|
|
902
|
+
const customerLastName = getParam('customerLastName');
|
|
901
903
|
const customerPhone = getParam('customerPhone');
|
|
902
904
|
const customerZip = getParam('customerZip');
|
|
903
905
|
const customerState = getParam('customerState');
|
|
@@ -907,6 +909,8 @@ export class ZonosCheckout {
|
|
|
907
909
|
customerCity,
|
|
908
910
|
customerCountry,
|
|
909
911
|
customerEmail,
|
|
912
|
+
customerFirstName,
|
|
913
|
+
customerLastName,
|
|
910
914
|
customerName,
|
|
911
915
|
customerPhone,
|
|
912
916
|
customerState,
|
|
@@ -96,6 +96,11 @@ export class ZonosHelloDialog {
|
|
|
96
96
|
};
|
|
97
97
|
this.getDutyMessage = () => {
|
|
98
98
|
const countryLandedCost = localizationStore.countryLandedCost;
|
|
99
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that duties will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
100
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
101
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
102
|
+
return translate('Duties will apply to all orders.');
|
|
103
|
+
}
|
|
99
104
|
// Our Robby API spells deminimis wrong here
|
|
100
105
|
const dutyDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.dutyDeminimus)
|
|
101
106
|
? currencyFormat({ amount: countryLandedCost.dutyDeminimus })
|
|
@@ -109,6 +114,11 @@ export class ZonosHelloDialog {
|
|
|
109
114
|
};
|
|
110
115
|
this.getTaxMessage = () => {
|
|
111
116
|
const { countryLandedCost } = localizationStore;
|
|
117
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that taxes will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
118
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
119
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
120
|
+
return translate('Taxes will apply to all orders.');
|
|
121
|
+
}
|
|
112
122
|
// Our Robby API spells deminimis wrong here
|
|
113
123
|
const taxDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.vatTaxDeminimus)
|
|
114
124
|
? currencyFormat({ amount: countryLandedCost.vatTaxDeminimus })
|
|
@@ -298,18 +308,18 @@ export class ZonosHelloDialog {
|
|
|
298
308
|
const defaultMessage = formatStringWithLinks(defaultMessageStr);
|
|
299
309
|
const currentPage = this.getCurrentPageEnum();
|
|
300
310
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
301
|
-
return (h(Host, { key: '
|
|
311
|
+
return (h(Host, { key: '048945538b24e429425ba47f0964a2c16a8c2d3d', class: "zonos--elements" }, h("div", { key: '539cb35da5f85ec64a166757eb09389262232d3e', class: classes([
|
|
302
312
|
'zonos--hello-dialog',
|
|
303
313
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
304
314
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
305
315
|
!!this.mobileLocationOverride &&
|
|
306
316
|
'zonos--hello-dialog-mobile-override',
|
|
307
317
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
308
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '
|
|
318
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'ef1ad9355d3244d96971217311f1c674adeb6ee3' }, h("div", { key: '463e7752c0a1c11c6c86bf0dd8031b81511c0c14', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '89c1ae9d62c5b6c21472597c1afc5733a1cb8512', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '2657decc4b955f00eeb360018791e18a7a4ac70a', spacing: 24 }, h("zonos-country-flag", { key: '57e9c4bdfc7a14e0268097a5c0c79ef508011347', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: 'cda79b1e8487d72ed6ca33e2298731953ad9620e', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '17d98d8f62d953c2b41ee46678ae4bea26b09ca5', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '856cebfb2d0d34a52d23f3eb8ccc7a64ef16e822', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '905f5e46a8eba8d9ff69af0ee5f51dadd168878e', spacing: 8 }, this.restrictedItems.map(item => {
|
|
309
319
|
var _a;
|
|
310
320
|
return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
311
|
-
}), h("zonos-card", { key: '
|
|
312
|
-
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '
|
|
321
|
+
}), h("zonos-card", { key: '600e71f5ccd6f2f86d5fe00833f480b5059fa145', spacing: "12px" }, h("zonos-v-stack", { key: '75cc0236d7f59ef08e7700ef326c079b2eb273a2', spacing: 12 }, hasInclusivePrices ? (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), h("zonos-text", null, inclusivePriceMessage))) : (h(Fragment, null, dutyDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis icon", content: ImportIcon }), h("zonos-text", { "aria-label": "Duty de minimis message" }, dutyDeMinimisMessage))), taxDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Tax de minimis icon", content: MoneyIcon }), h("zonos-text", { "aria-label": "Tax de minimis message" }, taxDeMinimisMessage))))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
322
|
+
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '70c60065a548ab2e178df64062991b8160d62f55', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '14da13080459253ab355f60f67216f99741b69a2' }, h("zonos-country-select", { key: 'e18e90eb0e68450ceb833aa999f24108fd154eb8', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '56255cb5629ee7600378d13ee700adf1d3c73f51' }, h("zonos-language-select", { key: '3d74f4c28c067ea9f94da2d3274abf4d750bcab7', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
313
323
|
}
|
|
314
324
|
static get is() { return "zonos-hello-dialog"; }
|
|
315
325
|
static get encapsulation() { return "shadow"; }
|
package/dist/esm/index.js
CHANGED
|
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
|
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
131
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
132
|
-
const cdnUrl = "https://v1.3.
|
|
132
|
+
const cdnUrl = "https://v1.3.214.js.zonos.com";
|
|
133
133
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
134
134
|
if (!qaUrl &&
|
|
135
135
|
(cdnUrl.includes('test.') ||
|
|
@@ -372,10 +372,10 @@ const zonosLoadUrl = (() => {
|
|
|
372
372
|
}
|
|
373
373
|
return null;
|
|
374
374
|
})();
|
|
375
|
-
const ZONOS_URL = "https://v1.3.
|
|
376
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
377
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
378
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
375
|
+
const ZONOS_URL = "https://v1.3.214.js.zonos.com";
|
|
376
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.214";
|
|
377
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.214";
|
|
378
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.214";
|
|
379
379
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
380
380
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
381
381
|
class Zonos {
|
|
@@ -393,7 +393,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
393
393
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
394
394
|
: null;
|
|
395
395
|
Zonos.isBigCommerce = false;
|
|
396
|
-
Zonos.releaseDate = "
|
|
396
|
+
Zonos.releaseDate = "1749479724498";
|
|
397
397
|
Zonos.isLegacyCheckout = false;
|
|
398
398
|
Zonos.domain = typeof window !== 'undefined'
|
|
399
399
|
? // domain that embeds the iframe
|
|
@@ -411,7 +411,7 @@ Zonos.isNpm = true;
|
|
|
411
411
|
Zonos.zonosQaUrl = null;
|
|
412
412
|
Zonos.zonosQaUrlApi = null;
|
|
413
413
|
Zonos.trackEventLogs = [];
|
|
414
|
-
Zonos.version = `v${"1.3.
|
|
414
|
+
Zonos.version = `v${"1.3.214"}`;
|
|
415
415
|
Zonos.modeAlerted = false;
|
|
416
416
|
Zonos.cartData = null;
|
|
417
417
|
Zonos.paypal = null;
|
|
@@ -1295,6 +1295,8 @@ const ZonosCheckout = class {
|
|
|
1295
1295
|
const customerAddress1 = getParam('customerAddress1');
|
|
1296
1296
|
const customerAddress2 = getParam('customerAddress2');
|
|
1297
1297
|
const customerName = getParam('customerName');
|
|
1298
|
+
const customerFirstName = getParam('customerFirstName');
|
|
1299
|
+
const customerLastName = getParam('customerLastName');
|
|
1298
1300
|
const customerPhone = getParam('customerPhone');
|
|
1299
1301
|
const customerZip = getParam('customerZip');
|
|
1300
1302
|
const customerState = getParam('customerState');
|
|
@@ -1304,6 +1306,8 @@ const ZonosCheckout = class {
|
|
|
1304
1306
|
customerCity,
|
|
1305
1307
|
customerCountry,
|
|
1306
1308
|
customerEmail,
|
|
1309
|
+
customerFirstName,
|
|
1310
|
+
customerLastName,
|
|
1307
1311
|
customerName,
|
|
1308
1312
|
customerPhone,
|
|
1309
1313
|
customerState,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-55a03023.js';
|
|
2
|
-
import { l as localizationStore,
|
|
2
|
+
import { l as localizationStore, t as translate, d as currencyFormat } from './localization-cf31c728.js';
|
|
3
3
|
import { z as zonosStore } from './zonosStore-c456b933.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
|
|
@@ -131,6 +131,11 @@ const ZonosHelloDialog = class {
|
|
|
131
131
|
};
|
|
132
132
|
this.getDutyMessage = () => {
|
|
133
133
|
const countryLandedCost = localizationStore.countryLandedCost;
|
|
134
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that duties will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
135
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
136
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
137
|
+
return translate('Duties will apply to all orders.');
|
|
138
|
+
}
|
|
134
139
|
// Our Robby API spells deminimis wrong here
|
|
135
140
|
const dutyDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.dutyDeminimus)
|
|
136
141
|
? currencyFormat({ amount: countryLandedCost.dutyDeminimus })
|
|
@@ -144,6 +149,11 @@ const ZonosHelloDialog = class {
|
|
|
144
149
|
};
|
|
145
150
|
this.getTaxMessage = () => {
|
|
146
151
|
const { countryLandedCost } = localizationStore;
|
|
152
|
+
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that taxes will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
153
|
+
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
154
|
+
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
155
|
+
return translate('Taxes will apply to all orders.');
|
|
156
|
+
}
|
|
147
157
|
// Our Robby API spells deminimis wrong here
|
|
148
158
|
const taxDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.vatTaxDeminimus)
|
|
149
159
|
? currencyFormat({ amount: countryLandedCost.vatTaxDeminimus })
|
|
@@ -333,18 +343,18 @@ const ZonosHelloDialog = class {
|
|
|
333
343
|
const defaultMessage = formatStringWithLinks(defaultMessageStr);
|
|
334
344
|
const currentPage = this.getCurrentPageEnum();
|
|
335
345
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
336
|
-
return (h(Host, { key: '
|
|
346
|
+
return (h(Host, { key: '048945538b24e429425ba47f0964a2c16a8c2d3d', class: "zonos--elements" }, h("div", { key: '539cb35da5f85ec64a166757eb09389262232d3e', class: classes([
|
|
337
347
|
'zonos--hello-dialog',
|
|
338
348
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
339
349
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
340
350
|
!!this.mobileLocationOverride &&
|
|
341
351
|
'zonos--hello-dialog-mobile-override',
|
|
342
352
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
343
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '
|
|
353
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'ef1ad9355d3244d96971217311f1c674adeb6ee3' }, h("div", { key: '463e7752c0a1c11c6c86bf0dd8031b81511c0c14', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '89c1ae9d62c5b6c21472597c1afc5733a1cb8512', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '2657decc4b955f00eeb360018791e18a7a4ac70a', spacing: 24 }, h("zonos-country-flag", { key: '57e9c4bdfc7a14e0268097a5c0c79ef508011347', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: 'cda79b1e8487d72ed6ca33e2298731953ad9620e', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '17d98d8f62d953c2b41ee46678ae4bea26b09ca5', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '856cebfb2d0d34a52d23f3eb8ccc7a64ef16e822', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '905f5e46a8eba8d9ff69af0ee5f51dadd168878e', spacing: 8 }, this.restrictedItems.map(item => {
|
|
344
354
|
var _a;
|
|
345
355
|
return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
346
|
-
}), h("zonos-card", { key: '
|
|
347
|
-
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '
|
|
356
|
+
}), h("zonos-card", { key: '600e71f5ccd6f2f86d5fe00833f480b5059fa145', spacing: "12px" }, h("zonos-v-stack", { key: '75cc0236d7f59ef08e7700ef326c079b2eb273a2', spacing: 12 }, hasInclusivePrices ? (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), h("zonos-text", null, inclusivePriceMessage))) : (h(Fragment, null, dutyDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis icon", content: ImportIcon }), h("zonos-text", { "aria-label": "Duty de minimis message" }, dutyDeMinimisMessage))), taxDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Tax de minimis icon", content: MoneyIcon }), h("zonos-text", { "aria-label": "Tax de minimis message" }, taxDeMinimisMessage))))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
357
|
+
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '70c60065a548ab2e178df64062991b8160d62f55', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '14da13080459253ab355f60f67216f99741b69a2' }, h("zonos-country-select", { key: 'e18e90eb0e68450ceb833aa999f24108fd154eb8', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '56255cb5629ee7600378d13ee700adf1d3c73f51' }, h("zonos-language-select", { key: '3d74f4c28c067ea9f94da2d3274abf4d750bcab7', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
348
358
|
}
|
|
349
359
|
static get assetsDirs() { return ["assets"]; }
|
|
350
360
|
static get watchers() { return {
|
package/dist/esm-es5/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,n,t,o){function r(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o["throw"](e))}catch(e){i(e)}}function c(e){e.done?t(e.value):r(e.value).then(a,s)}c((o=o.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(o=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;r=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];r=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var o=0,r=n.length,i;o<r;o++){if(i||!(o in n)){if(!i)i=Array.prototype.slice.call(n,0,o);i[o]=n[o]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{g as getIsTestMode,a as getIsStagingMode,l as log,h as handleFetch,b as logError}from"./handleFetch-dd74bbb1.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{a as availableTestKeys}from"./VarianceTest-fef2d958.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var o=["qa.js.zonos.com"];var r=new URL(n).origin;var i=t.some((function(e){return r.includes(e)}));var a=o.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var t=fallbackList[n+1];return t||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,t,o,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:t=a.sent(),o=t.errors,r=t.json;if(o.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var o=/[^a-zA-Z0-9-_]+/.test(t);if(!!o){return null}return t};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var t="https://v1.3.213.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var o="preview.js.zonos.com";var r="https://".concat(n,".").concat(o);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!V3_URL_REGEX.test(t.src)){continue}return t}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(V3_URL).concat(n);var o=document.head||document.body;if(!o){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}o.appendChild(t);return t};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var o=zonosStripeFindScript();if(o&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!o){o=injectScript(e)}o===null||o===void 0?void 0:o.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));o===null||o===void 0?void 0:o.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,t){if(e===null){return null}var o=e.apply(undefined,n);registerWrapper(o,t);return o};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(t){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(t){return initStripe(t,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,t,o,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();t=getGenericSettingsOverride();o=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:o,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,t,o,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),t=n.isDgsCartId,o=n.isLegacyCartId;if(!o&&!t){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,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,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;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}),t=n.currentLoadScriptUrl,o=n.isWhiteListed;if(o){return t}return null}();var ZONOS_URL="https://v1.3.213.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.213";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.213";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.213";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;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="1749249803483";Zonos.isLegacyCheckout=false;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.213");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,t,o,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,t=e.checkoutSettings,o=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:o,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var o=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!o){log("Skip injecting custom script for hosted checkout","info",{footerScript:o,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){log("Injecting custom header script");var r=document.createElement("script");r.textContent=t.value;document.head.appendChild(r)}if(o){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=o.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,o=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=o.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(t&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var o=document.querySelector("iframe#".concat(t));if(!o){o=document.createElement("iframe");o.id=t;o.style.display="none";o.style.opacity="0";o.style.position="absolute";o.style.top="-9999px";o.style.left="-9999px";o.style.width="1px";o.style.height="1px";o.style.border="none";o.style.overflow="hidden";o.style.visibility="hidden";document.body.appendChild(o)}var r=((e=o.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(o)};Zonos.injectController=function(e){var n=e.config;var t,o;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,t;return __generator(this,(function(o){switch(o.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:t=o.sent();if(!t){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void s.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,t=e.isModule,o=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(o);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!t){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:t,theRestUrl:o})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var t=getZonosQaUrl();return t||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var o=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(o,"/").concat(t);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:t})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var t=0;t<n.length;t++){var o=n[t];if(!o){continue}if(GOOGLE_FONT_REGEX.test(o.href)){continue}return o}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;n.appendChild(t);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(o);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var o=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;o.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;o.appendChild(i);log("[FONT] ".concat(t," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,t,o){function r(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o["throw"](e))}catch(e){i(e)}}function c(e){e.done?t(e.value):r(e.value).then(a,s)}c((o=o.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(o=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;r=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];r=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var o=0,r=n.length,i;o<r;o++){if(i||!(o in n)){if(!i)i=Array.prototype.slice.call(n,0,o);i[o]=n[o]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{g as getIsTestMode,a as getIsStagingMode,l as log,h as handleFetch,b as logError}from"./handleFetch-dd74bbb1.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{a as availableTestKeys}from"./VarianceTest-fef2d958.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var o=["qa.js.zonos.com"];var r=new URL(n).origin;var i=t.some((function(e){return r.includes(e)}));var a=o.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var t=fallbackList[n+1];return t||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,t,o,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:t=a.sent(),o=t.errors,r=t.json;if(o.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var o=/[^a-zA-Z0-9-_]+/.test(t);if(!!o){return null}return t};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var t="https://v1.3.214.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var o="preview.js.zonos.com";var r="https://".concat(n,".").concat(o);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!V3_URL_REGEX.test(t.src)){continue}return t}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(V3_URL).concat(n);var o=document.head||document.body;if(!o){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}o.appendChild(t);return t};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var o=zonosStripeFindScript();if(o&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!o){o=injectScript(e)}o===null||o===void 0?void 0:o.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));o===null||o===void 0?void 0:o.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,t){if(e===null){return null}var o=e.apply(undefined,n);registerWrapper(o,t);return o};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(t){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(t){return initStripe(t,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,t,o,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();t=getGenericSettingsOverride();o=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:o,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,t,o,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),t=n.isDgsCartId,o=n.isLegacyCartId;if(!o&&!t){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,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,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;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}),t=n.currentLoadScriptUrl,o=n.isWhiteListed;if(o){return t}return null}();var ZONOS_URL="https://v1.3.214.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.214";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.214";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.214";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;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="1749479724498";Zonos.isLegacyCheckout=false;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.214");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,t,o,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,t=e.checkoutSettings,o=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:o,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var o=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!o){log("Skip injecting custom script for hosted checkout","info",{footerScript:o,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){log("Injecting custom header script");var r=document.createElement("script");r.textContent=t.value;document.head.appendChild(r)}if(o){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=o.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,o=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=o.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(t&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var o=document.querySelector("iframe#".concat(t));if(!o){o=document.createElement("iframe");o.id=t;o.style.display="none";o.style.opacity="0";o.style.position="absolute";o.style.top="-9999px";o.style.left="-9999px";o.style.width="1px";o.style.height="1px";o.style.border="none";o.style.overflow="hidden";o.style.visibility="hidden";document.body.appendChild(o)}var r=((e=o.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(o)};Zonos.injectController=function(e){var n=e.config;var t,o;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,t;return __generator(this,(function(o){switch(o.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:t=o.sent();if(!t){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void s.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,t=e.isModule,o=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(o);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!t){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:t,theRestUrl:o})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var t=getZonosQaUrl();return t||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var o=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(o,"/").concat(t);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:t})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var t=0;t<n.length;t++){var o=n[t];if(!o){continue}if(GOOGLE_FONT_REGEX.test(o.href)){continue}return o}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;n.appendChild(t);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(o);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var o=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;o.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;o.appendChild(i);log("[FONT] ".concat(t," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};
|