@zonos/elements 1.3.91 → 1.3.93
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/{CheckoutConfig-850071ae.js → CheckoutConfig-8e8a0d1c.js} +1 -1
- package/dist/cjs/{cart-3cc424f9.js → cart-9d0ced11.js} +27 -6
- package/dist/cjs/{createCustomEvent-68a5819f.js → createCustomEvent-f6317809.js} +2 -2
- package/dist/cjs/{handleFetch-45e76490.js → handleFetch-5a16f2bc.js} +1 -1
- package/dist/cjs/index.cjs.js +9 -9
- package/dist/cjs/{paypal-6abc29b9.js → paypal-a6ddcfaf.js} +2 -2
- package/dist/cjs/zonos-address_7.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +14 -11
- package/dist/cjs/zonos-checkout.cjs.entry.js +48 -38
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-notification_3.cjs.entry.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +10 -7
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +45 -34
- package/dist/collection/components/store/checkout/cart.js +6 -1
- package/dist/collection/components/store/checkout/stripe.js +6 -2
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +14 -2
- package/dist/collection/components/utils/logging/log.js +1 -1
- package/dist/esm/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
- package/dist/esm/{cart-66d67627.js → cart-ef2e2eec.js} +28 -7
- package/dist/esm/{createCustomEvent-34725327.js → createCustomEvent-73760da0.js} +2 -2
- package/dist/esm/{handleFetch-0133265e.js → handleFetch-ce924688.js} +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/{paypal-da9e020f.js → paypal-cce03d02.js} +2 -2
- package/dist/esm/zonos-address_7.entry.js +2 -2
- package/dist/esm/zonos-cart-items_12.entry.js +14 -11
- package/dist/esm/zonos-checkout.entry.js +48 -38
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +3 -3
- package/dist/esm-es5/{CheckoutConfig-c0ec120d.js → CheckoutConfig-c54d23b8.js} +1 -1
- package/dist/esm-es5/{cart-66d67627.js → cart-ef2e2eec.js} +1 -1
- package/dist/esm-es5/createCustomEvent-73760da0.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-da9e020f.js → paypal-cce03d02.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.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-0af823af.js → p-021c2035.js} +1 -1
- package/dist/zonos-elements/p-205d1fd0.system.entry.js +1 -0
- package/dist/zonos-elements/{p-fb85884a.entry.js → p-3242242f.entry.js} +1 -1
- package/dist/zonos-elements/{p-d3a8c7ae.system.js → p-332ccd38.system.js} +1 -1
- package/dist/zonos-elements/{p-1615c1c4.entry.js → p-36050826.entry.js} +1 -1
- package/dist/zonos-elements/{p-71cc7c12.system.entry.js → p-517444c0.system.entry.js} +1 -1
- package/dist/zonos-elements/p-52542b33.system.js +1 -0
- package/dist/zonos-elements/{p-324fd0ad.entry.js → p-52b7a342.entry.js} +1 -1
- package/dist/zonos-elements/{p-dd151786.entry.js → p-55534ab4.entry.js} +1 -1
- package/dist/zonos-elements/{p-2e00dbf9.entry.js → p-6037f297.entry.js} +1 -1
- package/dist/zonos-elements/{p-d1c0bc88.system.js → p-606e0443.system.js} +1 -1
- package/dist/zonos-elements/p-609209fe.entry.js +1 -0
- package/dist/zonos-elements/{p-6e49e7cc.system.entry.js → p-61c43b0c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5cbae38e.js → p-7141699d.js} +1 -1
- package/dist/zonos-elements/{p-14d2312c.system.entry.js → p-832535b5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b8e85bf5.js → p-9a13b43f.js} +1 -1
- package/dist/zonos-elements/{p-14783646.entry.js → p-a8fb9ec4.entry.js} +1 -1
- package/dist/zonos-elements/{p-eca9ebc4.system.entry.js → p-a92ea268.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-35d1a532.system.js → p-acb212b2.system.js} +1 -1
- package/dist/zonos-elements/{p-c61d62ec.js → p-ad8b87ec.js} +1 -1
- package/dist/zonos-elements/{p-b85f701c.entry.js → p-c6950e78.entry.js} +1 -1
- package/dist/zonos-elements/{p-03159bbf.system.entry.js → p-c6f848d6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-06bab7d2.entry.js → p-c990f553.entry.js} +1 -1
- package/dist/zonos-elements/{p-a637cb1c.system.entry.js → p-d42d729b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-072f4a48.system.entry.js → p-d8c3540c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6525fa0e.system.entry.js → p-dbc57aea.system.entry.js} +1 -1
- package/dist/zonos-elements/p-e11d7951.system.entry.js +1 -0
- package/dist/zonos-elements/p-e2bbd294.entry.js +1 -0
- package/dist/zonos-elements/{p-e987ae90.system.js → p-e3432dca.system.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/createCustomEvent-34725327.js +0 -1
- package/dist/zonos-elements/p-0deebb7a.entry.js +0 -1
- package/dist/zonos-elements/p-6c6eb676.entry.js +0 -1
- package/dist/zonos-elements/p-8c0ff373.system.js +0 -1
- package/dist/zonos-elements/p-bd1b32ea.system.entry.js +0 -1
- package/dist/zonos-elements/p-c0e66eb4.system.entry.js +0 -1
- /package/dist/esm-es5/{handleFetch-0133265e.js → handleFetch-ce924688.js} +0 -0
- /package/dist/zonos-elements/{p-197c5707.system.js → p-480556ea.system.js} +0 -0
- /package/dist/zonos-elements/{p-ad7ce197.js → p-539cc913.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const handleFetch = require('./handleFetch-
|
|
3
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
4
4
|
|
|
5
5
|
const getTempCartById = async (cartId) => {
|
|
6
6
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
5
5
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
6
6
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
7
7
|
|
|
@@ -8111,11 +8111,23 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
|
8111
8111
|
return json.locale_countryCodesPage;
|
|
8112
8112
|
};
|
|
8113
8113
|
|
|
8114
|
+
const validateCountryCode = (countryCode) => {
|
|
8115
|
+
// Check that the country is two characters and is upper case
|
|
8116
|
+
if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
|
|
8117
|
+
return countryCode;
|
|
8118
|
+
}
|
|
8119
|
+
return null;
|
|
8120
|
+
};
|
|
8114
8121
|
const getZCountryUrlParam = (urlParams) => {
|
|
8115
8122
|
const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
|
|
8116
|
-
const
|
|
8123
|
+
const getCountryParam = (param) => {
|
|
8124
|
+
const country = urlSearchParams.get(param);
|
|
8125
|
+
// Check that the country is two characters and is upper case
|
|
8126
|
+
return validateCountryCode(country);
|
|
8127
|
+
};
|
|
8128
|
+
const zCountry = getCountryParam('zCountry');
|
|
8117
8129
|
// Fallback to legacy 'country'
|
|
8118
|
-
const fallback =
|
|
8130
|
+
const fallback = getCountryParam('country');
|
|
8119
8131
|
return zCountry || fallback;
|
|
8120
8132
|
};
|
|
8121
8133
|
|
|
@@ -9474,8 +9486,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
9474
9486
|
const stripeStoreInitCheckoutSession = async () => {
|
|
9475
9487
|
var _a, _b;
|
|
9476
9488
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
9477
|
-
if (!
|
|
9478
|
-
handleFetch.logError(
|
|
9489
|
+
if (!localizationStore.targetCurrency) {
|
|
9490
|
+
handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
9491
|
+
return false;
|
|
9492
|
+
}
|
|
9493
|
+
if (!total) {
|
|
9494
|
+
handleFetch.logError(`Failed to create checkout session - missing total amount of items`);
|
|
9479
9495
|
return false;
|
|
9480
9496
|
}
|
|
9481
9497
|
stripeStore.isFetchingSession = true;
|
|
@@ -9853,13 +9869,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
9853
9869
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
9854
9870
|
});
|
|
9855
9871
|
if (errors.length > 0 || !json) {
|
|
9856
|
-
// do nothing if we can't get checkout session
|
|
9857
9872
|
handleFetch.logError('Error occurs when updating checkout session.');
|
|
9858
9873
|
if (shouldInitSessionOnFailure) {
|
|
9859
9874
|
handleFetch.log('Initiating checkout session on failure', 'info');
|
|
9860
9875
|
const success = await stripeStoreInitCheckoutSession();
|
|
9861
9876
|
handleFetch.log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
9862
9877
|
if (!success) {
|
|
9878
|
+
cartStoreUpdateToErrorState({
|
|
9879
|
+
messages: [
|
|
9880
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
9881
|
+
],
|
|
9882
|
+
title: translate('Error creating Checkout'),
|
|
9883
|
+
});
|
|
9863
9884
|
return false;
|
|
9864
9885
|
}
|
|
9865
9886
|
return true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const cart = require('./cart-
|
|
3
|
+
const cart = require('./cart-9d0ced11.js');
|
|
4
4
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
6
|
|
|
7
7
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
8
8
|
var _a, _b;
|
|
@@ -55,7 +55,7 @@ const log = (message, type, ..._additionalInfo) => {
|
|
|
55
55
|
loggingIframe.style.visibility = 'hidden';
|
|
56
56
|
document.body.appendChild(loggingIframe);
|
|
57
57
|
}
|
|
58
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
58
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
59
59
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
60
60
|
switch (type) {
|
|
61
61
|
case 'warn':
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
6
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
|
+
const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the load version and url based on the loadScriptSrc and version
|
|
@@ -97,7 +97,7 @@ const getZonosQaUrl = () => {
|
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
100
|
-
const cdnUrl = "https://v1.3.
|
|
100
|
+
const cdnUrl = "https://v1.3.93.js.zonos.com";
|
|
101
101
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
102
102
|
if (!qaUrl &&
|
|
103
103
|
(cdnUrl.includes('test.') ||
|
|
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
|
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
})();
|
|
284
|
-
const ZONOS_URL = "https://v1.3.
|
|
285
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
286
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
287
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
284
|
+
const ZONOS_URL = "https://v1.3.93.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.93";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.93";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.93";
|
|
288
288
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
289
289
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
290
290
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -299,7 +299,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
299
299
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
300
300
|
Zonos._paypalMockResponse = null;
|
|
301
301
|
Zonos.isBigCommerce = false;
|
|
302
|
-
Zonos.releaseDate = "
|
|
302
|
+
Zonos.releaseDate = "1729003957102";
|
|
303
303
|
Zonos.isLegacyCheckout = false;
|
|
304
304
|
/**
|
|
305
305
|
* By default, the package will load from npm
|
|
@@ -307,7 +307,7 @@ Zonos.isLegacyCheckout = false;
|
|
|
307
307
|
Zonos.isNpm = true;
|
|
308
308
|
Zonos.zonosQaUrl = null;
|
|
309
309
|
Zonos.zonosQaUrlApi = null;
|
|
310
|
-
Zonos.version = `v${"1.3.
|
|
310
|
+
Zonos.version = `v${"1.3.93"}`;
|
|
311
311
|
Zonos.modeAlerted = false;
|
|
312
312
|
Zonos.cartData = null;
|
|
313
313
|
Zonos.paypal = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const cart = require('./cart-9d0ced11.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
7
7
|
|
|
8
8
|
/*!
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
10
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
10
|
+
const createCustomEvent = require('./createCustomEvent-f6317809.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
12
|
-
const handleFetch = require('./handleFetch-
|
|
12
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
@@ -1290,10 +1290,13 @@ const ZonosCheckoutFinish = class {
|
|
|
1290
1290
|
this.getPullOrder = async (attempts = 0) => {
|
|
1291
1291
|
var _a, _b;
|
|
1292
1292
|
const { baseUrl, order } = await this.pullOrder();
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
if ((order &&
|
|
1296
|
-
|
|
1293
|
+
const { isLegacyCheckout } = window.Zonos;
|
|
1294
|
+
const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
|
|
1295
|
+
if ((order && !isLegacyCheckout) ||
|
|
1296
|
+
(!order && attempts >= 5) ||
|
|
1297
|
+
foundLegacyOrderNumber) {
|
|
1298
|
+
if (isLegacyCheckout && !foundLegacyOrderNumber) {
|
|
1299
|
+
// We pushed this one through without the legacy order number, so we should log this
|
|
1297
1300
|
const checkoutSessionId = cart.cartStore.checkoutSessionId;
|
|
1298
1301
|
void handleFetch.sendErrorLog({
|
|
1299
1302
|
endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
|
|
@@ -1310,7 +1313,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1310
1313
|
this.order = order;
|
|
1311
1314
|
this.handleSuccessBehavior();
|
|
1312
1315
|
}
|
|
1313
|
-
else if ((!order || !
|
|
1316
|
+
else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
|
|
1314
1317
|
// Wait for 1 second before the next attempt
|
|
1315
1318
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1316
1319
|
await this.getPullOrder(attempts + 1);
|
|
@@ -1446,11 +1449,11 @@ const ZonosCheckoutFinish = class {
|
|
|
1446
1449
|
var _a, _b;
|
|
1447
1450
|
const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
|
|
1448
1451
|
const isTestMode = createCustomEvent.getIsTestMode();
|
|
1449
|
-
return (index.h(index.Host, { key: '
|
|
1452
|
+
return (index.h(index.Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
|
|
1450
1453
|
'--border-radius': getBorderRadius.getBorderRadius({
|
|
1451
1454
|
overrideBorderStyle: this.borderRadius,
|
|
1452
1455
|
}),
|
|
1453
|
-
} }, this.isLoading && (index.h("div", { key: '
|
|
1456
|
+
} }, this.isLoading && (index.h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, index.h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (index.h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, index.h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (index.h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), index.h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cart.cartStore.step === 'finish' && (index.h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
|
|
1454
1457
|
}
|
|
1455
1458
|
static get assetsDirs() { return ["assets"]; }
|
|
1456
1459
|
};
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
9
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
9
|
+
const createCustomEvent = require('./createCustomEvent-f6317809.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
|
-
const handleFetch = require('./handleFetch-
|
|
11
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
13
13
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
14
14
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
15
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
15
|
+
const CheckoutConfig = require('./CheckoutConfig-8e8a0d1c.js');
|
|
16
16
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -380,12 +380,6 @@ const ZonosCheckout = class {
|
|
|
380
380
|
catch (err) {
|
|
381
381
|
// stop loading
|
|
382
382
|
cart.stripeStore.isFetchingSession = false;
|
|
383
|
-
cart.cartStoreUpdateToErrorState({
|
|
384
|
-
messages: [
|
|
385
|
-
cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
386
|
-
],
|
|
387
|
-
title: cart.translate('Error creating Checkout'),
|
|
388
|
-
});
|
|
389
383
|
// We want to log the error anytime we fail to create a checkout session
|
|
390
384
|
void handleFetch.sendErrorLog({
|
|
391
385
|
endpoint: 'Error creating Checkout',
|
|
@@ -397,6 +391,12 @@ const ZonosCheckout = class {
|
|
|
397
391
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
398
392
|
},
|
|
399
393
|
});
|
|
394
|
+
cart.cartStoreUpdateToErrorState({
|
|
395
|
+
messages: [
|
|
396
|
+
cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
397
|
+
],
|
|
398
|
+
title: cart.translate('Error creating Checkout'),
|
|
399
|
+
});
|
|
400
400
|
}
|
|
401
401
|
}, {
|
|
402
402
|
// Trigger this event before any other event
|
|
@@ -435,40 +435,50 @@ const ZonosCheckout = class {
|
|
|
435
435
|
*/
|
|
436
436
|
useLegacyQueryParams() {
|
|
437
437
|
const urlParams = new URLSearchParams(window.location.search);
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
customerEmail: urlParams.get('customerEmail'),
|
|
446
|
-
customerName: urlParams.get('customerName'),
|
|
447
|
-
customerPhone: urlParams.get('customerPhone'),
|
|
448
|
-
customerState: urlParams.get('customerState'),
|
|
449
|
-
customerZip: urlParams.get('customerZip'),
|
|
438
|
+
handleFetch.log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
|
|
439
|
+
const getParam = (param) => {
|
|
440
|
+
const value = urlParams.get(param);
|
|
441
|
+
if (!value || value === 'undefined') {
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
return value;
|
|
450
445
|
};
|
|
446
|
+
const country =
|
|
447
|
+
// fallback to selected country code if country is not provided
|
|
448
|
+
cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode;
|
|
449
|
+
const city = getParam('customerCity');
|
|
450
|
+
const email = getParam('customerEmail') || '';
|
|
451
|
+
const line1 = getParam('customerAddress1');
|
|
452
|
+
const line2 = getParam('customerAddress2') || '';
|
|
453
|
+
const name = getParam('customerName');
|
|
454
|
+
const phone = getParam('customerPhone');
|
|
455
|
+
const postal_code = getParam('customerZip') || '';
|
|
456
|
+
const state = getParam('customerState') || '';
|
|
451
457
|
// if one of the value is null, no need to preset the default address
|
|
452
|
-
if (!
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
+
if (!line1 || !city || !name || !phone || !country) {
|
|
459
|
+
handleFetch.log('Missing required query params so it can not be prefilled', 'info', [
|
|
460
|
+
!line1 && 'line1',
|
|
461
|
+
!city && 'city',
|
|
462
|
+
!name && 'name',
|
|
463
|
+
!phone && 'phone',
|
|
464
|
+
!country && 'country',
|
|
465
|
+
]
|
|
466
|
+
.filter(Boolean)
|
|
467
|
+
.join(', '));
|
|
458
468
|
return;
|
|
459
469
|
}
|
|
460
470
|
this.defaultAddress = {
|
|
461
471
|
address: {
|
|
462
|
-
city
|
|
463
|
-
country
|
|
464
|
-
line1
|
|
465
|
-
line2
|
|
466
|
-
postal_code
|
|
467
|
-
state
|
|
472
|
+
city,
|
|
473
|
+
country,
|
|
474
|
+
line1,
|
|
475
|
+
line2,
|
|
476
|
+
postal_code,
|
|
477
|
+
state,
|
|
468
478
|
},
|
|
469
|
-
email
|
|
470
|
-
name
|
|
471
|
-
phone
|
|
479
|
+
email,
|
|
480
|
+
name,
|
|
481
|
+
phone,
|
|
472
482
|
};
|
|
473
483
|
}
|
|
474
484
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
9
9
|
require('./isDarkColor-5efc8367.js');
|
|
10
10
|
require('./getBorderRadius-5a64574c.js');
|
|
11
11
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-5a16f2bc.js');
|
|
12
12
|
require('./isDarkColor-5efc8367.js');
|
|
13
13
|
require('./getBorderRadius-5a64574c.js');
|
|
14
14
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-9d0ced11.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-9d0ced11.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-5a16f2bc.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
-
const paypal = require('./paypal-
|
|
8
|
+
const cart = require('./cart-9d0ced11.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-5a16f2bc.js');
|
|
10
|
+
const paypal = require('./paypal-a6ddcfaf.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
@@ -95,10 +95,13 @@ export class ZonosCheckoutFinish {
|
|
|
95
95
|
this.getPullOrder = async (attempts = 0) => {
|
|
96
96
|
var _a, _b;
|
|
97
97
|
const { baseUrl, order } = await this.pullOrder();
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
if ((order &&
|
|
101
|
-
|
|
98
|
+
const { isLegacyCheckout } = window.Zonos;
|
|
99
|
+
const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
|
|
100
|
+
if ((order && !isLegacyCheckout) ||
|
|
101
|
+
(!order && attempts >= 5) ||
|
|
102
|
+
foundLegacyOrderNumber) {
|
|
103
|
+
if (isLegacyCheckout && !foundLegacyOrderNumber) {
|
|
104
|
+
// We pushed this one through without the legacy order number, so we should log this
|
|
102
105
|
const checkoutSessionId = cartStore.checkoutSessionId;
|
|
103
106
|
void sendErrorLog({
|
|
104
107
|
endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
|
|
@@ -115,7 +118,7 @@ export class ZonosCheckoutFinish {
|
|
|
115
118
|
this.order = order;
|
|
116
119
|
this.handleSuccessBehavior();
|
|
117
120
|
}
|
|
118
|
-
else if ((!order || !
|
|
121
|
+
else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
|
|
119
122
|
// Wait for 1 second before the next attempt
|
|
120
123
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
121
124
|
await this.getPullOrder(attempts + 1);
|
|
@@ -251,11 +254,11 @@ export class ZonosCheckoutFinish {
|
|
|
251
254
|
var _a, _b;
|
|
252
255
|
const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
|
|
253
256
|
const isTestMode = getIsTestMode();
|
|
254
|
-
return (h(Host, { key: '
|
|
257
|
+
return (h(Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
|
|
255
258
|
'--border-radius': getBorderRadius({
|
|
256
259
|
overrideBorderStyle: this.borderRadius,
|
|
257
260
|
}),
|
|
258
|
-
} }, this.isLoading && (h("div", { key: '
|
|
261
|
+
} }, this.isLoading && (h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
|
|
259
262
|
}
|
|
260
263
|
static get is() { return "zonos-checkout-finish"; }
|
|
261
264
|
static get encapsulation() { return "shadow"; }
|