@zonos/elements 1.3.91 → 1.3.92
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/{cart-3cc424f9.js → cart-d456e0b8.js} +14 -2
- package/dist/cjs/{createCustomEvent-68a5819f.js → createCustomEvent-94c259c7.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-6abc29b9.js → paypal-5c5f8d32.js} +1 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +13 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +19 -12
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
- 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 +18 -10
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +14 -2
- package/dist/esm/{cart-66d67627.js → cart-1083aa3b.js} +15 -3
- package/dist/esm/{createCustomEvent-34725327.js → createCustomEvent-a45228e7.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-da9e020f.js → paypal-a2399ed3.js} +1 -1
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_12.entry.js +13 -10
- package/dist/esm/zonos-checkout.entry.js +19 -12
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +2 -2
- package/dist/esm-es5/{cart-66d67627.js → cart-1083aa3b.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-34725327.js → createCustomEvent-a45228e7.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-da9e020f.js → paypal-a2399ed3.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-2e00dbf9.entry.js → p-1560ee37.entry.js} +1 -1
- package/dist/zonos-elements/{p-a637cb1c.system.entry.js → p-1f1aaf73.system.entry.js} +1 -1
- package/dist/zonos-elements/p-340408f2.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5cbae38e.js → p-362bd7de.js} +1 -1
- package/dist/zonos-elements/{p-dd151786.entry.js → p-3d6a7efd.entry.js} +1 -1
- package/dist/zonos-elements/p-403b3460.entry.js +1 -0
- package/dist/zonos-elements/{p-072f4a48.system.entry.js → p-460cc134.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e987ae90.system.js → p-4854c65b.system.js} +1 -1
- package/dist/zonos-elements/{p-eca9ebc4.system.entry.js → p-4e3d23ad.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-03159bbf.system.entry.js → p-52fdf52d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d1c0bc88.system.js → p-57aa09e7.system.js} +1 -1
- package/dist/zonos-elements/{p-324fd0ad.entry.js → p-7995965e.entry.js} +1 -1
- package/dist/zonos-elements/{p-d3a8c7ae.system.js → p-8aad6abd.system.js} +1 -1
- package/dist/zonos-elements/{p-c61d62ec.js → p-8dc1342e.js} +1 -1
- package/dist/zonos-elements/{p-14783646.entry.js → p-8e4348e9.entry.js} +1 -1
- package/dist/zonos-elements/{p-0af823af.js → p-95b4ea5e.js} +1 -1
- package/dist/zonos-elements/{p-35d1a532.system.js → p-b53f9c25.system.js} +1 -1
- package/dist/zonos-elements/{p-71cc7c12.system.entry.js → p-ba0aef88.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b85f701c.entry.js → p-c39c3ed6.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-06bab7d2.entry.js → p-cf28a962.entry.js} +1 -1
- package/dist/zonos-elements/{p-14d2312c.system.entry.js → p-d8a3b001.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fb85884a.entry.js → p-dbe8a5de.entry.js} +1 -1
- package/dist/zonos-elements/{p-6525fa0e.system.entry.js → p-ded2ae47.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6e49e7cc.system.entry.js → p-e8c3387c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-e9ee2062.entry.js +1 -0
- package/dist/zonos-elements/p-ed276123.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1615c1c4.entry.js → p-f13738a1.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -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-bd1b32ea.system.entry.js +0 -1
- package/dist/zonos-elements/p-c0e66eb4.system.entry.js +0 -1
|
@@ -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
|
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -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.92.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.92.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.92";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.92";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.92";
|
|
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 = "1728934623320";
|
|
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.92"}`;
|
|
311
311
|
Zonos.modeAlerted = false;
|
|
312
312
|
Zonos.cartData = null;
|
|
313
313
|
Zonos.paypal = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const cart = require('./cart-
|
|
4
|
+
const cart = require('./cart-d456e0b8.js');
|
|
5
5
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
7
7
|
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
@@ -3,11 +3,11 @@
|
|
|
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-d456e0b8.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-5c5f8d32.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
10
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
10
|
+
const createCustomEvent = require('./createCustomEvent-94c259c7.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.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,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-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-d456e0b8.js');
|
|
7
|
+
const paypal = require('./paypal-5c5f8d32.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
9
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
9
|
+
const createCustomEvent = require('./createCustomEvent-94c259c7.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
11
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -435,18 +435,25 @@ const ZonosCheckout = class {
|
|
|
435
435
|
*/
|
|
436
436
|
useLegacyQueryParams() {
|
|
437
437
|
const urlParams = new URLSearchParams(window.location.search);
|
|
438
|
+
const getParam = (param) => {
|
|
439
|
+
const value = urlParams.get(param);
|
|
440
|
+
if (!value || value === 'undefined') {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
return value;
|
|
444
|
+
};
|
|
438
445
|
const legacyShippingInfo = {
|
|
439
446
|
country:
|
|
440
447
|
// fallback to selected country code if country is not provided
|
|
441
|
-
|
|
442
|
-
customerAddress1:
|
|
443
|
-
customerAddress2:
|
|
444
|
-
customerCity:
|
|
445
|
-
customerEmail:
|
|
446
|
-
customerName:
|
|
447
|
-
customerPhone:
|
|
448
|
-
customerState:
|
|
449
|
-
customerZip:
|
|
448
|
+
cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode,
|
|
449
|
+
customerAddress1: getParam('customerAddress1'),
|
|
450
|
+
customerAddress2: getParam('customerAddress2'),
|
|
451
|
+
customerCity: getParam('customerCity'),
|
|
452
|
+
customerEmail: getParam('customerEmail'),
|
|
453
|
+
customerName: getParam('customerName'),
|
|
454
|
+
customerPhone: getParam('customerPhone'),
|
|
455
|
+
customerState: getParam('customerState'),
|
|
456
|
+
customerZip: getParam('customerZip'),
|
|
450
457
|
};
|
|
451
458
|
// if one of the value is null, no need to preset the default address
|
|
452
459
|
if (!legacyShippingInfo.customerAddress1 ||
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
require('./isDarkColor-5efc8367.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
require('./handleFetch-45e76490.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.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');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.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');
|
|
@@ -4,7 +4,7 @@ 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-d456e0b8.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-d456e0b8.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-45e76490.js');
|
|
@@ -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-
|
|
8
|
+
const cart = require('./cart-d456e0b8.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
|
-
const paypal = require('./paypal-
|
|
10
|
+
const paypal = require('./paypal-5c5f8d32.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"; }
|
|
@@ -15,6 +15,7 @@ import { watchBigcommerceDomesticCheckout } from "../../utils/checkout/watchBigc
|
|
|
15
15
|
import { classes } from "../../utils/classes";
|
|
16
16
|
import { createCustomEvent } from "../../utils/createCustomEvent";
|
|
17
17
|
import { getBorderRadius } from "../../utils/getBorderRadius";
|
|
18
|
+
import { getZCountryUrlParam } from "../../utils/hello/getZCountryUrlParam";
|
|
18
19
|
import { isDarkColor } from "../../utils/isDarkColor";
|
|
19
20
|
import { allLogs, log } from "../../utils/logging/log";
|
|
20
21
|
import { logError } from "../../utils/logging/logError";
|
|
@@ -23,7 +24,7 @@ import { mergeConfig } from "../../utils/mergeConfig";
|
|
|
23
24
|
import { submitGtag } from "../../utils/submitGtag";
|
|
24
25
|
import { setupCartData } from "../../../scripts/cart/_setupCartData";
|
|
25
26
|
import { checkoutHiddenBtnSelector, domesticRedirectedBtnSelector, } from "../../../types/checkout/CheckoutConfig";
|
|
26
|
-
/** These assets
|
|
27
|
+
/** These assets need to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
|
|
27
28
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
28
29
|
import MessageIcon from "./assets/MessageIcon.svg";
|
|
29
30
|
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
|
|
@@ -281,18 +282,25 @@ export class ZonosCheckout {
|
|
|
281
282
|
*/
|
|
282
283
|
useLegacyQueryParams() {
|
|
283
284
|
const urlParams = new URLSearchParams(window.location.search);
|
|
285
|
+
const getParam = (param) => {
|
|
286
|
+
const value = urlParams.get(param);
|
|
287
|
+
if (!value || value === 'undefined') {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
return value;
|
|
291
|
+
};
|
|
284
292
|
const legacyShippingInfo = {
|
|
285
293
|
country:
|
|
286
294
|
// fallback to selected country code if country is not provided
|
|
287
|
-
urlParams
|
|
288
|
-
customerAddress1:
|
|
289
|
-
customerAddress2:
|
|
290
|
-
customerCity:
|
|
291
|
-
customerEmail:
|
|
292
|
-
customerName:
|
|
293
|
-
customerPhone:
|
|
294
|
-
customerState:
|
|
295
|
-
customerZip:
|
|
295
|
+
getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode,
|
|
296
|
+
customerAddress1: getParam('customerAddress1'),
|
|
297
|
+
customerAddress2: getParam('customerAddress2'),
|
|
298
|
+
customerCity: getParam('customerCity'),
|
|
299
|
+
customerEmail: getParam('customerEmail'),
|
|
300
|
+
customerName: getParam('customerName'),
|
|
301
|
+
customerPhone: getParam('customerPhone'),
|
|
302
|
+
customerState: getParam('customerState'),
|
|
303
|
+
customerZip: getParam('customerZip'),
|
|
296
304
|
};
|
|
297
305
|
// if one of the value is null, no need to preset the default address
|
|
298
306
|
if (!legacyShippingInfo.customerAddress1 ||
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
const validateCountryCode = (countryCode) => {
|
|
2
|
+
// Check that the country is two characters and is upper case
|
|
3
|
+
if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
|
|
4
|
+
return countryCode;
|
|
5
|
+
}
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
1
8
|
export const getZCountryUrlParam = (urlParams) => {
|
|
2
9
|
const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
|
|
3
|
-
const
|
|
10
|
+
const getCountryParam = (param) => {
|
|
11
|
+
const country = urlSearchParams.get(param);
|
|
12
|
+
// Check that the country is two characters and is upper case
|
|
13
|
+
return validateCountryCode(country);
|
|
14
|
+
};
|
|
15
|
+
const zCountry = getCountryParam('zCountry');
|
|
4
16
|
// Fallback to legacy 'country'
|
|
5
|
-
const fallback =
|
|
17
|
+
const fallback = getCountryParam('country');
|
|
6
18
|
return zCountry || fallback;
|
|
7
19
|
};
|
|
@@ -8109,11 +8109,23 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
|
8109
8109
|
return json.locale_countryCodesPage;
|
|
8110
8110
|
};
|
|
8111
8111
|
|
|
8112
|
+
const validateCountryCode = (countryCode) => {
|
|
8113
|
+
// Check that the country is two characters and is upper case
|
|
8114
|
+
if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
|
|
8115
|
+
return countryCode;
|
|
8116
|
+
}
|
|
8117
|
+
return null;
|
|
8118
|
+
};
|
|
8112
8119
|
const getZCountryUrlParam = (urlParams) => {
|
|
8113
8120
|
const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
|
|
8114
|
-
const
|
|
8121
|
+
const getCountryParam = (param) => {
|
|
8122
|
+
const country = urlSearchParams.get(param);
|
|
8123
|
+
// Check that the country is two characters and is upper case
|
|
8124
|
+
return validateCountryCode(country);
|
|
8125
|
+
};
|
|
8126
|
+
const zCountry = getCountryParam('zCountry');
|
|
8115
8127
|
// Fallback to legacy 'country'
|
|
8116
|
-
const fallback =
|
|
8128
|
+
const fallback = getCountryParam('country');
|
|
8117
8129
|
return zCountry || fallback;
|
|
8118
8130
|
};
|
|
8119
8131
|
|
|
@@ -10028,4 +10040,4 @@ const cartStoreResetTabItems = () => {
|
|
|
10028
10040
|
cartStoreResetSelectedShippingOption();
|
|
10029
10041
|
};
|
|
10030
10042
|
|
|
10031
|
-
export { setZCountryUrlParam as A, currencyDisplay as B, currencyConvertAndFormat as C, currencyConvert as D, currencyFormat as E, cartStoreHasOneEligibleItem as F, stripeStoreApplyPromoCode as G, stripeStoreRemovePromoCode as H, stripeStoreRetrievePayment as I, stripeStoreMessageBasedOnStatus as J, stripeStoreResetPromoCode as K, stripeStoreTranslateAddressToLatin as L, cartStoreUpdateSelectedShippingOption as M, cartStoreGetShippingTransitInfo as N, sortServiceLevelOptionsByAmount as O, getFallbackDefaultCountryCode as P, localizationStoreUpdateSelectedLocale as Q, localizationStoreUpdateSelectedCountryCode as a, stripeStoreCleanupDomesticShippingSession as b, stripeStoreSaveDomesticShippingSession as c, cartStore as d, cartStoreUpdateItems as e, cartStoreReset as f, cartStoreResetTabItems as g, cartStoreClearCheckoutInterval as h, initStripeElements as i, stripeStore as j, stripeStoreInitCheckoutSession as k, localizationStore as l, cartStoreStartCheckoutInterval as m, cartStoreUpdateToErrorState as n,
|
|
10043
|
+
export { setZCountryUrlParam as A, currencyDisplay as B, currencyConvertAndFormat as C, currencyConvert as D, currencyFormat as E, cartStoreHasOneEligibleItem as F, stripeStoreApplyPromoCode as G, stripeStoreRemovePromoCode as H, stripeStoreRetrievePayment as I, stripeStoreMessageBasedOnStatus as J, stripeStoreResetPromoCode as K, stripeStoreTranslateAddressToLatin as L, cartStoreUpdateSelectedShippingOption as M, cartStoreGetShippingTransitInfo as N, sortServiceLevelOptionsByAmount as O, getFallbackDefaultCountryCode as P, localizationStoreUpdateSelectedLocale as Q, localizationStoreUpdateSelectedCountryCode as a, stripeStoreCleanupDomesticShippingSession as b, stripeStoreSaveDomesticShippingSession as c, cartStore as d, cartStoreUpdateItems as e, cartStoreReset as f, cartStoreResetTabItems as g, cartStoreClearCheckoutInterval as h, initStripeElements as i, stripeStore as j, stripeStoreInitCheckoutSession as k, localizationStore as l, cartStoreStartCheckoutInterval as m, cartStoreUpdateToErrorState as n, getZCountryUrlParam as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, translate as t, stripeStoreHandleInventoryCheck as u, stripeStoreConfirmPayment as v, stripeStoreReset as w, localizationStoreOnUpdate as x, isValidSelector as y, initLocalizationStore as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as cartStore, l as localizationStore } from './cart-
|
|
1
|
+
import { d as cartStore, l as localizationStore } from './cart-1083aa3b.js';
|
|
2
2
|
import { z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
3
3
|
import { h as handleFetch } from './handleFetch-0133265e.js';
|
|
4
4
|
|
package/dist/esm/index.js
CHANGED
|
@@ -94,7 +94,7 @@ const getZonosQaUrl = () => {
|
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
96
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
97
|
-
const cdnUrl = "https://v1.3.
|
|
97
|
+
const cdnUrl = "https://v1.3.92.js.zonos.com";
|
|
98
98
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
99
99
|
if (!qaUrl &&
|
|
100
100
|
(cdnUrl.includes('test.') ||
|
|
@@ -278,10 +278,10 @@ const zonosLoadUrl = (() => {
|
|
|
278
278
|
}
|
|
279
279
|
return null;
|
|
280
280
|
})();
|
|
281
|
-
const ZONOS_URL = "https://v1.3.
|
|
282
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
283
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
284
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
281
|
+
const ZONOS_URL = "https://v1.3.92.js.zonos.com";
|
|
282
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.92";
|
|
283
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.92";
|
|
284
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.92";
|
|
285
285
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
286
286
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
287
287
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -296,7 +296,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
296
296
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
297
297
|
Zonos._paypalMockResponse = null;
|
|
298
298
|
Zonos.isBigCommerce = false;
|
|
299
|
-
Zonos.releaseDate = "
|
|
299
|
+
Zonos.releaseDate = "1728934623320";
|
|
300
300
|
Zonos.isLegacyCheckout = false;
|
|
301
301
|
/**
|
|
302
302
|
* By default, the package will load from npm
|
|
@@ -304,7 +304,7 @@ Zonos.isLegacyCheckout = false;
|
|
|
304
304
|
Zonos.isNpm = true;
|
|
305
305
|
Zonos.zonosQaUrl = null;
|
|
306
306
|
Zonos.zonosQaUrlApi = null;
|
|
307
|
-
Zonos.version = `v${"1.3.
|
|
307
|
+
Zonos.version = `v${"1.3.92"}`;
|
|
308
308
|
Zonos.modeAlerted = false;
|
|
309
309
|
Zonos.cartData = null;
|
|
310
310
|
Zonos.paypal = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as zonosStore, c as createStore } from './zonosStore-0dc7a947.js';
|
|
2
|
-
import { d as cartStore,
|
|
2
|
+
import { d as cartStore, u as stripeStoreHandleInventoryCheck, t as translate, r as cartStoreNextStep, h as cartStoreClearCheckoutInterval } from './cart-1083aa3b.js';
|
|
3
3
|
import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-0133265e.js';
|
|
4
4
|
import { t as tinycolor } from './isDarkColor-b3afa948.js';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-86b8247e.js';
|
|
2
|
-
import { j as stripeStore, P as getFallbackDefaultCountryCode, l as localizationStore, t as translate } from './cart-
|
|
2
|
+
import { j as stripeStore, P as getFallbackDefaultCountryCode, l as localizationStore, t as translate } from './cart-1083aa3b.js';
|
|
3
3
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
4
4
|
import { a as logError, l as log } from './handleFetch-0133265e.js';
|
|
5
5
|
import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-86b8247e.js';
|
|
2
|
-
import { d as cartStore, t as translate, E as currencyFormat, F as cartStoreHasOneEligibleItem, G as stripeStoreApplyPromoCode, H as stripeStoreRemovePromoCode,
|
|
2
|
+
import { d as cartStore, t as translate, E as currencyFormat, F as cartStoreHasOneEligibleItem, G as stripeStoreApplyPromoCode, H as stripeStoreRemovePromoCode, w as stripeStoreReset, j as stripeStore, I as stripeStoreRetrievePayment, J as stripeStoreMessageBasedOnStatus, K as stripeStoreResetPromoCode, l as localizationStore, L as stripeStoreTranslateAddressToLatin, M as cartStoreUpdateSelectedShippingOption, N as cartStoreGetShippingTransitInfo, O as sortServiceLevelOptionsByAmount } from './cart-1083aa3b.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
|
-
import { s as submitGtag, a as paypalStore, b as paypalStoreReset, i as isContrastColor } from './paypal-
|
|
4
|
+
import { s as submitGtag, a as paypalStore, b as paypalStoreReset, i as isContrastColor } from './paypal-a2399ed3.js';
|
|
5
5
|
import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
|
|
6
|
-
import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-
|
|
6
|
+
import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-a45228e7.js';
|
|
7
7
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
8
8
|
import { h as handleFetch, s as sendErrorLog } from './handleFetch-0133265e.js';
|
|
9
9
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
@@ -1286,10 +1286,13 @@ const ZonosCheckoutFinish = class {
|
|
|
1286
1286
|
this.getPullOrder = async (attempts = 0) => {
|
|
1287
1287
|
var _a, _b;
|
|
1288
1288
|
const { baseUrl, order } = await this.pullOrder();
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1291
|
-
if ((order &&
|
|
1292
|
-
|
|
1289
|
+
const { isLegacyCheckout } = window.Zonos;
|
|
1290
|
+
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);
|
|
1291
|
+
if ((order && !isLegacyCheckout) ||
|
|
1292
|
+
(!order && attempts >= 5) ||
|
|
1293
|
+
foundLegacyOrderNumber) {
|
|
1294
|
+
if (isLegacyCheckout && !foundLegacyOrderNumber) {
|
|
1295
|
+
// We pushed this one through without the legacy order number, so we should log this
|
|
1293
1296
|
const checkoutSessionId = cartStore.checkoutSessionId;
|
|
1294
1297
|
void sendErrorLog({
|
|
1295
1298
|
endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
|
|
@@ -1306,7 +1309,7 @@ const ZonosCheckoutFinish = class {
|
|
|
1306
1309
|
this.order = order;
|
|
1307
1310
|
this.handleSuccessBehavior();
|
|
1308
1311
|
}
|
|
1309
|
-
else if ((!order || !
|
|
1312
|
+
else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
|
|
1310
1313
|
// Wait for 1 second before the next attempt
|
|
1311
1314
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1312
1315
|
await this.getPullOrder(attempts + 1);
|
|
@@ -1442,11 +1445,11 @@ const ZonosCheckoutFinish = class {
|
|
|
1442
1445
|
var _a, _b;
|
|
1443
1446
|
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);
|
|
1444
1447
|
const isTestMode = getIsTestMode();
|
|
1445
|
-
return (h(Host, { key: '
|
|
1448
|
+
return (h(Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
|
|
1446
1449
|
'--border-radius': getBorderRadius({
|
|
1447
1450
|
overrideBorderStyle: this.borderRadius,
|
|
1448
1451
|
}),
|
|
1449
|
-
} }, this.isLoading && (h("div", { key: '
|
|
1452
|
+
} }, 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")))))));
|
|
1450
1453
|
}
|
|
1451
1454
|
static get assetsDirs() { return ["assets"]; }
|
|
1452
1455
|
};
|