@zonos/elements 1.3.195 → 1.3.197
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-bc882927.js → cart-2e3968e9.js} +7 -2
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-608fa681.js → paypal-b5c80f16.js} +1 -1
- package/dist/cjs/zonos-address_11.cjs.entry.js +9 -9
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
- package/dist/cjs/zonos-checkout.cjs.entry.js +9 -44
- 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-empty-state-payment_4.cjs.entry.js +2 -2
- 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/collection/components/checkout/zonos-checkout/zonos-checkout.js +7 -42
- package/dist/collection/components/store/checkout/stripe.js +7 -2
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +8 -8
- package/dist/esm/{cart-2f0ee51d.js → cart-006b6633.js} +7 -2
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-3ecdf234.js → paypal-86483f34.js} +1 -1
- package/dist/esm/zonos-address_11.entry.js +9 -9
- package/dist/esm/zonos-cart-items_13.entry.js +2 -2
- package/dist/esm/zonos-checkout.entry.js +9 -44
- 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-empty-state-payment_4.entry.js +2 -2
- 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-es5/{cart-2f0ee51d.js → cart-006b6633.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-3ecdf234.js → paypal-86483f34.js} +1 -1
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.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-empty-state-payment_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/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -4
- package/dist/types/types/generated/graphql.internal.types.d.ts +8 -0
- package/dist/types/types/generated/graphql.internal.types.ts +8 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-39e369f6.system.entry.js → p-06547c8c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3e15061e.system.entry.js → p-0d5fe109.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-34b5ae9c.system.js → p-0f94e320.system.js} +1 -1
- package/dist/zonos-elements/{p-4931d780.entry.js → p-1383ab6b.entry.js} +1 -1
- package/dist/zonos-elements/{p-127deab4.system.entry.js → p-2abcaaa1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-de73fec0.system.js → p-3bcf2091.system.js} +1 -1
- package/dist/zonos-elements/p-3febb54a.entry.js +1 -0
- package/dist/zonos-elements/{p-139566b2.system.entry.js → p-49e78ccc.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5d7c9ac3.entry.js → p-4e11db81.entry.js} +1 -1
- package/dist/zonos-elements/{p-2f34e29a.js → p-63bfe67c.js} +1 -1
- package/dist/zonos-elements/{p-0fe6efef.system.entry.js → p-76468d91.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-649d3e92.entry.js → p-7b1e8a42.entry.js} +1 -1
- package/dist/zonos-elements/{p-9e27aaff.system.entry.js → p-81bf423c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e275d241.entry.js → p-8558486d.entry.js} +1 -1
- package/dist/zonos-elements/{p-dc1b3bcb.entry.js → p-9350f23a.entry.js} +1 -1
- package/dist/zonos-elements/{p-8df9a41b.entry.js → p-a35aab84.entry.js} +1 -1
- package/dist/zonos-elements/{p-c7f0941d.system.entry.js → p-b1970c2c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f8253ae4.system.entry.js → p-bde07ab8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6ccb1b13.entry.js → p-c1173557.entry.js} +1 -1
- package/dist/zonos-elements/{p-6a31eb14.system.js → p-c69c3219.system.js} +1 -1
- package/dist/zonos-elements/p-cd86baf3.entry.js +1 -0
- package/dist/zonos-elements/{p-4abc1b34.system.entry.js → p-d319e084.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-23752a7e.entry.js → p-ddbeb2ec.entry.js} +1 -1
- package/dist/zonos-elements/{p-fccf8c66.system.entry.js → p-e5d4705e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
- package/dist/zonos-elements/{p-264e7688.js → p-f57b0170.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-6b2358f2.entry.js +0 -1
- package/dist/zonos-elements/p-76d8844b.entry.js +0 -1
|
@@ -14932,7 +14932,7 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
14932
14932
|
* @returns {boolean} whether or not the checkout session is successfully created
|
|
14933
14933
|
*/
|
|
14934
14934
|
const stripeStoreInitCheckoutSession = async () => {
|
|
14935
|
-
var _a;
|
|
14935
|
+
var _a, _b;
|
|
14936
14936
|
if (!localizationStore.targetCurrency) {
|
|
14937
14937
|
handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
14938
14938
|
return false;
|
|
@@ -14946,6 +14946,11 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
14946
14946
|
});
|
|
14947
14947
|
stripeStore.isFetchingSession = false;
|
|
14948
14948
|
if (errors.length || !json) {
|
|
14949
|
+
const messages = (_a = errors.find(error => error.message)) === null || _a === void 0 ? void 0 : _a.message;
|
|
14950
|
+
// check if the error is related to expired cart and thow error so we can show error message accordingly
|
|
14951
|
+
if (messages.some(message => message.message === 'Cart is expired.')) {
|
|
14952
|
+
throw new Error('Cart is expired.');
|
|
14953
|
+
}
|
|
14949
14954
|
handleFetch.logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
14950
14955
|
return false;
|
|
14951
14956
|
}
|
|
@@ -14953,7 +14958,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
14953
14958
|
// update cart store with updated information
|
|
14954
14959
|
cartStoreSetCheckoutSession(result);
|
|
14955
14960
|
cartStoreApplySubtotals({
|
|
14956
|
-
method: ((
|
|
14961
|
+
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
14957
14962
|
subtotals: result.subtotals,
|
|
14958
14963
|
});
|
|
14959
14964
|
handleFetch.log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -131,7 +131,7 @@ const getZonosQaUrl = () => {
|
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
134
|
-
const cdnUrl = "https://v1.3.
|
|
134
|
+
const cdnUrl = "https://v1.3.197.js.zonos.com";
|
|
135
135
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
136
136
|
if (!qaUrl &&
|
|
137
137
|
(cdnUrl.includes('test.') ||
|
|
@@ -372,10 +372,10 @@ const zonosLoadUrl = (() => {
|
|
|
372
372
|
}
|
|
373
373
|
return null;
|
|
374
374
|
})();
|
|
375
|
-
const ZONOS_URL = "https://v1.3.
|
|
376
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
377
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
378
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
375
|
+
const ZONOS_URL = "https://v1.3.197.js.zonos.com";
|
|
376
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.197";
|
|
377
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.197";
|
|
378
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.197";
|
|
379
379
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
380
380
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
381
381
|
class Zonos {
|
|
@@ -393,7 +393,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
393
393
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
394
394
|
: null;
|
|
395
395
|
Zonos.isBigCommerce = false;
|
|
396
|
-
Zonos.releaseDate = "
|
|
396
|
+
Zonos.releaseDate = "1746814027789";
|
|
397
397
|
Zonos.isLegacyCheckout = false;
|
|
398
398
|
Zonos.domain = typeof window !== 'undefined'
|
|
399
399
|
? // domain that embeds the iframe
|
|
@@ -411,7 +411,7 @@ Zonos.isNpm = true;
|
|
|
411
411
|
Zonos.zonosQaUrl = null;
|
|
412
412
|
Zonos.zonosQaUrlApi = null;
|
|
413
413
|
Zonos.trackEventLogs = [];
|
|
414
|
-
Zonos.version = `v${"1.3.
|
|
414
|
+
Zonos.version = `v${"1.3.197"}`;
|
|
415
415
|
Zonos.modeAlerted = false;
|
|
416
416
|
Zonos.cartData = null;
|
|
417
417
|
Zonos.paypal = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
4
|
-
const cart = require('./cart-
|
|
4
|
+
const cart = require('./cart-2e3968e9.js');
|
|
5
5
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-92a10a85.js');
|
|
7
7
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
9
9
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
@@ -139,15 +139,15 @@ const ZonosAddress$1 = class {
|
|
|
139
139
|
const eventValue = event.value;
|
|
140
140
|
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
141
141
|
this.isDirtyAddress = true;
|
|
142
|
+
if (!this.isAutoCompleteAdjusted) {
|
|
143
|
+
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
144
|
+
if (googleAutoComplete) {
|
|
145
|
+
googleAutoComplete.style.zIndex = '3';
|
|
146
|
+
}
|
|
147
|
+
this.isAutoCompleteAdjusted = true;
|
|
148
|
+
}
|
|
142
149
|
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
143
150
|
setTimeout(() => {
|
|
144
|
-
if (!this.isAutoCompleteAdjusted) {
|
|
145
|
-
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
146
|
-
if (googleAutoComplete) {
|
|
147
|
-
googleAutoComplete.style.zIndex = '2';
|
|
148
|
-
}
|
|
149
|
-
this.isAutoCompleteAdjusted = true;
|
|
150
|
-
}
|
|
151
151
|
// scroll directly into view if it's mobile
|
|
152
152
|
if (handleFetch.isCheckoutMobile()) {
|
|
153
153
|
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
@@ -263,7 +263,7 @@ const ZonosAddress$1 = class {
|
|
|
263
263
|
this.isAddressFilled = true;
|
|
264
264
|
}
|
|
265
265
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
266
|
-
return (index.h(index.Host, { key: '
|
|
266
|
+
return (index.h(index.Host, { key: 'ebd6b34dfcb486e1746fbc306e2e413d03290d50', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: '68e7f0fa37ca7efd4d833b32d4c27cda29521871', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), index.h("div", { key: '5e6d4b3798c91def3f3a6ae5ac12f1a2ccca272b', class: "zonos--address-component" })));
|
|
267
267
|
}
|
|
268
268
|
get el() { return index.getElement(this); }
|
|
269
269
|
static get watchers() { return {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-b5c80f16.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
11
11
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
|
+
const paypal = require('./paypal-b5c80f16.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
10
10
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -335,35 +335,6 @@ const ZonosCheckout = class {
|
|
|
335
335
|
paypalEnabled: paypal.paypalStoreHasPaypalEnabled(),
|
|
336
336
|
});
|
|
337
337
|
};
|
|
338
|
-
/**
|
|
339
|
-
* Check if the cart is expired, return `true` if the cart is expired
|
|
340
|
-
*/
|
|
341
|
-
this.handleCartExpiredCheck = () => {
|
|
342
|
-
var _a;
|
|
343
|
-
// don't check for cart expiration if the cart is in test mode
|
|
344
|
-
if (handleFetch.getIsTestMode()) {
|
|
345
|
-
handleFetch.log('Not checking for cart expiration in test mode');
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
// Do nothing if no cart data or cart expiration is not set
|
|
349
|
-
if (!zonosStore.zonosStore.checkoutSettings.defaultCartExpiration ||
|
|
350
|
-
!((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.createdAt)) {
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
const cartCreatedAt = new Date(window.Zonos.cartData.createdAt).getTime();
|
|
354
|
-
const currentTime = new Date().getTime();
|
|
355
|
-
const timeDiff = currentTime - cartCreatedAt;
|
|
356
|
-
const timeDiffInSeconds = Math.floor(timeDiff / 1000);
|
|
357
|
-
handleFetch.log(`currentTime: ${currentTime} | cartCreatedAt: ${cartCreatedAt}`);
|
|
358
|
-
handleFetch.log(`Cart has been created for ${timeDiffInSeconds / 60} minutes`);
|
|
359
|
-
if (zonosStore.zonosStore.checkoutSettings.defaultCartExpiration) {
|
|
360
|
-
if (timeDiffInSeconds > zonosStore.zonosStore.checkoutSettings.defaultCartExpiration) {
|
|
361
|
-
this.isCartExpired = true;
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return false;
|
|
366
|
-
};
|
|
367
338
|
/**
|
|
368
339
|
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
369
340
|
*/
|
|
@@ -571,22 +542,12 @@ const ZonosCheckout = class {
|
|
|
571
542
|
return false;
|
|
572
543
|
}
|
|
573
544
|
window.Zonos.cartData = cartData;
|
|
574
|
-
const isExpired = this.handleCartExpiredCheck();
|
|
575
|
-
if (isExpired) {
|
|
576
|
-
// Do not proceed if the cart is expired
|
|
577
|
-
return false;
|
|
578
|
-
}
|
|
579
545
|
const { adjustments, cartItems } = buildCartItemsByTempCart(cartData);
|
|
580
546
|
await cart.cartStoreUpdateItems({ adjustments, cartItems });
|
|
581
547
|
}
|
|
582
548
|
// if tempCartUUID is provided, use it instead of buildCartDetail
|
|
583
549
|
else if (window.Zonos.cartData) {
|
|
584
550
|
handleFetch.log('tempCartUUID is provided, start building cart');
|
|
585
|
-
const isExpired = this.handleCartExpiredCheck();
|
|
586
|
-
if (isExpired) {
|
|
587
|
-
// Do not proceed if the cart is expired
|
|
588
|
-
return false;
|
|
589
|
-
}
|
|
590
551
|
const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
|
|
591
552
|
await cart.cartStoreUpdateItems({ adjustments, cartItems });
|
|
592
553
|
}
|
|
@@ -777,9 +738,6 @@ const ZonosCheckout = class {
|
|
|
777
738
|
try {
|
|
778
739
|
// buildCartDetail may throw an error
|
|
779
740
|
const result = await this.buildCartAndInit();
|
|
780
|
-
if (this.isCartExpired) {
|
|
781
|
-
throw new Error('This shopping cart is expired');
|
|
782
|
-
}
|
|
783
741
|
if (!result) {
|
|
784
742
|
throw new Error('Error building cart');
|
|
785
743
|
}
|
|
@@ -808,6 +766,13 @@ const ZonosCheckout = class {
|
|
|
808
766
|
}
|
|
809
767
|
}
|
|
810
768
|
catch (err) {
|
|
769
|
+
if (err instanceof Error) {
|
|
770
|
+
const message = err.message;
|
|
771
|
+
if (message === 'Cart is expired.') {
|
|
772
|
+
this.isCartExpired = true;
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
811
776
|
// stop loading
|
|
812
777
|
cart.stripeStore.isFetchingSession = false;
|
|
813
778
|
handleFetch.logError(err);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
8
8
|
const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-92a10a85.js');
|
|
@@ -6,9 +6,9 @@ const index = require('./index-0993f42d.js');
|
|
|
6
6
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
const getBorderRadius = require('./getBorderRadius-3d0a563e.js');
|
|
9
|
-
const cart = require('./cart-
|
|
9
|
+
const cart = require('./cart-2e3968e9.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
11
|
-
const paypal = require('./paypal-
|
|
11
|
+
const paypal = require('./paypal-b5c80f16.js');
|
|
12
12
|
require('./isDarkColor-92a10a85.js');
|
|
13
13
|
|
|
14
14
|
const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.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-0993f42d.js');
|
|
6
6
|
const debounce = require('./debounce-d393fafe.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-2e3968e9.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
9
9
|
const classes = require('./classes-b7918f56.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-0993f42d.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-2e3968e9.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-c466b127.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-969d05d8.js');
|
|
@@ -61,35 +61,6 @@ export class ZonosCheckout {
|
|
|
61
61
|
paypalEnabled: paypalStoreHasPaypalEnabled(),
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Check if the cart is expired, return `true` if the cart is expired
|
|
66
|
-
*/
|
|
67
|
-
this.handleCartExpiredCheck = () => {
|
|
68
|
-
var _a;
|
|
69
|
-
// don't check for cart expiration if the cart is in test mode
|
|
70
|
-
if (getIsTestMode()) {
|
|
71
|
-
log('Not checking for cart expiration in test mode');
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
// Do nothing if no cart data or cart expiration is not set
|
|
75
|
-
if (!zonosStore.checkoutSettings.defaultCartExpiration ||
|
|
76
|
-
!((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.createdAt)) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
const cartCreatedAt = new Date(window.Zonos.cartData.createdAt).getTime();
|
|
80
|
-
const currentTime = new Date().getTime();
|
|
81
|
-
const timeDiff = currentTime - cartCreatedAt;
|
|
82
|
-
const timeDiffInSeconds = Math.floor(timeDiff / 1000);
|
|
83
|
-
log(`currentTime: ${currentTime} | cartCreatedAt: ${cartCreatedAt}`);
|
|
84
|
-
log(`Cart has been created for ${timeDiffInSeconds / 60} minutes`);
|
|
85
|
-
if (zonosStore.checkoutSettings.defaultCartExpiration) {
|
|
86
|
-
if (timeDiffInSeconds > zonosStore.checkoutSettings.defaultCartExpiration) {
|
|
87
|
-
this.isCartExpired = true;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
};
|
|
93
64
|
/**
|
|
94
65
|
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
95
66
|
*/
|
|
@@ -297,22 +268,12 @@ export class ZonosCheckout {
|
|
|
297
268
|
return false;
|
|
298
269
|
}
|
|
299
270
|
window.Zonos.cartData = cartData;
|
|
300
|
-
const isExpired = this.handleCartExpiredCheck();
|
|
301
|
-
if (isExpired) {
|
|
302
|
-
// Do not proceed if the cart is expired
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
271
|
const { adjustments, cartItems } = buildCartItemsByTempCart(cartData);
|
|
306
272
|
await cartStoreUpdateItems({ adjustments, cartItems });
|
|
307
273
|
}
|
|
308
274
|
// if tempCartUUID is provided, use it instead of buildCartDetail
|
|
309
275
|
else if (window.Zonos.cartData) {
|
|
310
276
|
log('tempCartUUID is provided, start building cart');
|
|
311
|
-
const isExpired = this.handleCartExpiredCheck();
|
|
312
|
-
if (isExpired) {
|
|
313
|
-
// Do not proceed if the cart is expired
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
277
|
const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
|
|
317
278
|
await cartStoreUpdateItems({ adjustments, cartItems });
|
|
318
279
|
}
|
|
@@ -503,9 +464,6 @@ export class ZonosCheckout {
|
|
|
503
464
|
try {
|
|
504
465
|
// buildCartDetail may throw an error
|
|
505
466
|
const result = await this.buildCartAndInit();
|
|
506
|
-
if (this.isCartExpired) {
|
|
507
|
-
throw new Error('This shopping cart is expired');
|
|
508
|
-
}
|
|
509
467
|
if (!result) {
|
|
510
468
|
throw new Error('Error building cart');
|
|
511
469
|
}
|
|
@@ -534,6 +492,13 @@ export class ZonosCheckout {
|
|
|
534
492
|
}
|
|
535
493
|
}
|
|
536
494
|
catch (err) {
|
|
495
|
+
if (err instanceof Error) {
|
|
496
|
+
const message = err.message;
|
|
497
|
+
if (message === 'Cart is expired.') {
|
|
498
|
+
this.isCartExpired = true;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
537
502
|
// stop loading
|
|
538
503
|
stripeStore.isFetchingSession = false;
|
|
539
504
|
logError(err);
|
|
@@ -657,7 +657,7 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
657
657
|
* @returns {boolean} whether or not the checkout session is successfully created
|
|
658
658
|
*/
|
|
659
659
|
const stripeStoreInitCheckoutSession = async () => {
|
|
660
|
-
var _a;
|
|
660
|
+
var _a, _b;
|
|
661
661
|
if (!localizationStore.targetCurrency) {
|
|
662
662
|
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
663
663
|
return false;
|
|
@@ -671,6 +671,11 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
671
671
|
});
|
|
672
672
|
stripeStore.isFetchingSession = false;
|
|
673
673
|
if (errors.length || !json) {
|
|
674
|
+
const messages = (_a = errors.find(error => error.message)) === null || _a === void 0 ? void 0 : _a.message;
|
|
675
|
+
// check if the error is related to expired cart and thow error so we can show error message accordingly
|
|
676
|
+
if (messages.some(message => message.message === 'Cart is expired.')) {
|
|
677
|
+
throw new Error('Cart is expired.');
|
|
678
|
+
}
|
|
674
679
|
logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
675
680
|
return false;
|
|
676
681
|
}
|
|
@@ -678,7 +683,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
678
683
|
// update cart store with updated information
|
|
679
684
|
cartStoreSetCheckoutSession(result);
|
|
680
685
|
cartStoreApplySubtotals({
|
|
681
|
-
method: ((
|
|
686
|
+
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
682
687
|
subtotals: result.subtotals,
|
|
683
688
|
});
|
|
684
689
|
log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
@@ -131,15 +131,15 @@ export class ZonosAddress {
|
|
|
131
131
|
const eventValue = event.value;
|
|
132
132
|
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
133
133
|
this.isDirtyAddress = true;
|
|
134
|
+
if (!this.isAutoCompleteAdjusted) {
|
|
135
|
+
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
136
|
+
if (googleAutoComplete) {
|
|
137
|
+
googleAutoComplete.style.zIndex = '3';
|
|
138
|
+
}
|
|
139
|
+
this.isAutoCompleteAdjusted = true;
|
|
140
|
+
}
|
|
134
141
|
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
135
142
|
setTimeout(() => {
|
|
136
|
-
if (!this.isAutoCompleteAdjusted) {
|
|
137
|
-
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
138
|
-
if (googleAutoComplete) {
|
|
139
|
-
googleAutoComplete.style.zIndex = '2';
|
|
140
|
-
}
|
|
141
|
-
this.isAutoCompleteAdjusted = true;
|
|
142
|
-
}
|
|
143
143
|
// scroll directly into view if it's mobile
|
|
144
144
|
if (isCheckoutMobile()) {
|
|
145
145
|
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
@@ -255,7 +255,7 @@ export class ZonosAddress {
|
|
|
255
255
|
this.isAddressFilled = true;
|
|
256
256
|
}
|
|
257
257
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
258
|
-
return (h(Host, { key: '
|
|
258
|
+
return (h(Host, { key: 'ebd6b34dfcb486e1746fbc306e2e413d03290d50', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '68e7f0fa37ca7efd4d833b32d4c27cda29521871', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '5e6d4b3798c91def3f3a6ae5ac12f1a2ccca272b', class: "zonos--address-component" })));
|
|
259
259
|
}
|
|
260
260
|
static get is() { return "zonos-address"; }
|
|
261
261
|
static get encapsulation() { return "scoped"; }
|
|
@@ -14930,7 +14930,7 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
14930
14930
|
* @returns {boolean} whether or not the checkout session is successfully created
|
|
14931
14931
|
*/
|
|
14932
14932
|
const stripeStoreInitCheckoutSession = async () => {
|
|
14933
|
-
var _a;
|
|
14933
|
+
var _a, _b;
|
|
14934
14934
|
if (!localizationStore.targetCurrency) {
|
|
14935
14935
|
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
14936
14936
|
return false;
|
|
@@ -14944,6 +14944,11 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
14944
14944
|
});
|
|
14945
14945
|
stripeStore.isFetchingSession = false;
|
|
14946
14946
|
if (errors.length || !json) {
|
|
14947
|
+
const messages = (_a = errors.find(error => error.message)) === null || _a === void 0 ? void 0 : _a.message;
|
|
14948
|
+
// check if the error is related to expired cart and thow error so we can show error message accordingly
|
|
14949
|
+
if (messages.some(message => message.message === 'Cart is expired.')) {
|
|
14950
|
+
throw new Error('Cart is expired.');
|
|
14951
|
+
}
|
|
14947
14952
|
logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
14948
14953
|
return false;
|
|
14949
14954
|
}
|
|
@@ -14951,7 +14956,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
14951
14956
|
// update cart store with updated information
|
|
14952
14957
|
cartStoreSetCheckoutSession(result);
|
|
14953
14958
|
cartStoreApplySubtotals({
|
|
14954
|
-
method: ((
|
|
14959
|
+
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
14955
14960
|
subtotals: result.subtotals,
|
|
14956
14961
|
});
|
|
14957
14962
|
log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
package/dist/esm/index.js
CHANGED
|
@@ -128,7 +128,7 @@ const getZonosQaUrl = () => {
|
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
131
|
-
const cdnUrl = "https://v1.3.
|
|
131
|
+
const cdnUrl = "https://v1.3.197.js.zonos.com";
|
|
132
132
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
133
133
|
if (!qaUrl &&
|
|
134
134
|
(cdnUrl.includes('test.') ||
|
|
@@ -369,10 +369,10 @@ const zonosLoadUrl = (() => {
|
|
|
369
369
|
}
|
|
370
370
|
return null;
|
|
371
371
|
})();
|
|
372
|
-
const ZONOS_URL = "https://v1.3.
|
|
373
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
374
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
375
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
372
|
+
const ZONOS_URL = "https://v1.3.197.js.zonos.com";
|
|
373
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.197";
|
|
374
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.197";
|
|
375
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.197";
|
|
376
376
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
377
377
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
378
378
|
class Zonos {
|
|
@@ -390,7 +390,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
390
390
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
391
391
|
: null;
|
|
392
392
|
Zonos.isBigCommerce = false;
|
|
393
|
-
Zonos.releaseDate = "
|
|
393
|
+
Zonos.releaseDate = "1746814027789";
|
|
394
394
|
Zonos.isLegacyCheckout = false;
|
|
395
395
|
Zonos.domain = typeof window !== 'undefined'
|
|
396
396
|
? // domain that embeds the iframe
|
|
@@ -408,7 +408,7 @@ Zonos.isNpm = true;
|
|
|
408
408
|
Zonos.zonosQaUrl = null;
|
|
409
409
|
Zonos.zonosQaUrlApi = null;
|
|
410
410
|
Zonos.trackEventLogs = [];
|
|
411
|
-
Zonos.version = `v${"1.3.
|
|
411
|
+
Zonos.version = `v${"1.3.197"}`;
|
|
412
412
|
Zonos.modeAlerted = false;
|
|
413
413
|
Zonos.cartData = null;
|
|
414
414
|
Zonos.paypal = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as zonosStore, c as createStore } from './zonosStore-cdabc848.js';
|
|
2
|
-
import { t as trackConversionEvent, F as validateCheckoutSession, f as stripeStore, e as cartStore, z as stripeStoreHandleInventoryCheck, r as translate, x as cartStoreNextStep, k as cartStoreClearCheckoutInterval } from './cart-
|
|
2
|
+
import { t as trackConversionEvent, F as validateCheckoutSession, f as stripeStore, e as cartStore, z as stripeStoreHandleInventoryCheck, r as translate, x as cartStoreNextStep, k as cartStoreClearCheckoutInterval } from './cart-006b6633.js';
|
|
3
3
|
import { h as handleFetch, l as log, b as logError, j as jsonParse } from './handleFetch-621e45bc.js';
|
|
4
4
|
import { t as tinycolor } from './isDarkColor-4c7b2ffc.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-a457c60c.js';
|
|
2
|
-
import { e as cartStore, f as stripeStore, t as trackConversionEvent, V as getFallbackDefaultCountryCode, r as translate, l as localizationStore } from './cart-
|
|
2
|
+
import { e as cartStore, f as stripeStore, t as trackConversionEvent, V as getFallbackDefaultCountryCode, r as translate, l as localizationStore } from './cart-006b6633.js';
|
|
3
3
|
import { z as zonosStore, d as zonosStoreFontFamily, f as isObject_1 } from './zonosStore-cdabc848.js';
|
|
4
4
|
import { b as logError, l as log, i as isCheckoutMobile } from './handleFetch-621e45bc.js';
|
|
5
5
|
import { s as shouldRenderTaxIdInput, i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './shouldRenderTaxIdInput-8bc112bb.js';
|
|
@@ -135,15 +135,15 @@ const ZonosAddress$1 = class {
|
|
|
135
135
|
const eventValue = event.value;
|
|
136
136
|
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
137
137
|
this.isDirtyAddress = true;
|
|
138
|
+
if (!this.isAutoCompleteAdjusted) {
|
|
139
|
+
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
140
|
+
if (googleAutoComplete) {
|
|
141
|
+
googleAutoComplete.style.zIndex = '3';
|
|
142
|
+
}
|
|
143
|
+
this.isAutoCompleteAdjusted = true;
|
|
144
|
+
}
|
|
138
145
|
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
139
146
|
setTimeout(() => {
|
|
140
|
-
if (!this.isAutoCompleteAdjusted) {
|
|
141
|
-
const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
|
|
142
|
-
if (googleAutoComplete) {
|
|
143
|
-
googleAutoComplete.style.zIndex = '2';
|
|
144
|
-
}
|
|
145
|
-
this.isAutoCompleteAdjusted = true;
|
|
146
|
-
}
|
|
147
147
|
// scroll directly into view if it's mobile
|
|
148
148
|
if (isCheckoutMobile()) {
|
|
149
149
|
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
@@ -259,7 +259,7 @@ const ZonosAddress$1 = class {
|
|
|
259
259
|
this.isAddressFilled = true;
|
|
260
260
|
}
|
|
261
261
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
262
|
-
return (h(Host, { key: '
|
|
262
|
+
return (h(Host, { key: 'ebd6b34dfcb486e1746fbc306e2e413d03290d50', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '68e7f0fa37ca7efd4d833b32d4c27cda29521871', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '5e6d4b3798c91def3f3a6ae5ac12f1a2ccca272b', class: "zonos--address-component" })));
|
|
263
263
|
}
|
|
264
264
|
get el() { return getElement(this); }
|
|
265
265
|
static get watchers() { return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-a457c60c.js';
|
|
2
|
-
import { e as cartStore, E as currencyFormat, r as translate, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, f as stripeStore, C as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, l as localizationStore, x as cartStoreNextStep, R as stripeStoreTranslateAddressToLatin, S as cartStoreUpdateSelectedShippingOption, T as cartStoreGetShippingTransitInfo, U as sortServiceLevelOptionsByAmount } from './cart-
|
|
2
|
+
import { e as cartStore, E as currencyFormat, r as translate, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, f as stripeStore, C as stripeStoreReset, d as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, l as localizationStore, x as cartStoreNextStep, R as stripeStoreTranslateAddressToLatin, S as cartStoreUpdateSelectedShippingOption, T as cartStoreGetShippingTransitInfo, U as sortServiceLevelOptionsByAmount } from './cart-006b6633.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
|
-
import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-
|
|
4
|
+
import { s as submitGtag, c as paypalStoreReset, b as paypalStore, i as isContrastColor } from './paypal-86483f34.js';
|
|
5
5
|
import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-cdabc848.js';
|
|
6
6
|
import { h as handleFetch, l as log, s as sendErrorLog, j as jsonParse, g as getIsTestMode, d as allLogs, i as isCheckoutMobile, b as logError, a as getIsStagingMode } from './handleFetch-621e45bc.js';
|
|
7
7
|
import { c as createCustomEvent } from './createCustomEvent-58159025.js';
|