@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
|
@@ -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
|
|
@@ -226,12 +227,6 @@ export class ZonosCheckout {
|
|
|
226
227
|
catch (err) {
|
|
227
228
|
// stop loading
|
|
228
229
|
stripeStore.isFetchingSession = false;
|
|
229
|
-
cartStoreUpdateToErrorState({
|
|
230
|
-
messages: [
|
|
231
|
-
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
232
|
-
],
|
|
233
|
-
title: translate('Error creating Checkout'),
|
|
234
|
-
});
|
|
235
230
|
// We want to log the error anytime we fail to create a checkout session
|
|
236
231
|
void sendErrorLog({
|
|
237
232
|
endpoint: 'Error creating Checkout',
|
|
@@ -243,6 +238,12 @@ export class ZonosCheckout {
|
|
|
243
238
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
244
239
|
},
|
|
245
240
|
});
|
|
241
|
+
cartStoreUpdateToErrorState({
|
|
242
|
+
messages: [
|
|
243
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
244
|
+
],
|
|
245
|
+
title: translate('Error creating Checkout'),
|
|
246
|
+
});
|
|
246
247
|
}
|
|
247
248
|
}, {
|
|
248
249
|
// Trigger this event before any other event
|
|
@@ -281,40 +282,50 @@ export class ZonosCheckout {
|
|
|
281
282
|
*/
|
|
282
283
|
useLegacyQueryParams() {
|
|
283
284
|
const urlParams = new URLSearchParams(window.location.search);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
customerEmail: urlParams.get('customerEmail'),
|
|
292
|
-
customerName: urlParams.get('customerName'),
|
|
293
|
-
customerPhone: urlParams.get('customerPhone'),
|
|
294
|
-
customerState: urlParams.get('customerState'),
|
|
295
|
-
customerZip: urlParams.get('customerZip'),
|
|
285
|
+
log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
|
|
286
|
+
const getParam = (param) => {
|
|
287
|
+
const value = urlParams.get(param);
|
|
288
|
+
if (!value || value === 'undefined') {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
return value;
|
|
296
292
|
};
|
|
293
|
+
const country =
|
|
294
|
+
// fallback to selected country code if country is not provided
|
|
295
|
+
getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode;
|
|
296
|
+
const city = getParam('customerCity');
|
|
297
|
+
const email = getParam('customerEmail') || '';
|
|
298
|
+
const line1 = getParam('customerAddress1');
|
|
299
|
+
const line2 = getParam('customerAddress2') || '';
|
|
300
|
+
const name = getParam('customerName');
|
|
301
|
+
const phone = getParam('customerPhone');
|
|
302
|
+
const postal_code = getParam('customerZip') || '';
|
|
303
|
+
const state = getParam('customerState') || '';
|
|
297
304
|
// if one of the value is null, no need to preset the default address
|
|
298
|
-
if (!
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
305
|
+
if (!line1 || !city || !name || !phone || !country) {
|
|
306
|
+
log('Missing required query params so it can not be prefilled', 'info', [
|
|
307
|
+
!line1 && 'line1',
|
|
308
|
+
!city && 'city',
|
|
309
|
+
!name && 'name',
|
|
310
|
+
!phone && 'phone',
|
|
311
|
+
!country && 'country',
|
|
312
|
+
]
|
|
313
|
+
.filter(Boolean)
|
|
314
|
+
.join(', '));
|
|
304
315
|
return;
|
|
305
316
|
}
|
|
306
317
|
this.defaultAddress = {
|
|
307
318
|
address: {
|
|
308
|
-
city
|
|
309
|
-
country
|
|
310
|
-
line1
|
|
311
|
-
line2
|
|
312
|
-
postal_code
|
|
313
|
-
state
|
|
319
|
+
city,
|
|
320
|
+
country,
|
|
321
|
+
line1,
|
|
322
|
+
line2,
|
|
323
|
+
postal_code,
|
|
324
|
+
state,
|
|
314
325
|
},
|
|
315
|
-
email
|
|
316
|
-
name
|
|
317
|
-
phone
|
|
326
|
+
email,
|
|
327
|
+
name,
|
|
328
|
+
phone,
|
|
318
329
|
};
|
|
319
330
|
}
|
|
320
331
|
/**
|
|
@@ -197,13 +197,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
197
197
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
198
198
|
});
|
|
199
199
|
if (errors.length > 0 || !json) {
|
|
200
|
-
// do nothing if we can't get checkout session
|
|
201
200
|
logError('Error occurs when updating checkout session.');
|
|
202
201
|
if (shouldInitSessionOnFailure) {
|
|
203
202
|
log('Initiating checkout session on failure', 'info');
|
|
204
203
|
const success = await stripeStoreInitCheckoutSession();
|
|
205
204
|
log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
206
205
|
if (!success) {
|
|
206
|
+
cartStoreUpdateToErrorState({
|
|
207
|
+
messages: [
|
|
208
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
209
|
+
],
|
|
210
|
+
title: translate('Error creating Checkout'),
|
|
211
|
+
});
|
|
207
212
|
return false;
|
|
208
213
|
}
|
|
209
214
|
return true;
|
|
@@ -411,8 +411,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
411
411
|
const stripeStoreInitCheckoutSession = async () => {
|
|
412
412
|
var _a, _b;
|
|
413
413
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
414
|
-
if (!
|
|
415
|
-
logError(
|
|
414
|
+
if (!localizationStore.targetCurrency) {
|
|
415
|
+
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
if (!total) {
|
|
419
|
+
logError(`Failed to create checkout session - missing total amount of items`);
|
|
416
420
|
return false;
|
|
417
421
|
}
|
|
418
422
|
stripeStore.isFetchingSession = true;
|
|
@@ -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
|
};
|
|
@@ -53,7 +53,7 @@ export const log = (message, type, ..._additionalInfo) => {
|
|
|
53
53
|
loggingIframe.style.visibility = 'hidden';
|
|
54
54
|
document.body.appendChild(loggingIframe);
|
|
55
55
|
}
|
|
56
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
56
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
57
57
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
58
58
|
switch (type) {
|
|
59
59
|
case 'warn':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handleFetch, l as log, a as logError } from './handleFetch-
|
|
1
|
+
import { h as handleFetch, l as log, a as logError } from './handleFetch-ce924688.js';
|
|
2
2
|
|
|
3
3
|
const getTempCartById = async (cartId) => {
|
|
4
4
|
const { errors, json } = await handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createStore, z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
2
|
-
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-
|
|
2
|
+
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-ce924688.js';
|
|
3
3
|
import { i as isDarkColor } from './isDarkColor-b3afa948.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
5
5
|
|
|
@@ -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
|
|
|
@@ -9472,8 +9484,12 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
9472
9484
|
const stripeStoreInitCheckoutSession = async () => {
|
|
9473
9485
|
var _a, _b;
|
|
9474
9486
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
9475
|
-
if (!
|
|
9476
|
-
logError(
|
|
9487
|
+
if (!localizationStore.targetCurrency) {
|
|
9488
|
+
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
9489
|
+
return false;
|
|
9490
|
+
}
|
|
9491
|
+
if (!total) {
|
|
9492
|
+
logError(`Failed to create checkout session - missing total amount of items`);
|
|
9477
9493
|
return false;
|
|
9478
9494
|
}
|
|
9479
9495
|
stripeStore.isFetchingSession = true;
|
|
@@ -9851,13 +9867,18 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
9851
9867
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
9852
9868
|
});
|
|
9853
9869
|
if (errors.length > 0 || !json) {
|
|
9854
|
-
// do nothing if we can't get checkout session
|
|
9855
9870
|
logError('Error occurs when updating checkout session.');
|
|
9856
9871
|
if (shouldInitSessionOnFailure) {
|
|
9857
9872
|
log('Initiating checkout session on failure', 'info');
|
|
9858
9873
|
const success = await stripeStoreInitCheckoutSession();
|
|
9859
9874
|
log(`stripeStoreInitCheckoutSession: ${success}`);
|
|
9860
9875
|
if (!success) {
|
|
9876
|
+
cartStoreUpdateToErrorState({
|
|
9877
|
+
messages: [
|
|
9878
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
9879
|
+
],
|
|
9880
|
+
title: translate('Error creating Checkout'),
|
|
9881
|
+
});
|
|
9861
9882
|
return false;
|
|
9862
9883
|
}
|
|
9863
9884
|
return true;
|
|
@@ -10028,4 +10049,4 @@ const cartStoreResetTabItems = () => {
|
|
|
10028
10049
|
cartStoreResetSelectedShippingOption();
|
|
10029
10050
|
};
|
|
10030
10051
|
|
|
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,
|
|
10052
|
+
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,6 +1,6 @@
|
|
|
1
|
-
import { d as cartStore, l as localizationStore } from './cart-
|
|
1
|
+
import { d as cartStore, l as localizationStore } from './cart-ef2e2eec.js';
|
|
2
2
|
import { z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
3
|
-
import { h as handleFetch } from './handleFetch-
|
|
3
|
+
import { h as handleFetch } from './handleFetch-ce924688.js';
|
|
4
4
|
|
|
5
5
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
6
6
|
var _a, _b;
|
|
@@ -53,7 +53,7 @@ const log = (message, type, ..._additionalInfo) => {
|
|
|
53
53
|
loggingIframe.style.visibility = 'hidden';
|
|
54
54
|
document.body.appendChild(loggingIframe);
|
|
55
55
|
}
|
|
56
|
-
// use the logging iframe's console to log just in case the console is disabled (
|
|
56
|
+
// use the logging iframe's console to log just in case the console is disabled (overridden) by the site owner
|
|
57
57
|
const zConsole = ((_b = loggingIframe.contentWindow) === null || _b === void 0 ? void 0 : _b.window.console) || window.console;
|
|
58
58
|
switch (type) {
|
|
59
59
|
case 'warn':
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as log, a as logError } from './handleFetch-
|
|
2
|
-
import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-
|
|
3
|
-
export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-
|
|
1
|
+
import { l as log, a as logError } from './handleFetch-ce924688.js';
|
|
2
|
+
import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-c54d23b8.js';
|
|
3
|
+
export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-c54d23b8.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Get the load version and url based on the loadScriptSrc and version
|
|
@@ -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.93.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.93.js.zonos.com";
|
|
282
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.93";
|
|
283
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.93";
|
|
284
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.93";
|
|
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 = "1729003957102";
|
|
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.93"}`;
|
|
308
308
|
Zonos.modeAlerted = false;
|
|
309
309
|
Zonos.cartData = null;
|
|
310
310
|
Zonos.paypal = null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z as zonosStore, c as createStore } from './zonosStore-0dc7a947.js';
|
|
2
|
-
import { d as cartStore,
|
|
3
|
-
import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-
|
|
2
|
+
import { d as cartStore, u as stripeStoreHandleInventoryCheck, t as translate, r as cartStoreNextStep, h as cartStoreClearCheckoutInterval } from './cart-ef2e2eec.js';
|
|
3
|
+
import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-ce924688.js';
|
|
4
4
|
import { t as tinycolor } from './isDarkColor-b3afa948.js';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
@@ -1,7 +1,7 @@
|
|
|
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-ef2e2eec.js';
|
|
3
3
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
4
|
-
import { a as logError, l as log } from './handleFetch-
|
|
4
|
+
import { a as logError, l as log } from './handleFetch-ce924688.js';
|
|
5
5
|
import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
|
|
6
6
|
import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
|
|
7
7
|
import { c as classes } from './classes-0d95c529.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
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-ef2e2eec.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-cce03d02.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-73760da0.js';
|
|
7
7
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
8
|
-
import { h as handleFetch, s as sendErrorLog } from './handleFetch-
|
|
8
|
+
import { h as handleFetch, s as sendErrorLog } from './handleFetch-ce924688.js';
|
|
9
9
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
10
10
|
import { l as languages } from './ILanguage-cd6acb72.js';
|
|
11
11
|
import { i as isDarkColor, t as tinycolor } from './isDarkColor-b3afa948.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
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, F as Fragment } from './index-86b8247e.js';
|
|
2
|
-
import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as cartStore, e as cartStoreUpdateItems, f as cartStoreReset, g as cartStoreResetTabItems, h as cartStoreClearCheckoutInterval, j as stripeStore, k as stripeStoreInitCheckoutSession, m as cartStoreStartCheckoutInterval, n as cartStoreUpdateToErrorState, t as translate, o as
|
|
3
|
-
import { s as submitGtag, p as paypalInitScript } from './paypal-
|
|
2
|
+
import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as cartStore, e as cartStoreUpdateItems, f as cartStoreReset, g as cartStoreResetTabItems, h as cartStoreClearCheckoutInterval, j as stripeStore, k as stripeStoreInitCheckoutSession, m as cartStoreStartCheckoutInterval, n as cartStoreUpdateToErrorState, t as translate, o as getZCountryUrlParam, p as cartStoreSetCheckoutSession, q as stripeStorePrefetchLandedCost, r as cartStoreNextStep, u as stripeStoreHandleInventoryCheck, v as stripeStoreConfirmPayment, w as stripeStoreReset, x as localizationStoreOnUpdate } from './cart-ef2e2eec.js';
|
|
3
|
+
import { s as submitGtag, p as paypalInitScript } from './paypal-cce03d02.js';
|
|
4
4
|
import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-0dc7a947.js';
|
|
5
|
-
import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-
|
|
5
|
+
import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-73760da0.js';
|
|
6
6
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
7
|
-
import { l as log, a as logError, s as sendErrorLog, b as allLogs } from './handleFetch-
|
|
7
|
+
import { l as log, a as logError, s as sendErrorLog, b as allLogs } from './handleFetch-ce924688.js';
|
|
8
8
|
import { c as classes } from './classes-0d95c529.js';
|
|
9
9
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
10
10
|
import { i as isDarkColor } from './isDarkColor-b3afa948.js';
|
|
11
|
-
import { s as setupCartData, d as domesticRedirectedBtnSelector, c as checkoutHiddenBtnSelector } from './CheckoutConfig-
|
|
11
|
+
import { s as setupCartData, d as domesticRedirectedBtnSelector, c as checkoutHiddenBtnSelector } from './CheckoutConfig-c54d23b8.js';
|
|
12
12
|
import { R as RemoveIcon } from './RemoveIcon-9dc5dd1a.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -376,12 +376,6 @@ const ZonosCheckout = class {
|
|
|
376
376
|
catch (err) {
|
|
377
377
|
// stop loading
|
|
378
378
|
stripeStore.isFetchingSession = false;
|
|
379
|
-
cartStoreUpdateToErrorState({
|
|
380
|
-
messages: [
|
|
381
|
-
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
382
|
-
],
|
|
383
|
-
title: translate('Error creating Checkout'),
|
|
384
|
-
});
|
|
385
379
|
// We want to log the error anytime we fail to create a checkout session
|
|
386
380
|
void sendErrorLog({
|
|
387
381
|
endpoint: 'Error creating Checkout',
|
|
@@ -393,6 +387,12 @@ const ZonosCheckout = class {
|
|
|
393
387
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
394
388
|
},
|
|
395
389
|
});
|
|
390
|
+
cartStoreUpdateToErrorState({
|
|
391
|
+
messages: [
|
|
392
|
+
translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
|
|
393
|
+
],
|
|
394
|
+
title: translate('Error creating Checkout'),
|
|
395
|
+
});
|
|
396
396
|
}
|
|
397
397
|
}, {
|
|
398
398
|
// Trigger this event before any other event
|
|
@@ -431,40 +431,50 @@ const ZonosCheckout = class {
|
|
|
431
431
|
*/
|
|
432
432
|
useLegacyQueryParams() {
|
|
433
433
|
const urlParams = new URLSearchParams(window.location.search);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
customerEmail: urlParams.get('customerEmail'),
|
|
442
|
-
customerName: urlParams.get('customerName'),
|
|
443
|
-
customerPhone: urlParams.get('customerPhone'),
|
|
444
|
-
customerState: urlParams.get('customerState'),
|
|
445
|
-
customerZip: urlParams.get('customerZip'),
|
|
434
|
+
log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
|
|
435
|
+
const getParam = (param) => {
|
|
436
|
+
const value = urlParams.get(param);
|
|
437
|
+
if (!value || value === 'undefined') {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
return value;
|
|
446
441
|
};
|
|
442
|
+
const country =
|
|
443
|
+
// fallback to selected country code if country is not provided
|
|
444
|
+
getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode;
|
|
445
|
+
const city = getParam('customerCity');
|
|
446
|
+
const email = getParam('customerEmail') || '';
|
|
447
|
+
const line1 = getParam('customerAddress1');
|
|
448
|
+
const line2 = getParam('customerAddress2') || '';
|
|
449
|
+
const name = getParam('customerName');
|
|
450
|
+
const phone = getParam('customerPhone');
|
|
451
|
+
const postal_code = getParam('customerZip') || '';
|
|
452
|
+
const state = getParam('customerState') || '';
|
|
447
453
|
// if one of the value is null, no need to preset the default address
|
|
448
|
-
if (!
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
+
if (!line1 || !city || !name || !phone || !country) {
|
|
455
|
+
log('Missing required query params so it can not be prefilled', 'info', [
|
|
456
|
+
!line1 && 'line1',
|
|
457
|
+
!city && 'city',
|
|
458
|
+
!name && 'name',
|
|
459
|
+
!phone && 'phone',
|
|
460
|
+
!country && 'country',
|
|
461
|
+
]
|
|
462
|
+
.filter(Boolean)
|
|
463
|
+
.join(', '));
|
|
454
464
|
return;
|
|
455
465
|
}
|
|
456
466
|
this.defaultAddress = {
|
|
457
467
|
address: {
|
|
458
|
-
city
|
|
459
|
-
country
|
|
460
|
-
line1
|
|
461
|
-
line2
|
|
462
|
-
postal_code
|
|
463
|
-
state
|
|
468
|
+
city,
|
|
469
|
+
country,
|
|
470
|
+
line1,
|
|
471
|
+
line2,
|
|
472
|
+
postal_code,
|
|
473
|
+
state,
|
|
464
474
|
},
|
|
465
|
-
email
|
|
466
|
-
name
|
|
467
|
-
phone
|
|
475
|
+
email,
|
|
476
|
+
name,
|
|
477
|
+
phone,
|
|
468
478
|
};
|
|
469
479
|
}
|
|
470
480
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-86b8247e.js';
|
|
2
|
-
import {
|
|
2
|
+
import { y as isValidSelector, j as stripeStore, z as initLocalizationStore, d as cartStore, a as localizationStoreUpdateSelectedCountryCode } from './cart-ef2e2eec.js';
|
|
3
3
|
import { z as zonosStore, b as zonosStoreInitSetting, d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
|
|
4
|
-
import { h as handleFetch, a as logError, l as log } from './handleFetch-
|
|
4
|
+
import { h as handleFetch, a as logError, l as log } from './handleFetch-ce924688.js';
|
|
5
5
|
import './isDarkColor-b3afa948.js';
|
|
6
6
|
import './getBorderRadius-cff1e39b.js';
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-86b8247e.js';
|
|
2
|
-
import { l as localizationStore } from './cart-
|
|
2
|
+
import { l as localizationStore } from './cart-ef2e2eec.js';
|
|
3
3
|
import { d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
|
-
import './handleFetch-
|
|
5
|
+
import './handleFetch-ce924688.js';
|
|
6
6
|
import './isDarkColor-b3afa948.js';
|
|
7
7
|
import './getBorderRadius-cff1e39b.js';
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-86b8247e.js';
|
|
2
|
-
import { a as localizationStoreUpdateSelectedCountryCode, t as translate, l as localizationStore } from './cart-
|
|
2
|
+
import { a as localizationStoreUpdateSelectedCountryCode, t as translate, l as localizationStore } from './cart-ef2e2eec.js';
|
|
3
3
|
import { d as zonosStoreFontFamily } from './zonosStore-0dc7a947.js';
|
|
4
4
|
import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
|
|
5
5
|
import { i as isDarkColor } from './isDarkColor-b3afa948.js';
|
|
6
6
|
import { l as languages } from './ILanguage-cd6acb72.js';
|
|
7
|
-
import './handleFetch-
|
|
7
|
+
import './handleFetch-ce924688.js';
|
|
8
8
|
import './getBorderRadius-cff1e39b.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-86b8247e.js';
|
|
2
|
-
import { t as translate, l as localizationStore, E as currencyFormat } from './cart-
|
|
2
|
+
import { t as translate, l as localizationStore, E as currencyFormat } from './cart-ef2e2eec.js';
|
|
3
3
|
import { z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
|
|
6
6
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
|
|
7
|
-
import './handleFetch-
|
|
7
|
+
import './handleFetch-ce924688.js';
|
|
8
8
|
import './isDarkColor-b3afa948.js';
|
|
9
9
|
import './getBorderRadius-cff1e39b.js';
|
|
10
10
|
|