@zonos/elements 1.5.2 → 1.5.3
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/_isBigCommerceNativeCheckout-3-xbKbAO.js +133 -0
- package/dist/cjs/{cart-BJpqPdFU.js → cart-C39TMSgB.js} +14 -0
- package/dist/cjs/{collect-CyUttsvB.js → collect-lF9DenLk.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-DEbNbRAZ.js → getMissingRequiredShippingFields-svcnpumn.js} +1 -1
- package/dist/cjs/index.cjs.js +61 -42
- package/dist/cjs/{invoice-DzRkkpLu.js → invoice-BD3pCr8P.js} +1 -1
- package/dist/cjs/{paypal-DCSqbdjW.js → paypal-Bd1qmwiv.js} +1 -1
- package/dist/cjs/{placeTestOrder-Bkip4PUT.js → placeTestOrder-BMQRvX2q.js} +1 -1
- package/dist/cjs/{renderCheckoutCurrency-BDvEZ3Hv.js → renderCheckoutCurrency-DE2p8CT8.js} +1 -1
- package/dist/cjs/{taxIdFields-e4OCgr8K.js → taxIdFields-BKbk2bhi.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +4 -4
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +5 -5
- package/dist/cjs/zonos-checkout.cjs.entry.js +41 -15
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +5 -5
- package/dist/cjs/zonos-collect.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +63 -38
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +5 -5
- package/dist/cjs/zonos-invoice.cjs.entry.js +3 -3
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +10 -1
- package/dist/collection/components/main/mountCheckoutWithoutStripe.js +12 -0
- package/dist/collection/components/main/zonos-controller.js +24 -9
- package/dist/collection/components/store/checkout/stripe.js +13 -1
- package/dist/collection/components/utils/checkout/isBigCommerceCheckoutBypassEnabled.js +2 -1
- package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +32 -12
- package/dist/collection/scripts/_bigcommerceCheckoutPath.js +16 -0
- package/dist/collection/scripts/_detectBigCommerceHost.js +12 -0
- package/dist/collection/scripts/_isBigCommerceNativeCheckout.js +107 -0
- package/dist/collection/scripts/_loadStripe.js +15 -4
- package/dist/collection/scripts/_zonosBase.js +40 -31
- package/dist/esm/_isBigCommerceNativeCheckout-Bb90IMVt.js +128 -0
- package/dist/esm/{cart-BS5mSI8x.js → cart-b84n0nhi.js} +14 -2
- package/dist/esm/{collect-B9ZxDDl7.js → collect-B_AEVONL.js} +3 -3
- package/dist/esm/{getMissingRequiredShippingFields-BkEV865q.js → getMissingRequiredShippingFields-EY10c34-.js} +1 -1
- package/dist/esm/{hasInclusivePrice-zSvDReDb.js → hasInclusivePrice-DfEiyzw7.js} +1 -1
- package/dist/esm/index.js +61 -42
- package/dist/esm/{invoice-6iTuS6ek.js → invoice-dQ0ONK5Q.js} +2 -2
- package/dist/esm/{localization-CXHiWcJp.js → localization-B5CRzthT.js} +1 -1
- package/dist/esm/{paypal-BE_NVBoy.js → paypal-CF_oM0B6.js} +2 -2
- package/dist/esm/{placeTestOrder-BXA9K9Iy.js → placeTestOrder-BTpfyqPL.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-KMa4HlAf.js → renderCheckoutCurrency-CpeuDWx-.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-BI_ApEsQ.js → shouldShowLanguageSelect-CJinx9-m.js} +1 -1
- package/dist/esm/{taxIdFields-BUKnHMaL.js → taxIdFields-BCyXnc9O.js} +2 -2
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +5 -5
- package/dist/esm/zonos-address-display_2.entry.js +1 -1
- package/dist/esm/zonos-address_4.entry.js +3 -3
- package/dist/esm/zonos-airwallex-payment.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +8 -8
- package/dist/esm/zonos-checkout.entry.js +42 -16
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +7 -7
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +63 -38
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- 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 +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +7 -7
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
- package/dist/esm-es5/_isBigCommerceNativeCheckout-Bb90IMVt.js +40 -0
- package/dist/esm-es5/{cart-BS5mSI8x.js → cart-b84n0nhi.js} +9 -9
- package/dist/esm-es5/{collect-B9ZxDDl7.js → collect-B_AEVONL.js} +2 -2
- package/dist/esm-es5/{getMissingRequiredShippingFields-BkEV865q.js → getMissingRequiredShippingFields-EY10c34-.js} +3 -3
- package/dist/esm-es5/{hasInclusivePrice-zSvDReDb.js → hasInclusivePrice-DfEiyzw7.js} +1 -1
- package/dist/esm-es5/index.js +76 -65
- package/dist/esm-es5/{invoice-6iTuS6ek.js → invoice-dQ0ONK5Q.js} +1 -1
- package/dist/esm-es5/{localization-CXHiWcJp.js → localization-B5CRzthT.js} +1 -1
- package/dist/esm-es5/{paypal-BE_NVBoy.js → paypal-CF_oM0B6.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-BXA9K9Iy.js → placeTestOrder-BTpfyqPL.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-KMa4HlAf.js → renderCheckoutCurrency-CpeuDWx-.js} +4 -4
- package/dist/esm-es5/{shouldShowLanguageSelect-BI_ApEsQ.js → shouldShowLanguageSelect-CJinx9-m.js} +1 -1
- package/dist/esm-es5/{taxIdFields-BUKnHMaL.js → taxIdFields-BCyXnc9O.js} +2 -2
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +2 -2
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +20 -9
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +6 -6
- package/dist/esm-es5/zonos-controller.entry.js +22 -13
- 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-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +16 -0
- 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/main/mountCheckoutWithoutStripe.d.ts +8 -0
- package/dist/types/components/store/checkout/stripe.d.ts +4 -1
- package/dist/types/scripts/_bigcommerceCheckoutPath.d.ts +12 -0
- package/dist/types/scripts/_detectBigCommerceHost.d.ts +5 -0
- package/dist/types/scripts/_isBigCommerceNativeCheckout.d.ts +21 -0
- package/dist/types/scripts/_zonosBase.d.ts +16 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-08b01c96.entry.js → p-02faff47.entry.js} +1 -1
- package/dist/zonos-elements/{p-573a4e7c.system.entry.js → p-0c68cbbb.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-68325c5a.system.entry.js → p-1cd2d097.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-af741506.entry.js → p-255e411a.entry.js} +1 -1
- package/dist/zonos-elements/{p-dJcbnNlE.system.js → p-2c_UqKJL.system.js} +2 -2
- package/dist/zonos-elements/{p-BUfCTQXY.system.js → p-3AUMK-5E.system.js} +113 -113
- package/dist/zonos-elements/{p-dd003161.entry.js → p-3ee87d8b.entry.js} +1 -1
- package/dist/zonos-elements/{p-8f9f859f.system.entry.js → p-42fa5694.system.entry.js} +5 -5
- package/dist/zonos-elements/p-49eaaab8.entry.js +1 -0
- package/dist/zonos-elements/{p-ebc7ea54.system.entry.js → p-4ce4c49f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9b3668a4.system.entry.js → p-5622fc50.system.entry.js} +263 -252
- package/dist/zonos-elements/{p-3a506614.system.entry.js → p-59457fd9.system.entry.js} +71 -62
- package/dist/zonos-elements/{p-7fe83919.entry.js → p-66398133.entry.js} +1 -1
- package/dist/zonos-elements/{p-9df31243.system.entry.js → p-674323ac.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-97729873.entry.js → p-71d9a5b7.entry.js} +1 -1
- package/dist/zonos-elements/{p-30bf4700.system.entry.js → p-81780f8f.system.entry.js} +2 -2
- package/dist/zonos-elements/{p-1986cc37.entry.js → p-821b83a2.entry.js} +1 -1
- package/dist/zonos-elements/{p-5a296dbc.system.entry.js → p-877a82d2.system.entry.js} +61 -61
- package/dist/zonos-elements/p-8daec112.entry.js +1 -0
- package/dist/zonos-elements/{p-150047b3.system.entry.js → p-93bc75fd.system.entry.js} +19 -19
- package/dist/zonos-elements/{p-b540c636.system.entry.js → p-976b3bf3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4b65f192.entry.js → p-9a4947a5.entry.js} +1 -1
- package/dist/zonos-elements/p-9f7693bf.entry.js +1 -0
- package/dist/zonos-elements/{p-D4xpkSsK.js → p-BIJM2Kj-.js} +1 -1
- package/dist/zonos-elements/{p-D-Lnf8mS.system.js → p-BOh4ifdL.system.js} +2 -2
- package/dist/zonos-elements/p-BZAX-HmS.js +1 -0
- package/dist/zonos-elements/p-Bb90IMVt.js +1 -0
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-DC1OPJDq.system.js → p-BvoPE_nb.system.js} +1 -1
- package/dist/zonos-elements/{p-C5fs3rIR.js → p-C3E55OqH.js} +1 -1
- package/dist/zonos-elements/{p-BnQyot7Y.system.js → p-C3gF3UV5.system.js} +29 -29
- package/dist/zonos-elements/{p-BKUlQxBd.system.js → p-CD2ahEZn.system.js} +1 -1
- package/dist/zonos-elements/p-CEBBLbvF.js +1 -0
- package/dist/zonos-elements/{p-Cp1IAJvW.system.js → p-CEV0O_IQ.system.js} +4 -4
- package/dist/zonos-elements/{p-yv7ekcdG.system.js → p-CZ-uYiCo.system.js} +2 -2
- package/dist/zonos-elements/{p-CP7KnfR3.system.js → p-Cn2xE-9t.system.js} +79 -68
- package/dist/zonos-elements/p-CtvXi9wL.system.js +41 -0
- package/dist/zonos-elements/{p-Dv5a-V6w.system.js → p-Cw_Qnyow.system.js} +1 -1
- package/dist/zonos-elements/p-CzXNXgyI.js +1 -0
- package/dist/zonos-elements/{p-CVRbGFV3.js → p-D9OPKqLg.js} +1 -1
- package/dist/zonos-elements/{p-DrbN3rPL.js → p-Df62LRNs.js} +2 -2
- package/dist/zonos-elements/{p-DKnphvmJ.js → p-Lsqrpzc5.js} +1 -1
- package/dist/zonos-elements/{p-DrS-0mk7.system.js → p-YQFbWtjn.system.js} +1 -1
- package/dist/zonos-elements/p-a27f48e4.entry.js +1 -0
- package/dist/zonos-elements/{p-bb1b414a.system.entry.js → p-a6bb296c.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-13015d34.system.entry.js → p-abb85879.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-383343c7.entry.js → p-b8653024.entry.js} +1 -1
- package/dist/zonos-elements/p-b9d7a3b6.entry.js +1 -0
- package/dist/zonos-elements/{p-96b250d8.system.entry.js → p-be067e12.system.entry.js} +2 -2
- package/dist/zonos-elements/{p-Cl5yV0ak.js → p-bmrOH9oh.js} +1 -1
- package/dist/zonos-elements/{p-71d29603.entry.js → p-c185bc23.entry.js} +1 -1
- package/dist/zonos-elements/{p-13d5b2f9.entry.js → p-c6e78de2.entry.js} +1 -1
- package/dist/zonos-elements/{p-a3c147d2.system.entry.js → p-ca97a1cd.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-0909ef77.entry.js → p-cbb96382.entry.js} +1 -1
- package/dist/zonos-elements/{p-6db7317a.system.entry.js → p-dbf4d156.system.entry.js} +14 -14
- package/dist/zonos-elements/{p-e43470f7.system.entry.js → p-df240119.system.entry.js} +17 -17
- package/dist/zonos-elements/{p-f2ed52bc.system.entry.js → p-e16e4db6.system.entry.js} +15 -15
- package/dist/zonos-elements/{p-7214c953.system.entry.js → p-eb016dd8.system.entry.js} +16 -16
- package/dist/zonos-elements/{p-709d1561.system.entry.js → p-eb5c67a0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e374aaa4.entry.js → p-ed8a7a7f.entry.js} +1 -1
- package/dist/zonos-elements/{p-3466bcba.entry.js → p-ef932fda.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfa9e32a.entry.js → p-f792ba5f.entry.js} +1 -1
- package/dist/zonos-elements/{p-aK18R41t.js → p-fZcKMzE-.js} +1 -1
- package/dist/zonos-elements/{p-C-zdj7MK.js → p-fdritVtG.js} +1 -1
- package/dist/zonos-elements/p-fffe6376.entry.js +1 -0
- package/dist/zonos-elements/{p-CMneHjck.system.js → p-v8IEjQ2z.system.js} +10 -10
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +10 -10
- package/dist/zonos-elements/p-43c0ebe9.entry.js +0 -1
- package/dist/zonos-elements/p-8ac26831.entry.js +0 -1
- package/dist/zonos-elements/p-BI6VAB5B.js +0 -1
- package/dist/zonos-elements/p-BJ_kE5rM.js +0 -1
- package/dist/zonos-elements/p-DATNIakn.js +0 -1
- package/dist/zonos-elements/p-af4ad54b.entry.js +0 -1
- package/dist/zonos-elements/p-bac94956.entry.js +0 -1
- package/dist/zonos-elements/p-cf6bf7a4.entry.js +0 -1
- package/dist/zonos-elements/p-db40b9c3.entry.js +0 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Two checkout-path rules, kept together so they cannot drift in separate files.
|
|
5
|
+
*
|
|
6
|
+
* `pathContainsCheckout` is the broad rule for zBypass and address detection.
|
|
7
|
+
* It still matches paths such as `checkout-page`.
|
|
8
|
+
*
|
|
9
|
+
* `hasExactCheckoutSegment` is the strict rule for the Stripe.js skip. Only a
|
|
10
|
+
* segment exactly equal to `checkout` counts, so a slug does not drop the
|
|
11
|
+
* payment script.
|
|
12
|
+
*/
|
|
13
|
+
const pathContainsCheckout = (pathname) => {
|
|
14
|
+
return pathname.includes('/checkout');
|
|
15
|
+
};
|
|
16
|
+
const hasExactCheckoutSegment = (pathname) => {
|
|
17
|
+
return pathname.split('/').some(segment => segment === 'checkout');
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Storefront signals BigCommerce sets before Zonos copies `isBigCommerce`.
|
|
22
|
+
* Shared by the loader script and the Stripe skip so the two cannot drift.
|
|
23
|
+
*/
|
|
24
|
+
const detectBigCommerceHost = () => {
|
|
25
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return (!!window.stencilBootstrap ||
|
|
29
|
+
!!window.bcConfig ||
|
|
30
|
+
!!document.querySelector('script[src*="bigcommerce.com"]'));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const hasCheckoutSegment = () => hasExactCheckoutSegment(window.location.pathname);
|
|
34
|
+
const sharedZonos = () => {
|
|
35
|
+
if (typeof window === 'undefined' || !('Zonos' in window)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return window.Zonos;
|
|
39
|
+
};
|
|
40
|
+
const isFlaggedBigCommerce = () => {
|
|
41
|
+
var _a;
|
|
42
|
+
return ((_a = sharedZonos()) === null || _a === void 0 ? void 0 : _a.isBigCommerce) === true;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The settled answer lives on `window.Zonos`, the object loadZonos.js,
|
|
46
|
+
* zonos.js, and the component bundle already share.
|
|
47
|
+
*
|
|
48
|
+
* A `true` result sticks for that pathname. A `false` result sticks once
|
|
49
|
+
* the path is not checkout, or once host detection has finished. A checkout
|
|
50
|
+
* path whose BigCommerce signals are not in the page yet stays unset, so a
|
|
51
|
+
* later signal can still settle it.
|
|
52
|
+
*/
|
|
53
|
+
const readSettled = () => {
|
|
54
|
+
const zonos = sharedZonos();
|
|
55
|
+
if (zonos === undefined) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
if (zonos.isBigCommerceNativeCheckoutPath !== window.location.pathname) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const value = zonos.isBigCommerceNativeCheckout;
|
|
62
|
+
if (value === true || value === false) {
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
};
|
|
67
|
+
const writeSettled = (value) => {
|
|
68
|
+
const zonos = sharedZonos();
|
|
69
|
+
if (zonos !== undefined) {
|
|
70
|
+
zonos.isBigCommerceNativeCheckout = value;
|
|
71
|
+
zonos.isBigCommerceNativeCheckoutPath = window.location.pathname;
|
|
72
|
+
}
|
|
73
|
+
return value;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Call after `isBigCommerce` has been copied from host detection. Writes the
|
|
77
|
+
* settled boolean onto `window.Zonos` for this pathname.
|
|
78
|
+
*/
|
|
79
|
+
const markBigCommerceHostChecked = () => {
|
|
80
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const zonos = sharedZonos();
|
|
84
|
+
if (zonos === undefined) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const native = hasCheckoutSegment() && (detectBigCommerceHost() || isFlaggedBigCommerce());
|
|
88
|
+
zonos.isBigCommerceNativeCheckout = native;
|
|
89
|
+
zonos.isBigCommerceNativeCheckoutPath = window.location.pathname;
|
|
90
|
+
};
|
|
91
|
+
const decide = () => {
|
|
92
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const settled = readSettled();
|
|
96
|
+
if (settled !== undefined) {
|
|
97
|
+
return settled;
|
|
98
|
+
}
|
|
99
|
+
if (!hasCheckoutSegment()) {
|
|
100
|
+
return writeSettled(false);
|
|
101
|
+
}
|
|
102
|
+
if (detectBigCommerceHost() || isFlaggedBigCommerce()) {
|
|
103
|
+
return writeSettled(true);
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* True when this document is BigCommerce native checkout.
|
|
109
|
+
* Stripe.js injection is owned by `loadStripeScript` in `_loadStripe.ts`.
|
|
110
|
+
* Other callers use this for a different job: skip `attachCheckout`, leave
|
|
111
|
+
* the store's buttons enabled, or hand a leftover domestic session to `/`.
|
|
112
|
+
* An undecided checkout path returns false and is not stored.
|
|
113
|
+
*/
|
|
114
|
+
const isBigCommerceNativeCheckout = () => {
|
|
115
|
+
return decide() === true;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* True when Stripe.js must not be injected. An undecided checkout path
|
|
119
|
+
* holds the script until host detection finishes, instead of storing "not
|
|
120
|
+
* native checkout" and injecting v3 early.
|
|
121
|
+
*/
|
|
122
|
+
const holdStripeForNativeCheckout = () => {
|
|
123
|
+
const decision = decide();
|
|
124
|
+
if (decision === undefined) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return decision;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
exports.holdStripeForNativeCheckout = holdStripeForNativeCheckout;
|
|
131
|
+
exports.isBigCommerceNativeCheckout = isBigCommerceNativeCheckout;
|
|
132
|
+
exports.markBigCommerceHostChecked = markBigCommerceHostChecked;
|
|
133
|
+
exports.pathContainsCheckout = pathContainsCheckout;
|
|
@@ -1083,11 +1083,23 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
1083
1083
|
locale: localization.localizationStore.selectedLocale,
|
|
1084
1084
|
};
|
|
1085
1085
|
};
|
|
1086
|
+
const DOMESTIC_SESSION_REDIRECT_MARKER = 'zonos--bc-domestic-session-redirected';
|
|
1087
|
+
const clearDomesticSessionRedirectMarker = () => {
|
|
1088
|
+
handleFetch.safeRemoveItem('session', DOMESTIC_SESSION_REDIRECT_MARKER);
|
|
1089
|
+
};
|
|
1090
|
+
const stripeStoreHasDomesticSessionRedirectMarker = () => {
|
|
1091
|
+
return handleFetch.safeGetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER) === '1';
|
|
1092
|
+
};
|
|
1093
|
+
const stripeStoreMarkDomesticSessionRedirected = () => {
|
|
1094
|
+
handleFetch.safeSetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER, '1');
|
|
1095
|
+
};
|
|
1086
1096
|
const stripeStoreCleanupDomesticShippingSession = () => {
|
|
1087
1097
|
handleFetch.safeRemoveItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
|
|
1098
|
+
clearDomesticSessionRedirectMarker();
|
|
1088
1099
|
};
|
|
1089
1100
|
// Save shipping address to session storage
|
|
1090
1101
|
const stripeStoreSaveDomesticShippingSession = (props) => {
|
|
1102
|
+
clearDomesticSessionRedirectMarker();
|
|
1091
1103
|
handleFetch.safeSetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
|
|
1092
1104
|
};
|
|
1093
1105
|
const stripeStoreGetDomesticShippingSession = () => {
|
|
@@ -2825,7 +2837,9 @@ exports.stripeStoreGetDomesticShippingSession = stripeStoreGetDomesticShippingSe
|
|
|
2825
2837
|
exports.stripeStoreGetPaymentIntent = stripeStoreGetPaymentIntent;
|
|
2826
2838
|
exports.stripeStoreHandleInventoryCheck = stripeStoreHandleInventoryCheck;
|
|
2827
2839
|
exports.stripeStoreHandleInventoryRefund = stripeStoreHandleInventoryRefund;
|
|
2840
|
+
exports.stripeStoreHasDomesticSessionRedirectMarker = stripeStoreHasDomesticSessionRedirectMarker;
|
|
2828
2841
|
exports.stripeStoreInitCheckoutSession = stripeStoreInitCheckoutSession;
|
|
2842
|
+
exports.stripeStoreMarkDomesticSessionRedirected = stripeStoreMarkDomesticSessionRedirected;
|
|
2829
2843
|
exports.stripeStoreMessageBasedOnStatus = stripeStoreMessageBasedOnStatus;
|
|
2830
2844
|
exports.stripeStoreOnChange = stripeStoreOnChange;
|
|
2831
2845
|
exports.stripeStorePrefetchLandedCost = stripeStorePrefetchLandedCost;
|
|
@@ -4,7 +4,7 @@ var zonosStore = require('./zonosStore-CDV83QyK.js');
|
|
|
4
4
|
var localization = require('./localization-BhNVhLZs.js');
|
|
5
5
|
var handleFetch = require('./handleFetch-DVfjFTYO.js');
|
|
6
6
|
var VarianceTest = require('./VarianceTest-C98whVgO.js');
|
|
7
|
-
var cart = require('./cart-
|
|
7
|
+
var cart = require('./cart-C39TMSgB.js');
|
|
8
8
|
|
|
9
9
|
// src/constant/common.ts
|
|
10
10
|
function _array_like_to_array(arr, len) {
|
|
@@ -2047,7 +2047,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
2047
2047
|
var e = new Error(message);
|
|
2048
2048
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2049
2049
|
};
|
|
2050
|
-
var version = "1.35.
|
|
2050
|
+
var version = "1.35.2";
|
|
2051
2051
|
var packageJson = {
|
|
2052
2052
|
version: version};
|
|
2053
2053
|
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -5,6 +5,7 @@ var createCustomEvent = require('./createCustomEvent-Cs5zGImL.js');
|
|
|
5
5
|
var getGenericSettingsOverride = require('./getGenericSettingsOverride-CL6l6wvX.js');
|
|
6
6
|
var handleFetch = require('./handleFetch-DVfjFTYO.js');
|
|
7
7
|
var VarianceTest = require('./VarianceTest-C98whVgO.js');
|
|
8
|
+
var _isBigCommerceNativeCheckout = require('./_isBigCommerceNativeCheckout-3-xbKbAO.js');
|
|
8
9
|
var CheckoutConfig = require('./CheckoutConfig-B7JRM7yr.js');
|
|
9
10
|
var ShortAddressCode = require('./ShortAddressCode-C5l520-F.js');
|
|
10
11
|
var TaxId = require('./TaxId-ChhNwG04.js');
|
|
@@ -223,7 +224,7 @@ const getZonosQaUrl = () => {
|
|
|
223
224
|
return null;
|
|
224
225
|
}
|
|
225
226
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
226
|
-
const cdnUrl = "https://v1.5.
|
|
227
|
+
const cdnUrl = "https://v1.5.3.js.zonos.com";
|
|
227
228
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
228
229
|
if (!qaUrl &&
|
|
229
230
|
(cdnUrl.includes('test.') ||
|
|
@@ -399,13 +400,23 @@ const hasCheckoutCartCallback = () => {
|
|
|
399
400
|
(typeof ((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.createCartId) === 'function' ||
|
|
400
401
|
typeof ((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.buildCartDetail) === 'function');
|
|
401
402
|
};
|
|
403
|
+
/**
|
|
404
|
+
* The only function that may inject Stripe.js. Native BigCommerce checkout
|
|
405
|
+
* returns null before `window.Stripe` is read or `js.stripe.com/v3` is added.
|
|
406
|
+
* Callers decide whether to ask for Stripe. They do not load it themselves.
|
|
407
|
+
*/
|
|
408
|
+
const loadStripeScript = () => {
|
|
409
|
+
if (_isBigCommerceNativeCheckout.holdStripeForNativeCheckout()) {
|
|
410
|
+
return Promise.resolve(null);
|
|
411
|
+
}
|
|
412
|
+
return zonosStripeLoadScript(null);
|
|
413
|
+
};
|
|
402
414
|
const stripePromise = Promise.resolve().then(() => {
|
|
403
|
-
//
|
|
404
|
-
// (e.g. a Hello-only integration). Stripe is loaded on demand instead.
|
|
415
|
+
// Hello-only pages have no cart callback, so they skip the eager preload.
|
|
405
416
|
if (!hasCheckoutCartCallback()) {
|
|
406
417
|
return null;
|
|
407
418
|
}
|
|
408
|
-
return
|
|
419
|
+
return loadStripeScript();
|
|
409
420
|
});
|
|
410
421
|
let loadCalled = false;
|
|
411
422
|
stripePromise.catch((err) => {
|
|
@@ -421,7 +432,7 @@ const zonosLoadStripe = async (...args) => {
|
|
|
421
432
|
// Fall back to loading Stripe on demand if the eager preload was skipped
|
|
422
433
|
// (callbacks set after the microtask, or Collect/Invoice flows that don't
|
|
423
434
|
// use cart callbacks). `zonosStripeLoadScript` is idempotent.
|
|
424
|
-
const maybeStripe = (_a = (await stripePromise)) !== null && _a !== void 0 ? _a : (await
|
|
435
|
+
const maybeStripe = (_a = (await stripePromise)) !== null && _a !== void 0 ? _a : (await loadStripeScript());
|
|
425
436
|
return initStripe(maybeStripe, args, startTime);
|
|
426
437
|
};
|
|
427
438
|
|
|
@@ -512,10 +523,10 @@ const zonosLoadUrl = (() => {
|
|
|
512
523
|
return null;
|
|
513
524
|
})();
|
|
514
525
|
const startLoadTime = Date.now();
|
|
515
|
-
const ZONOS_URL = "https://v1.5.
|
|
516
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.
|
|
517
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.
|
|
518
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.
|
|
526
|
+
const ZONOS_URL = "https://v1.5.3.js.zonos.com";
|
|
527
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.3";
|
|
528
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.3";
|
|
529
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.3";
|
|
519
530
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
520
531
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
521
532
|
class Zonos {
|
|
@@ -533,7 +544,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
533
544
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
534
545
|
: null;
|
|
535
546
|
Zonos.isBigCommerce = false;
|
|
536
|
-
Zonos.releaseDate = "
|
|
547
|
+
Zonos.releaseDate = "1794098254078";
|
|
537
548
|
Zonos.isLegacyCheckout = false;
|
|
538
549
|
Zonos.googleAnalyticId = null;
|
|
539
550
|
Zonos.googleAnalyticReady = false;
|
|
@@ -558,7 +569,7 @@ Zonos.isNpm = true;
|
|
|
558
569
|
Zonos.zonosQaUrl = null;
|
|
559
570
|
Zonos.zonosQaUrlApi = null;
|
|
560
571
|
Zonos.trackEventLogs = [];
|
|
561
|
-
Zonos.version = `v${"1.5.
|
|
572
|
+
Zonos.version = `v${"1.5.3"}`;
|
|
562
573
|
Zonos.modeAlerted = false;
|
|
563
574
|
Zonos.cartData = null;
|
|
564
575
|
Zonos.paypal = null;
|
|
@@ -581,6 +592,9 @@ Zonos.init = async (params) => {
|
|
|
581
592
|
// do nothing if zonos is already initialized
|
|
582
593
|
return;
|
|
583
594
|
}
|
|
595
|
+
// Host detection has already copied `isBigCommerce`. Settle the
|
|
596
|
+
// native-checkout answer once, before buttons or Stripe are touched.
|
|
597
|
+
_isBigCommerceNativeCheckout.markBigCommerceHostChecked();
|
|
584
598
|
VarianceTest.log(`====== ZONOS DEBUG MODE: on (${_a.version}) ======`);
|
|
585
599
|
_a.zonosApiKey = zonosApiKey;
|
|
586
600
|
_a.storeId = storeId;
|
|
@@ -837,47 +851,52 @@ Zonos.injectController = ({ config, }) => {
|
|
|
837
851
|
if (document.querySelector('zonos-controller')) {
|
|
838
852
|
return;
|
|
839
853
|
}
|
|
840
|
-
//
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
placeOrderButtonSelector
|
|
847
|
-
});
|
|
848
|
-
// create a mutation observer to see if any new elements that match our selector is added to the DOM
|
|
849
|
-
const observer = new MutationObserver(() => {
|
|
854
|
+
// Native BigCommerce checkout never calls attachCheckout, which is what
|
|
855
|
+
// marks these buttons handled. Disabling them here would flicker the
|
|
856
|
+
// store's own buttons after every DOM mutation.
|
|
857
|
+
if (!_isBigCommerceNativeCheckout.isBigCommerceNativeCheckout()) {
|
|
858
|
+
// if placeOrderAnchor is passed in the config for checkoutSettings, disable the place order button until zonos is initialized
|
|
859
|
+
if ((_b = config.checkoutSettings) === null || _b === void 0 ? void 0 : _b.placeOrderButtonSelector) {
|
|
860
|
+
const placeOrderButtonSelector = config.checkoutSettings.placeOrderButtonSelector;
|
|
850
861
|
_a.disablePlaceOrderButtons({
|
|
851
862
|
config,
|
|
852
863
|
disable: true,
|
|
853
864
|
placeOrderButtonSelector,
|
|
854
865
|
});
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
866
|
+
// create a mutation observer to see if any new elements that match our selector is added to the DOM
|
|
867
|
+
const observer = new MutationObserver(() => {
|
|
868
|
+
_a.disablePlaceOrderButtons({
|
|
869
|
+
config,
|
|
870
|
+
disable: true,
|
|
871
|
+
placeOrderButtonSelector,
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
observer.observe(document.body, {
|
|
875
|
+
childList: true,
|
|
876
|
+
subtree: true,
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
// if alwaysTriggerInternationalCheckoutSelector is passed in the config for checkoutSettings, disable the place order button until zonos is initialized
|
|
880
|
+
if ((_c = config.checkoutSettings) === null || _c === void 0 ? void 0 : _c.alwaysTriggerInternationalCheckoutSelector) {
|
|
881
|
+
const alwaysTriggerInternationalCheckoutSelector = config.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;
|
|
871
882
|
_a.disablePlaceOrderButtons({
|
|
872
883
|
config,
|
|
873
884
|
disable: true,
|
|
874
885
|
placeOrderButtonSelector: alwaysTriggerInternationalCheckoutSelector,
|
|
875
886
|
});
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
887
|
+
// create a mutation observer to see if any new elements that match our selector is added to the DOM
|
|
888
|
+
const observer = new MutationObserver(() => {
|
|
889
|
+
_a.disablePlaceOrderButtons({
|
|
890
|
+
config,
|
|
891
|
+
disable: true,
|
|
892
|
+
placeOrderButtonSelector: alwaysTriggerInternationalCheckoutSelector,
|
|
893
|
+
});
|
|
894
|
+
});
|
|
895
|
+
observer.observe(document.body, {
|
|
896
|
+
childList: true,
|
|
897
|
+
subtree: true,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
881
900
|
}
|
|
882
901
|
const zonosController = document.createElement('zonos-controller');
|
|
883
902
|
zonosController.config = config;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var zonosStore = require('./zonosStore-CDV83QyK.js');
|
|
4
|
-
var cart = require('./cart-
|
|
4
|
+
var cart = require('./cart-C39TMSgB.js');
|
|
5
5
|
var localization = require('./localization-BhNVhLZs.js');
|
|
6
6
|
var handleFetch = require('./handleFetch-DVfjFTYO.js');
|
|
7
7
|
var VarianceTest = require('./VarianceTest-C98whVgO.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var zonosStore = require('./zonosStore-CDV83QyK.js');
|
|
4
|
-
var cart = require('./cart-
|
|
4
|
+
var cart = require('./cart-C39TMSgB.js');
|
|
5
5
|
var localization = require('./localization-BhNVhLZs.js');
|
|
6
6
|
var handleFetch = require('./handleFetch-DVfjFTYO.js');
|
|
7
7
|
var isContrastColor = require('./isContrastColor-B9ldIdpa.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var zonosStore = require('./zonosStore-CDV83QyK.js');
|
|
4
4
|
var debounce = require('./debounce-DRPMxNew.js');
|
|
5
5
|
var index = require('./index-DAAr465v.js');
|
|
6
|
-
var cart = require('./cart-
|
|
6
|
+
var cart = require('./cart-C39TMSgB.js');
|
|
7
7
|
var localization = require('./localization-BhNVhLZs.js');
|
|
8
8
|
var taxIdRules = require('./taxIdRules-BBj8kQxJ.js');
|
|
9
9
|
|