@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
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=c(0),s["throw"]=c(1),s["return"]=c(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-CIevpRv_.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=c(0),s["throw"]=c(1),s["return"]=c(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-CIevpRv_.system.js","./p-3AUMK-5E.system.js","./p-v8IEjQ2z.system.js","./p-BOh4ifdL.system.js","./p-DTgUqgwV.system.js","./p-BDopxBpR.system.js","./p-D0DkOoAw.system.js","./p-1OG3IJgY.system.js","./p-BbgqQIHv.system.js","./p-smUku7Ku.system.js","./p-CtvXi9wL.system.js","./p-C2j7R11h.system.js","./p-DBOI98r5.system.js","./p-zsTASoh2.system.js","./p-DW-fW8yR.system.js","./p-BNtWsPPP.system.js","./p-0D0aCMu6.system.js","./p-CzKlS3E-.system.js","./p-DsBuZ6ob.system.js","./p-B3GRrRtL.system.js","./p-DXlojp_Y.system.js","./p-CYxMfUL7.system.js","./p-DIab60nK.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,f,h,v,m,p,g,w,z,k,y,b,_,C,x,S,I,T,A,O,B,U,E,L,P,D,j,N,R,F,M,H,K,Z,G,V,Q,W,Y,q,J,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,fe,he,ve,me,pe,ge,we,ze,ke,ye,be,_e,Ce,xe,Se,Ie,Te,Ae,Oe,Be,Ue,Ee,Le,Pe,De,je,Ne;return{setters:[function(e){o=e.r;t=e.h;n=e.F;r=e.a},function(e){i=e.s;s=e.a;c=e.b;a=e.c;u=e.d;d=e.e;l=e.i;f=e.f;h=e.g;v=e.h;m=e.j;p=e.k;g=e.p;w=e.l;z=e.m;k=e.n;y=e.o;b=e.q;_=e.r;C=e.t;x=e.u;S=e.v;I=e.w;T=e.x;A=e.y;O=e.z;B=e.A;U=e.B;E=e.C;L=e.D;P=e.E;D=e.F;j=e.G;N=e.H;R=e.I;F=e.J;M=e.K;H=e.L;K=e.M},function(e){Z=e.p;G=e.s;V=e.a;Q=e.b},function(e){W=e.f;Y=e.a;q=e.b;J=e.i;X=e.l;$=e.c;ee=e.d;oe=e.g;te=e.s;ne=e.V;re=e.e;ie=e.t;se=e.h;ce=e.j},function(e){ae=e.z;ue=e.g;de=e.m},function(e){le=e.b},function(e){fe=e.h;he=e.g;ve=e.j;me=e.l;pe=e.d;ge=e.c;we=e.b;ze=e.s;ke=e.a;ye=e.i},function(e){be=e.u},function(e){_e=e.l;Ce=e.g;xe=e.b},function(e){Se=e._;Ie=e.c;Te=e.d;Ae=e.a;Oe=e.g},function(e){Be=e.p;Ue=e.i},function(e){Ee=e.c},function(e){Le=e.c},function(e){Pe=e.g},function(e){De=e.i},function(e){je=e.s},function(e){Ne=e.R},null,null,null,null,null,null],execute:function(){var Re=this;
|
|
2
2
|
/**
|
|
3
3
|
* Check if store discount is enabled
|
|
4
|
-
*/var
|
|
4
|
+
*/var Fe=function(){return __awaiter(Re,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,fe("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2/*return*/,{enabled:false}]}return[2/*return*/,{enabled:true}]}}))}))};var Me=function(e){return __awaiter(Re,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:
|
|
5
5
|
// Do nothing if no test keys are provided
|
|
6
|
-
if(i.length===0){return[2/*return*/,null]}return[4/*yield*/,
|
|
6
|
+
if(i.length===0){return[2/*return*/,null]}return[4/*yield*/,fe("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,null]}r=W(n);
|
|
7
7
|
// Filter the response to only include test keys that we support
|
|
8
|
-
return[2/*return*/,r]}}))}))};var
|
|
8
|
+
return[2/*return*/,r]}}))}))};var He=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,f=e.customerZip,h=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var p=new URLSearchParams;p.set("tempCartUUID",o);if(a){p.set("customerFirstName",a)}if(u){p.set("customerLastName",u)}if(c){p.set("customerEmail",c)}if(d){p.set("customerPhone",d)}if(f){p.set("customerZip",f)}if(i){p.set("customerCity",i)}if(l){p.set("customerState",l)}if(s){p.set("zCountry",s)}if(n){p.set("customerAddress1",n)}if(r){p.set("customerAddress2",r)}if(v){p.set("zonosTestMode","1")}if(t){p.set("zonosCheckoutSessionId",t)}if(m){p.set("zonosVariantTest","1")}return"".concat(h,"?").concat(p.toString())};
|
|
9
9
|
/**
|
|
10
10
|
* The query flag that BigCommerce carries back to `cart.php` after the
|
|
11
11
|
* shopper logs in. When present, Zonos-elements knows to resume the
|
|
12
12
|
* international checkout flow instead of letting BC's native cart UX
|
|
13
13
|
* take over.
|
|
14
|
-
*/var
|
|
14
|
+
*/var Ke="isInternationalCheckout";
|
|
15
15
|
/**
|
|
16
16
|
* Build the `from` query value handed to BigCommerce's `/login.php` so that
|
|
17
17
|
* after a successful login the shopper lands back on `cart.php` with the
|
|
18
18
|
* `isInternationalCheckout=true` flag set (plus any `zonosTestMode` /
|
|
19
19
|
* `zonosQaUrl` / `zonosQaUrlApi` that were on the current URL, so the
|
|
20
20
|
* preview build / API host / test credentials carry through the round trip).
|
|
21
|
-
*/var
|
|
21
|
+
*/var Ze=function(){var e=new URLSearchParams;e.set(Ke,"true");var o=new URLSearchParams(window.location.search);var t=o.get("zonosQaUrl");if(t){e.set("zonosQaUrl",t)}var n=o.get("zonosQaUrlApi");if(n){e.set("zonosQaUrlApi",n)}if(he()){e.set("zonosTestMode","1")}return"cart.php?".concat(e.toString())};
|
|
22
22
|
/**
|
|
23
23
|
* Build an absolute URL to BigCommerce's `/login.php` with the
|
|
24
24
|
* `from=cart.php?isInternationalCheckout=true` round-trip encoded so the
|
|
@@ -28,13 +28,13 @@ return[2/*return*/,r]}}))}))};var Ne=function(e){var o=e.cartId,t=e.checkoutSess
|
|
|
28
28
|
* URL across the redirect — the login round trip leaves BC's frontend, so
|
|
29
29
|
* without this the returning `cart.php` would drop back to the production
|
|
30
30
|
* build / API host.
|
|
31
|
-
*/var
|
|
31
|
+
*/var Ge=function(e){var o=e===void 0?{}:e,t=o.action;var n=new URL("/login.php",window.location.origin);if(t){n.searchParams.set("action",t)}var r=new URLSearchParams(window.location.search);
|
|
32
32
|
// set zonosQaUrl from the current URL
|
|
33
33
|
var i=r.get("zonosQaUrl");if(i){n.searchParams.set("zonosQaUrl",i)}
|
|
34
34
|
// set zonosQaUrlApi from the current URL
|
|
35
35
|
var s=r.get("zonosQaUrlApi");if(s){n.searchParams.set("zonosQaUrlApi",s)}
|
|
36
36
|
// set zonosTestMode from the current URL
|
|
37
|
-
if(
|
|
37
|
+
if(he()){n.searchParams.set("zonosTestMode","1")}n.searchParams.set("from",Ze());return n.toString()};
|
|
38
38
|
/**
|
|
39
39
|
* Build an absolute redirect URL used by the BigCommerce checkout flows to
|
|
40
40
|
* navigate between the BC native `/checkout` page and the Zonos international
|
|
@@ -44,31 +44,31 @@ if(le()){n.searchParams.set("zonosTestMode","1")}n.searchParams.set("from",Fe())
|
|
|
44
44
|
* present) so the preview Zonos elements build keeps loading after the
|
|
45
45
|
* redirect, and sets `zonosTestMode=1` when test mode is active so the
|
|
46
46
|
* destination page continues to use the test credentials.
|
|
47
|
-
*/var
|
|
47
|
+
*/var Ve=function(e){var o=new URL(e,window.location.origin);var t=new URLSearchParams(window.location.search);var n=t.get("zonosQaUrl");if(n){o.searchParams.set("zonosQaUrl",n)}
|
|
48
48
|
// zonosDebug=1
|
|
49
|
-
if(t.get("zonosDebug")==="1"){o.searchParams.set("zonosDebug","1")}if(
|
|
49
|
+
if(t.get("zonosDebug")==="1"){o.searchParams.set("zonosDebug","1")}if(he()){o.searchParams.set("zonosTestMode","1")}return o.toString()};var Qe={customerGroupId:null,shouldBypass:false};
|
|
50
50
|
/**
|
|
51
51
|
* Performs the actual fetch logic to determine if the customer
|
|
52
52
|
* belongs to a bypass group.
|
|
53
|
-
*/var
|
|
53
|
+
*/var We=function(e){return __awaiter(Re,void 0,void 0,(function(){var o,t,n,r,i,s,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:
|
|
54
54
|
// Only relevant for BigCommerce stores — permanent no-op on other platforms
|
|
55
|
-
if(!window.Zonos.isBigCommerce){return[2/*return*/,{conclusive:true,result:
|
|
55
|
+
if(!window.Zonos.isBigCommerce){return[2/*return*/,{conclusive:true,result:Qe}]}i=(o=ae.genericSettings)===null||o===void 0?void 0:o.bigcommerceBypassCustomerGroupIds;if(!(i===null||i===void 0?void 0:i.length)){if(ae.loadedConfig){
|
|
56
56
|
// Settings have finished loading and there are no bypass groups
|
|
57
57
|
// configured — this is a permanent "bypass not configured" answer.
|
|
58
|
-
return[2/*return*/,{conclusive:true,result:
|
|
58
|
+
return[2/*return*/,{conclusive:true,result:Qe}]}
|
|
59
59
|
// Settings haven't loaded yet — the empty list may be transient.
|
|
60
60
|
// Mark as inconclusive so a later caller retries after config loads.
|
|
61
|
-
return[2/*return*/,{conclusive:false,result:
|
|
61
|
+
return[2/*return*/,{conclusive:false,result:Qe}]}if(!e)return[3/*break*/,1];c=e.checkoutId;return[3/*break*/,3];case 1:return[4/*yield*/,Y()];case 2:c=h.sent();h.label=3;case 3:s=c;if(!s){
|
|
62
62
|
// No active cart yet — inconclusive. Common on fresh sessions where
|
|
63
63
|
// `initBigCommerceBypassCheck` runs before the user has added anything
|
|
64
64
|
// to their cart; once the cart exists we need to re-fetch.
|
|
65
|
-
|
|
65
|
+
_e("BigCommerce bypass check: no active cart yet, will retry on next call","info");return[2/*return*/,{conclusive:false,result:Qe}]}if(!e)return[3/*break*/,4];u=e.checkout;return[3/*break*/,6];case 4:return[4/*yield*/,q(s)];case 5:u=h.sent();h.label=6;case 6:a=u;if(!a){
|
|
66
66
|
// API call failed (network error, non-200, etc.) — inconclusive.
|
|
67
67
|
// Caching this would permanently disable bypass for the session if
|
|
68
68
|
// the logged-in user is actually a reseller.
|
|
69
|
-
|
|
69
|
+
_e("BigCommerce bypass check: failed to fetch checkout data, will retry","info");return[2/*return*/,{conclusive:false,result:Qe}]}d=(r=(n=(t=a.customer)===null||t===void 0?void 0:t.customerGroup)===null||n===void 0?void 0:n.id)!==null&&r!==void 0?r:null;if(d===null){_e("BigCommerce bypass check: no customer group found (guest user)","info");
|
|
70
70
|
// Guest user with an active cart — a definitive "no bypass" answer.
|
|
71
|
-
return[2/*return*/,{conclusive:true,result:
|
|
71
|
+
return[2/*return*/,{conclusive:true,result:Qe}]}l=i.includes(d);f={customerGroupId:d,shouldBypass:l};if(l){_e("BigCommerce bypass check: customer group ".concat(String(d)," is in bypass list; caller should keep the user on BC native checkout"),"info")}else{_e("BigCommerce bypass check: customer group ".concat(String(d)," is not in bypass list"),"info")}return[2/*return*/,{conclusive:true,result:f}]}}))}))};
|
|
72
72
|
/**
|
|
73
73
|
* Module-level promise that holds the in-flight or resolved bypass check.
|
|
74
74
|
* Set by `initBigCommerceBypassCheck` on page load so the result is ready
|
|
@@ -77,17 +77,17 @@ return[2/*return*/,{conclusive:true,result:Ke}]}l=i.includes(d);f={customerGroup
|
|
|
77
77
|
* Automatically invalidated when a fetch resolves to an inconclusive outcome,
|
|
78
78
|
* so subsequent callers retry (e.g. after the user adds an item to their
|
|
79
79
|
* cart or after settings finish loading).
|
|
80
|
-
*/var
|
|
80
|
+
*/var Ye=null;var qe=function(e){var o=We(e);var t=o.then((function(e){var o=e.conclusive,n=e.result;if(!o&&Ye===t){
|
|
81
81
|
// Invalidate cache so the next caller performs a fresh fetch.
|
|
82
|
-
|
|
82
|
+
Ye=null}return n}));Ye=t;return t};
|
|
83
83
|
/**
|
|
84
84
|
* Start fetching the BigCommerce customer group on page load.
|
|
85
85
|
* Call this once during initialization (e.g. in `zonos-checkout.init()`).
|
|
86
86
|
* The fetch runs in the background; `checkBigCommerceBypassCustomerGroup`
|
|
87
87
|
* will await the result when needed.
|
|
88
|
-
*/var
|
|
88
|
+
*/var Je=function(){var e;if(!window.Zonos.isBigCommerce){return}var o=(e=ae.genericSettings)===null||e===void 0?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(o===null||o===void 0?void 0:o.length)){return}
|
|
89
89
|
// Fire the fetch immediately; consumers will await the same promise
|
|
90
|
-
void
|
|
90
|
+
void qe()};
|
|
91
91
|
/**
|
|
92
92
|
* Check if the current BigCommerce customer belongs to a customer group
|
|
93
93
|
* that should bypass Zonos Checkout.
|
|
@@ -102,20 +102,20 @@ void Ve()};
|
|
|
102
102
|
* always fetches fresh BigCommerce checkout data. Use this on the
|
|
103
103
|
* BigCommerce domestic checkout page when the shipping country changes,
|
|
104
104
|
* to ensure the customer group reflects the current checkout state.
|
|
105
|
-
*/var
|
|
105
|
+
*/var Xe=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Re,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!Ye){return[2/*return*/,qe(e.preFetched)]}return[2/*return*/,Ye]}))}))};var $e={guestCheckoutType:null};
|
|
106
106
|
/**
|
|
107
107
|
* BigCommerce's `/checkouts/settings` values almost never change after a
|
|
108
108
|
* merchant's initial setup, so we persist the result in `localStorage` and
|
|
109
109
|
* reuse it across page loads up to this TTL. Short enough that if the
|
|
110
110
|
* merchant flips `guest_checkout_type` the change still propagates within
|
|
111
111
|
* an hour.
|
|
112
|
-
*/var
|
|
112
|
+
*/var eo=60*60*1e3;var oo="zonos--bc-checkout-settings";var to=function(e){try{var o=window.localStorage.getItem(oo);if(!o){return null}var t=ve(o);if(!t){return null}
|
|
113
113
|
// Different store on the same origin (e.g. zonosQaUrl preview) — ignore.
|
|
114
114
|
if(t.storeHash!==e){return null}if(t.expiresAt<Date.now()){return null}return{guestCheckoutType:t.guestCheckoutType}}catch(e){
|
|
115
115
|
// localStorage access can throw in blocked-storage contexts (Safari
|
|
116
116
|
// private mode, cross-origin iframes) — treat as a cache miss so the
|
|
117
117
|
// network fallback runs.
|
|
118
|
-
return null}};var
|
|
118
|
+
return null}};var no=function(e,o){try{var t={expiresAt:Date.now()+eo,guestCheckoutType:o.guestCheckoutType,storeHash:e};window.localStorage.setItem(oo,JSON.stringify(t))}catch(e){
|
|
119
119
|
// localStorage can be disabled / quota-exceeded in some browser contexts
|
|
120
120
|
// (private mode, cross-origin iframes) — drop silently since caching
|
|
121
121
|
// is only an optimization.
|
|
@@ -128,7 +128,7 @@ return null}};var $e=function(e,o){try{var t={expiresAt:Date.now()+qe,guestCheck
|
|
|
128
128
|
* Results are cached in `localStorage` for `CACHE_TTL_MS` so navigations
|
|
129
129
|
* inside the same store don't all pay the proxy round trip — the setting
|
|
130
130
|
* is merchant-level and rarely changes.
|
|
131
|
-
*/var
|
|
131
|
+
*/var ro=function(){return __awaiter(Re,void 0,void 0,(function(){var e,o,t,n,r,i,s;return __generator(this,(function(c){switch(c.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/,$e]}o=(e=ae.checkoutSettings.bigCommerceConfig)===null||e===void 0?void 0:e.storeHash;if(!o){_e("BigCommerce checkout settings: no storeHash provided — skipping fetch","info");return[2/*return*/,$e]}t=to(o);if(t){return[2/*return*/,t]}return[4/*yield*/,fe("/api/bigcommerce/checkout-settings",{body:{storeHash:o},method:"POST"})];case 1:n=c.sent(),r=n.errors,i=n.json;if(r.length||!i){_e("BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior","info");return[2/*return*/,$e]}s={guestCheckoutType:i.guestCheckoutType};no(o,s);return[2/*return*/,s]}}))}))};var io={redirectUrl:null,shouldForceLogin:false};
|
|
132
132
|
/**
|
|
133
133
|
* Session cache for the merchant-level "does BC require login?" answer.
|
|
134
134
|
* Hitting `/checkouts/settings` on every checkout open would add a visible
|
|
@@ -137,22 +137,22 @@ return null}};var $e=function(e,o){try{var t={expiresAt:Date.now()+qe,guestCheck
|
|
|
137
137
|
*
|
|
138
138
|
* `null` means we haven't kicked off the fetch yet; the promise holds the
|
|
139
139
|
* eventual boolean so multiple concurrent callers deduplicate.
|
|
140
|
-
*/var
|
|
140
|
+
*/var so=null;var co=function(){if(!so){var e=ro().then((function(o){var t=o.guestCheckoutType;if(!t){
|
|
141
141
|
// `null` here means either the proxy call failed (transient) or the
|
|
142
142
|
// storeHash wasn't known yet. Fail open for this call, but clear
|
|
143
143
|
// the cached promise so the next caller retries instead of
|
|
144
144
|
// permanently disabling force-login for the rest of the session.
|
|
145
|
-
if(
|
|
145
|
+
if(so===e){so=null}return false}return t==="no_guest_checkout"})).catch((function(){
|
|
146
146
|
// Defense-in-depth: `fetchBigCommerceCheckoutSettings` is expected to
|
|
147
147
|
// swallow its own errors, but if anything above does reject we fail
|
|
148
148
|
// open and clear the cached promise so the next caller can retry.
|
|
149
|
-
if(
|
|
149
|
+
if(so===e){so=null}return false}));so=e}return so};
|
|
150
150
|
/**
|
|
151
151
|
* Kick off the `/checkouts/settings` fetch in the background on page load
|
|
152
152
|
* so the result is warm by the time the shopper opens checkout. Safe to
|
|
153
153
|
* call more than once — re-invocations reuse the in-flight/resolved
|
|
154
154
|
* promise.
|
|
155
|
-
*/var
|
|
155
|
+
*/var ao=function(){if(!window.Zonos.isBigCommerce){return}void co()};
|
|
156
156
|
/**
|
|
157
157
|
* Decide whether the current BigCommerce shopper must sign in before the
|
|
158
158
|
* Zonos international checkout is allowed to open.
|
|
@@ -167,18 +167,18 @@ if(to===e){to=null}return false}));to=e}return to};
|
|
|
167
167
|
* Returning a `redirectUrl` is an instruction, not an action: callers drive
|
|
168
168
|
* the navigation themselves so they can short-circuit any UI state (loading
|
|
169
169
|
* overlays, dialog open flags) before `window.location.href` flips.
|
|
170
|
-
*/var
|
|
170
|
+
*/var uo=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Re,__spreadArray([],e,true),void 0,(function(e){var o,t,n,r,i;var s=e===void 0?{}:e,c=s.preFetched;return __generator(this,(function(e){switch(e.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/,io]}return[4/*yield*/,co()];case 1:o=e.sent();if(!o){return[2/*return*/,io]}if(!c)return[3/*break*/,2];n=c.checkoutId;return[3/*break*/,4];case 2:return[4/*yield*/,Y()];case 3:n=e.sent();e.label=4;case 4:t=n;if(!t){
|
|
171
171
|
// No active cart — nothing to protect. Force-login only matters once
|
|
172
172
|
// the shopper has a cart we're about to carry into Zonos checkout.
|
|
173
|
-
return[2/*return*/,
|
|
173
|
+
return[2/*return*/,io]}if(!c)return[3/*break*/,5];i=c.checkout;return[3/*break*/,7];case 5:return[4/*yield*/,q(t)];case 6:i=e.sent();e.label=7;case 7:r=i;if(!r){
|
|
174
174
|
// Storefront API failure — fail open so a transient outage doesn't
|
|
175
175
|
// block the shopper. The merchant's BC checkout will still enforce
|
|
176
176
|
// login server-side as a last line of defense.
|
|
177
|
-
|
|
177
|
+
_e("BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue","info");return[2/*return*/,io]}if(J(r)){return[2/*return*/,io]}_e("BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php","info");return[2/*return*/,{redirectUrl:Ge(),shouldForceLogin:true}]}}))}))};
|
|
178
178
|
/**
|
|
179
179
|
* Mark we've already rewritten a given anchor so the MutationObserver
|
|
180
180
|
* doesn't loop on its own mutation.
|
|
181
|
-
*/var
|
|
181
|
+
*/var lo="data-zonos-login-from-rewritten";var fo='a[href*="login.php?action=create_account"]:not(['+lo+"])";var ho=function(){var e=document.querySelectorAll(fo);if(!e.length){return}var o=Ge({action:"create_account"});e.forEach((function(e){e.setAttribute("href",o);e.setAttribute(lo,"true")}))};
|
|
182
182
|
/**
|
|
183
183
|
* On BigCommerce's `/login.php`, the default **Create account** button links
|
|
184
184
|
* to `login.php?action=create_account` without the `from=cart.php...`
|
|
@@ -194,19 +194,19 @@ ye("BigCommerce force-login check: failed to fetch checkout data, allowing flow
|
|
|
194
194
|
*
|
|
195
195
|
* Safe to call more than once — idempotent thanks to the `data-zonos-…`
|
|
196
196
|
* attribute on rewritten anchors.
|
|
197
|
-
*/var
|
|
197
|
+
*/var vo=function(){if(!window.Zonos.isBigCommerce){return}if(!window.location.pathname.includes("/login.php")){return}ho();
|
|
198
198
|
// BC's login page often renders the auth form asynchronously, so the
|
|
199
199
|
// anchor may not exist yet when this runs. Observe for a short window,
|
|
200
200
|
// then stop so we don't leak a listener for the rest of the session.
|
|
201
|
-
var e=new MutationObserver((function(){
|
|
201
|
+
var e=new MutationObserver((function(){ho()}));e.observe(document.body,{childList:true,subtree:true});
|
|
202
202
|
// 10 seconds is plenty for the login form to mount; stopping the observer
|
|
203
203
|
// avoids churn from the rest of the page's normal DOM activity.
|
|
204
|
-
setTimeout((function(){return e.disconnect()}),1e4)};var
|
|
204
|
+
setTimeout((function(){return e.disconnect()}),1e4)};var mo=function(e,o){
|
|
205
205
|
// Skip entries missing the fields the address form treats as required.
|
|
206
206
|
if(!e.address1||!e.countryCode){return null}var t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return{address:{city:e.city||"",country:e.countryCode,line1:e.address1,line2:e.address2||"",postal_code:e.postalCode||"",
|
|
207
207
|
// Prefer the ISO subdivision code when present so it round-trips through
|
|
208
208
|
// Stripe; fall back to the human-readable state name.
|
|
209
|
-
state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone||""}};var
|
|
209
|
+
state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone||""}};var po=function(e){return[e.address.line1,e.address.line2||"",e.address.postal_code,e.address.country].join("|").toLowerCase()};
|
|
210
210
|
/**
|
|
211
211
|
* Extract a logged-in BigCommerce shopper's known addresses from a Storefront
|
|
212
212
|
* API checkout response and convert them into the shape that `zonos-address`
|
|
@@ -226,37 +226,37 @@ state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone
|
|
|
226
226
|
*
|
|
227
227
|
* Returns an empty list for guest sessions (no `customer.id`) or when the
|
|
228
228
|
* checkout response is missing the relevant includes.
|
|
229
|
-
*/var
|
|
229
|
+
*/var go=function(e,o){var t,n,r,i;if(!((t=e===null||e===void 0?void 0:e.customer)===null||t===void 0?void 0:t.id)){return[]}var s=o.isShippable,c=o.selectedCountryCode;var a=e.customer.email||"";var u=(r=(n=e.consignments)===null||n===void 0?void 0:n.flatMap((function(e){return e.shippingAddress?[e.shippingAddress]:[]})))!==null&&r!==void 0?r:[];var d=(i=e.customer.addresses)!==null&&i!==void 0?i:[];var l=new Set;var f=[];
|
|
230
230
|
// Iterate saved addresses first so the dedup key for an address present in
|
|
231
231
|
// both lists keeps the saved-book version (which carries an `id` and is the
|
|
232
232
|
// shopper's canonical entry).
|
|
233
|
-
for(var h=0,v=__spreadArray(__spreadArray([],d,true),u,true);h<v.length;h++){var m=v[h];var p=
|
|
233
|
+
for(var h=0,v=__spreadArray(__spreadArray([],d,true),u,true);h<v.length;h++){var m=v[h];var p=mo(m,a);if(!p){continue}if(!s(p.address.country)){continue}var g=po(p);if(l.has(g)){continue}l.add(g);f.push(p)}if(!c){return f}
|
|
234
234
|
// Stable-sort the survivors so addresses matching the currently-selected
|
|
235
235
|
// country come first while everything else keeps its original order.
|
|
236
|
-
return f.map((function(e,o){return{index:o,option:e}})).sort((function(e,o){var t=e.option.address.country===c;var n=o.option.address.country===c;if(t===n){return e.index-o.index}return t?-1:1})).map((function(e){return e.option}))};var
|
|
236
|
+
return f.map((function(e,o){return{index:o,option:e}})).sort((function(e,o){var t=e.option.address.country===c;var n=o.option.address.country===c;if(t===n){return e.index-o.index}return t?-1:1})).map((function(e){return e.option}))};var wo=function(e){if(e===void 0){e=true}if(!X.localizationLoaded){return true}if(X.isDisabledCountry){if(e){_e("Checkout: disabled country")}return true}return false};
|
|
237
237
|
/**
|
|
238
238
|
* BigCommerce checkout depends on storefront callbacks (clear cart, inventory).
|
|
239
239
|
* The hosted variant leaves the storefront, so the test does not apply there.
|
|
240
|
-
*/var
|
|
240
|
+
*/var zo=function(e){var o=e.createCartId,t=e.enabledTestKeys,n=e.isBigCommerce;if(n){return false}if(typeof o!=="function"){return false}return t.includes("hosted_vs_native")};var ko=function(e,
|
|
241
241
|
/**
|
|
242
242
|
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
243
243
|
*/
|
|
244
|
-
o){if(e===void 0){e=true}if(!
|
|
244
|
+
o){if(e===void 0){e=true}if(!X.localizationLoaded){return false}if(o){var t=$(o);if(e&&!t){_e("Checkout: ".concat(o," is not a shippable country: ").concat(t))}return t}
|
|
245
245
|
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
246
|
-
if(!
|
|
246
|
+
if(!X.isShippableCountry){if(e){_e("Checkout: not shippable country")}return false}return true};var yo=["1","true","yes"];
|
|
247
247
|
/**
|
|
248
248
|
* Page-load result of reading the checkout `zBypass` query. Later calls on the
|
|
249
249
|
* same checkout URL reuse this so stripping the parameter does not change the
|
|
250
250
|
* answer.
|
|
251
|
-
*/var
|
|
251
|
+
*/var bo=null;var _o=function(){return Be(window.location.pathname)};var Co=function(e){if(e===null){return false}return yo.includes(e.trim().toLowerCase())};
|
|
252
252
|
/**
|
|
253
253
|
* True only when zonos-settings set
|
|
254
254
|
* `checkoutSettings.plugins.bigcommerce.allowBypassQuery` to `true`.
|
|
255
|
-
*/var
|
|
255
|
+
*/var xo=function(){var e,o;return((o=(e=ae.checkoutSettings.plugins)===null||e===void 0?void 0:e.bigcommerce)===null||o===void 0?void 0:o.allowBypassQuery)===true};
|
|
256
256
|
/**
|
|
257
257
|
* Read an accepted `zBypass` query on the checkout page once, then remove it
|
|
258
258
|
* from the URL. A later call on that same URL returns the same answer.
|
|
259
|
-
*/var
|
|
259
|
+
*/var So=function(){var e=window.location,o=e.pathname,t=e.search;if(bo&&bo.pathname===o&&bo.search===t){return bo.enabled}var n=new URLSearchParams(t);var r=Co(n.get("zBypass"));if(!r){bo={enabled:false,pathname:o,search:t};return false}n.delete("zBypass");var i=n.toString();var s=window.location.hash||"";var c="".concat(o).concat(i?"?".concat(i):"").concat(s);window.history.replaceState(window.history.state,document.title,c);var a=xo();bo={enabled:a,pathname:o,search:window.location.search};return a};
|
|
260
260
|
/**
|
|
261
261
|
* True when this BigCommerce checkout page should skip address detection.
|
|
262
262
|
* That is only when zonos-settings allows the `zBypass` query and this
|
|
@@ -264,69 +264,69 @@ if(!q.isShippableCountry){if(e){ye("Checkout: not shippable country")}return fal
|
|
|
264
264
|
* the query stays in the URL until checkout. The query is removed once, and
|
|
265
265
|
* later calls on that checkout URL keep the same answer. Nothing is written
|
|
266
266
|
* to storage.
|
|
267
|
-
*/var
|
|
267
|
+
*/var Io=function(){var e;if(!((e=window.Zonos)===null||e===void 0?void 0:e.isBigCommerce)||!_o()){return false}return So()};var To='select[name="shippingAddress.countryCode"]';
|
|
268
268
|
/**
|
|
269
269
|
* Native BigCommerce shipping-step "Continue" button. Clicking it commits the
|
|
270
270
|
* selected shipping address and advances to the payment step.
|
|
271
|
-
*/var
|
|
271
|
+
*/var Ao="#checkout-shipping-continue, #checkout-billing-continue, #checkout-payment-continue";
|
|
272
272
|
/**
|
|
273
273
|
* Check if the logged-in user already has a shipping address on the checkout
|
|
274
274
|
* that is internationally shippable. If so, optionally prompt the user to
|
|
275
275
|
* confirm before saving the address to session and redirecting to the home
|
|
276
276
|
* page to open the international checkout.
|
|
277
|
-
*/var
|
|
277
|
+
*/var Oo=function(e){return __awaiter(Re,[e],void 0,(function(e){var o,t,n,r,i,s,c,a,d,l,f,h,v,m,p,g,w,z;var k=e.onInternationalCheckoutSelected,y=e.onLoggedInInternationalAddressDetected;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,Y()];case 1:f=e.sent();if(!f){return[2/*return*/,"noAction"]}return[4/*yield*/,q(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4/*yield*/,Xe({preFetched:v})];case 3:m=e.sent().shouldBypass;if(m){return[2/*return*/,"noAction"]}p=(t=(o=h===null||h===void 0?void 0:h.consignments)===null||o===void 0?void 0:o[0])===null||t===void 0?void 0:t.shippingAddress;if(!(p===null||p===void 0?void 0:p.countryCode)){return[2/*return*/,"noAction"]}g=p.countryCode;if(!ko(false,g)){return[2/*return*/,"noAction"]}_e(y?"Logged-in user has international shipping address: ".concat(g,", prompting user to choose checkout"):"Logged-in user has international shipping address: ".concat(g,", redirecting automatically (legacy behavior)"),"info");if(!y)return[3/*break*/,5];return[4/*yield*/,y()];case 4:w=e.sent();if(w==="stay"){_e("User opted to stay on BigCommerce native checkout despite international default address","info");return[2/*return*/,"optedOut"]}e.label=5;case 5:return[4/*yield*/,uo({preFetched:v})];case 6:z=e.sent();if(z.shouldForceLogin&&z.redirectUrl){window.location.href=z.redirectUrl;return[2/*return*/,"redirected"]}if(!k)return[3/*break*/,8];return[4/*yield*/,k()];case 7:e.sent();e.label=8;case 8:
|
|
278
278
|
// Update localization store with the detected country
|
|
279
|
-
|
|
279
|
+
ee({isInitializing:false,newSelectedCountryCode:g,persistOverride:false});
|
|
280
280
|
// Save the shipping address to session storage for the international checkout
|
|
281
|
-
|
|
281
|
+
u({address1:(n=p.address1)!==null&&n!==void 0?n:"",address2:(r=p.address2)!==null&&r!==void 0?r:"",city:(i=p.city)!==null&&i!==void 0?i:"",countryCode:g,firstName:(s=p.firstName)!==null&&s!==void 0?s:"",lastName:(c=p.lastName)!==null&&c!==void 0?c:"",phone:(a=p.phone)!==null&&a!==void 0?a:"",postalCode:(d=p.postalCode)!==null&&d!==void 0?d:"",state:(l=p.stateOrProvince)!==null&&l!==void 0?l:""});
|
|
282
282
|
// Redirect to home page — the home page will open the international checkout
|
|
283
283
|
// when it detects the domestic shipping session. Carry over zonosQaUrl /
|
|
284
284
|
// zonosTestMode so the destination page keeps using the same build/env.
|
|
285
|
-
window.location.href=
|
|
285
|
+
window.location.href=Ve("/");return[2/*return*/,"redirected"]}}))}))};
|
|
286
286
|
/**
|
|
287
287
|
* Watch for changes in domestic checkout step. Redirects user to home page to open international checkout when user selects a country in the international shipping zone.
|
|
288
288
|
* @note Only works on default bigcommerce checkout page
|
|
289
|
-
*/var
|
|
289
|
+
*/var Bo=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onInternationalCheckoutSelected,n=e.onLoggedInInternationalAddressDetected,r=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}
|
|
290
290
|
// Only the native checkout page skips address detection. Storefront pages
|
|
291
291
|
// still run the domestic-session handoff below, and they do not consume
|
|
292
292
|
// a `zBypass` query, so the parameter can survive until `/checkout`.
|
|
293
|
-
if(window.location.pathname
|
|
293
|
+
if(Be(window.location.pathname)&&Io()){return}
|
|
294
294
|
/**
|
|
295
295
|
* Keep checking.
|
|
296
296
|
* @returns `true` if the caller should stop polling — either because the user
|
|
297
297
|
* is being redirected to Zonos international checkout, or because the
|
|
298
298
|
* logged-in customer is in a bypass group and should stay on BC checkout.
|
|
299
|
-
*/var
|
|
299
|
+
*/var d=function(e){return __awaiter(Re,void 0,void 0,(function(){var o,n,r,i,s,c,a,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:n=document.querySelector(((o=ae.genericSettings)===null||o===void 0?void 0:o.bigcommerceDomesticCheckoutCountrySelector)||To);r=(n===null||n===void 0?void 0:n.value)||e;if(!r){
|
|
300
300
|
// do nothing if shipping country is not found
|
|
301
|
-
return[2/*return*/,"noAction"]}if(!
|
|
301
|
+
return[2/*return*/,"noAction"]}if(!ko(false,r)){
|
|
302
302
|
// do nothing if shipping country is not shippable
|
|
303
|
-
return[2/*return*/,"noAction"]}return[4/*yield*/,
|
|
303
|
+
return[2/*return*/,"noAction"]}return[4/*yield*/,Y()];case 1:i=h.sent();if(!i)return[3/*break*/,3];return[4/*yield*/,q(i)];case 2:c=h.sent();return[3/*break*/,4];case 3:c=null;h.label=4;case 4:s=c;a={checkout:s,checkoutId:i};return[4/*yield*/,Xe({forceRefresh:true,preFetched:a})];case 5:d=h.sent().shouldBypass;if(d){
|
|
304
304
|
// Logged-in customer is in a bypass group — keep them on BC native
|
|
305
305
|
// checkout and stop polling / fetching further.
|
|
306
|
-
|
|
306
|
+
_e("Bypass customer group detected on BC checkout, stopping interval","info");return[2/*return*/,"bypass"]}return[4/*yield*/,uo({preFetched:a})];case 6:l=h.sent();if(l.shouldForceLogin&&l.redirectUrl){window.location.href=l.redirectUrl;return[2/*return*/,"redirected"]}if(!t)return[3/*break*/,8];return[4/*yield*/,t()];case 7:h.sent();h.label=8;case 8:
|
|
307
307
|
// update the country code in localization store and check if it's shippable
|
|
308
|
-
|
|
308
|
+
ee({isInitializing:false,newSelectedCountryCode:r,persistOverride:false});f={address1:"",address2:"",city:"",countryCode:r,firstName:"",lastName:"",phone:"",postalCode:"",stateOrProvince:""};
|
|
309
309
|
// save the shipping address to session storage
|
|
310
|
-
|
|
310
|
+
u({address1:f.address1,address2:f.address2,city:f.city,countryCode:f.countryCode,firstName:f.firstName,lastName:f.lastName,phone:f.phone,postalCode:f.postalCode,state:f.stateOrProvince});
|
|
311
311
|
// redirect to home page, home page then will open the checkout dialog if
|
|
312
312
|
// having domestic shipping session. Carry over zonosQaUrl / zonosTestMode
|
|
313
313
|
// so the destination page keeps using the same build/env.
|
|
314
|
-
window.location.href=
|
|
314
|
+
window.location.href=Ve("/");return[2/*return*/,"redirected"]}}))}))};
|
|
315
315
|
/**
|
|
316
316
|
* When `true`, the logged-in "Continue" hook re-dispatched the shopper's
|
|
317
317
|
* click so BigCommerce's own handler can run (domestic / bypass case). The
|
|
318
318
|
* hook's listener sees this flag and lets the event through untouched.
|
|
319
|
-
*/var
|
|
319
|
+
*/var l=false;
|
|
320
320
|
/**
|
|
321
321
|
* Set to `true` once the document-level "Continue" click delegation has been
|
|
322
322
|
* attached, so opting out repeatedly doesn't bind it more than once.
|
|
323
|
-
*/var
|
|
323
|
+
*/var f=false;
|
|
324
324
|
/**
|
|
325
325
|
* Resolve the shopper's currently-selected shipping country on the BC native
|
|
326
326
|
* checkout. Logged-in shoppers picking a saved address don't expose a
|
|
327
327
|
* country `<select>`, so read it from the active checkout consignment via the
|
|
328
328
|
* Storefront API; fall back to the `<select>` value when one is present.
|
|
329
|
-
*/var
|
|
329
|
+
*/var h=function(){return __awaiter(Re,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:return[4/*yield*/,Y()];case 1:r=a.sent();if(!r)return[3/*break*/,3];return[4/*yield*/,q(r)];case 2:i=a.sent();s=(t=(o=(e=i===null||i===void 0?void 0:i.consignments)===null||e===void 0?void 0:e[0])===null||o===void 0?void 0:o.shippingAddress)===null||t===void 0?void 0:t.countryCode;if(s){return[2/*return*/,s]}a.label=3;case 3:c=document.querySelector(((n=ae.genericSettings)===null||n===void 0?void 0:n.bigcommerceDomesticCheckoutCountrySelector)||To);return[2/*return*/,(c===null||c===void 0?void 0:c.value)||null]}}))}))};
|
|
330
330
|
/**
|
|
331
331
|
* Req 2 (05CHECK-887): once a logged-in shopper with an international default
|
|
332
332
|
* address has chosen to "Stay on this page", we must still force them onto
|
|
@@ -341,7 +341,7 @@ window.location.href=He("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
341
341
|
* checkout. On any outcome other than a redirect — domestic, bypass group,
|
|
342
342
|
* or an unexpected error — replay the click so BigCommerce's own handler runs
|
|
343
343
|
* and the shopper is never left stuck on the shipping step.
|
|
344
|
-
*/var
|
|
344
|
+
*/var v=function(e,o){return __awaiter(Re,void 0,void 0,(function(){var t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:t=true;a.label=1;case 1:a.trys.push([1,9,,10]);n=null;a.label=2;case 2:a.trys.push([2,4,,5]);return[4/*yield*/,h()];case 3:n=a.sent();return[3/*break*/,5];case 4:r=a.sent();me("Error resolving selected shipping country on BC continue",r);return[3/*break*/,5];case 5:
|
|
345
345
|
// When the shopper is committing an international address we're about to
|
|
346
346
|
// save the domestic shipping session and redirect to `/`. Disconnect this
|
|
347
347
|
// /checkout-page observer first: otherwise its own session-detection
|
|
@@ -349,15 +349,15 @@ window.location.href=He("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
349
349
|
// open checkout locally, consuming and clearing the session before the
|
|
350
350
|
// navigation to `/` lands, leaving the redirect a no-op. (The `/` page
|
|
351
351
|
// runs its own fresh watcher to open checkout.)
|
|
352
|
-
if(n&&
|
|
352
|
+
if(n&&ko(false,n)){o.disconnect()}if(!n)return[3/*break*/,7];return[4/*yield*/,d(n)];case 6:s=a.sent();return[3/*break*/,8];case 7:s="noAction";a.label=8;case 8:i=s;
|
|
353
353
|
// `redirected` → the page is navigating to the Zonos international
|
|
354
354
|
// checkout, so don't replay. `bypass` / `noAction` → the shopper stays on
|
|
355
355
|
// BC native checkout, so fall through and replay the click.
|
|
356
|
-
if(i==="redirected"){t=false}return[3/*break*/,10];case 9:
|
|
356
|
+
if(i==="redirected"){t=false}return[3/*break*/,10];case 9:c=a.sent();
|
|
357
357
|
// We already blocked BC's native click; if resolving the country or the
|
|
358
358
|
// redirect helper throws, replay so BC can advance rather than leaving
|
|
359
359
|
// the shopper stuck on the shipping step.
|
|
360
|
-
|
|
360
|
+
me("Error handling BC continue international redirect",c);return[3/*break*/,10];case 10:if(t){l=true;e.click();l=false}return[2/*return*/]}}))}))};
|
|
361
361
|
/**
|
|
362
362
|
* Req 2 (05CHECK-887): attach the logged-in international-redirect hook via a
|
|
363
363
|
* single capture-phase listener on `document` (delegation) rather than
|
|
@@ -367,21 +367,21 @@ he("Error handling BC continue international redirect",u);return[3/*break*/,10];
|
|
|
367
367
|
* interval: the "Continue" button may only render after that point, so a
|
|
368
368
|
* node-bound listener attached from the observer could miss it entirely.
|
|
369
369
|
* Attached once, on opt-out.
|
|
370
|
-
*/var
|
|
370
|
+
*/var m=function(e){if(f){return}f=true;document.addEventListener("click",(function(o){
|
|
371
371
|
// Programmatic replay for the domestic / bypass case — let BC's own
|
|
372
372
|
// handler run without interference.
|
|
373
|
-
if(
|
|
373
|
+
if(l){return}var t=o.target;if(!(t instanceof Element)){return}var n=t.closest(Ao);if(!n){return}
|
|
374
374
|
// Block BC's native advance until we know whether the selected shipping
|
|
375
375
|
// country forces an international redirect. Capture phase +
|
|
376
376
|
// stopImmediatePropagation (done synchronously here, before the async
|
|
377
377
|
// handler) prevents BC's React click handler from firing.
|
|
378
|
-
o.preventDefault();o.stopImmediatePropagation();void
|
|
378
|
+
o.preventDefault();o.stopImmediatePropagation();void v(n,e)}),true)};var p=false;var g=false;var w=false;
|
|
379
379
|
/**
|
|
380
380
|
* Set to `true` once the logged-in user has been prompted about a detected
|
|
381
381
|
* international default address and chose to stay on the BigCommerce native
|
|
382
382
|
* checkout. Prevents the observer from re-prompting on subsequent DOM
|
|
383
383
|
* mutations.
|
|
384
|
-
*/var
|
|
384
|
+
*/var z=false;
|
|
385
385
|
/**
|
|
386
386
|
* Set to `true` while the logged-in international-address confirmation
|
|
387
387
|
* dialog is open and we are awaiting the user's response. While this
|
|
@@ -389,7 +389,7 @@ o.preventDefault();o.stopImmediatePropagation();void l(n,e)}),true)};var h=false
|
|
|
389
389
|
* `handleInternationalCheckoutSelected` — otherwise the interval would
|
|
390
390
|
* detect the pre-filled international country, show the loading dialog,
|
|
391
391
|
* and redirect before the user has responded to the confirm prompt.
|
|
392
|
-
*/var
|
|
392
|
+
*/var k=false;
|
|
393
393
|
// NOTE: We intentionally do NOT await `checkBigCommerceBypassCustomerGroup()`
|
|
394
394
|
// here before attaching the MutationObserver. The bypass check involves two
|
|
395
395
|
// Storefront API round-trips, and awaiting it synchronously would delay
|
|
@@ -399,59 +399,65 @@ o.preventDefault();o.stopImmediatePropagation();void l(n,e)}),true)};var h=false
|
|
|
399
399
|
// `handleInternationalCheckoutSelected` (both consult the helper), so the
|
|
400
400
|
// top-level gate is redundant. `initBigCommerceBypassCheck()` is called on
|
|
401
401
|
// page load so those inner calls typically resolve against a warm cache.
|
|
402
|
-
var
|
|
402
|
+
var y=new MutationObserver((function(){return __awaiter(Re,void 0,void 0,(function(){var e,u,l,f,h,v,b,_,C,x;var S=this;return __generator(this,(function(I){switch(I.label){case 0:u=document.querySelector(o);l=i();
|
|
403
403
|
// append a hidden button to the body if the shipping address session is found
|
|
404
|
-
if(!
|
|
404
|
+
if(!u&&l){
|
|
405
|
+
// Stripe.js is not loaded on native checkout, so nothing here can click
|
|
406
|
+
// a hidden button or clear this session. Send the shopper to `/` once.
|
|
407
|
+
// Saving or clearing the session drops that hop marker, so a later
|
|
408
|
+
// leftover session still gets its own redirect. If they come back and
|
|
409
|
+
// the session is still set, drop it and keep watching the address.
|
|
410
|
+
if(Ue()){if(s()){c()}else{a();y.disconnect();window.location.href=Ve("/");return[2/*return*/]}}else{f=document.createElement("button");f.style.display="none";f.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(f);r===null||r===void 0?void 0:r(l);
|
|
405
411
|
// disconnect the observer after we found the shipping continue button
|
|
406
|
-
|
|
412
|
+
y.disconnect();return[2/*return*/]}}h=Be(window.location.pathname)&&window.Zonos.isBigCommerce;
|
|
407
413
|
// Should just disconnect the observer if it's not bigcommerce domestic checkout page
|
|
408
|
-
if(!
|
|
414
|
+
if(!h){y.disconnect();return[2/*return*/]}if(!(!z&&!w))return[3/*break*/,5];w=true;k=true;I.label=1;case 1:I.trys.push([1,3,4,5]);return[4/*yield*/,Oo({onInternationalCheckoutSelected:t,onLoggedInInternationalAddressDetected:n})];case 2:v=I.sent();if(v==="redirected"){y.disconnect();return[2/*return*/]}if(v==="optedOut"){
|
|
409
415
|
// User elected to stay on BC native checkout — don't prompt again
|
|
410
416
|
// for the rest of this session. Continue with the rest of the
|
|
411
417
|
// observer logic so the country-change watcher still fires when
|
|
412
418
|
// the user manually picks an international country in BC's UI.
|
|
413
|
-
|
|
419
|
+
z=true;
|
|
414
420
|
// Attach the "Continue" redirect hook now (once). Delegation on
|
|
415
421
|
// `document` keeps it working even after this observer disconnects
|
|
416
422
|
// when the country <select> path sets up its interval below.
|
|
417
|
-
|
|
423
|
+
m(y)}return[3/*break*/,5];case 3:b=I.sent();me("Error checking logged-in user shipping address",b);return[3/*break*/,5];case 4:w=false;k=false;return[7/*endfinally*/];case 5:_=document.querySelector(((e=ae.genericSettings)===null||e===void 0?void 0:e.bigcommerceDomesticCheckoutCountrySelector)||To);
|
|
418
424
|
// Shouldn't do anything if it's not bigcommerce domestic checkout page
|
|
419
|
-
if(!
|
|
425
|
+
if(!_){
|
|
420
426
|
// do nothing if shipping country and the continue button is not found
|
|
421
|
-
return[2/*return*/]}
|
|
427
|
+
return[2/*return*/]}_e("Domestic checkout found - Listening for shipping country change","info",{value:_.value});
|
|
422
428
|
// Should not create a new interval if it's already created
|
|
423
|
-
if(
|
|
429
|
+
if(g){return[2/*return*/]}g=true;
|
|
424
430
|
// disconnect the observer after we know that's bigcommerce domestic checkout page
|
|
425
|
-
|
|
431
|
+
y.disconnect();C=setInterval((function(){return __awaiter(S,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){switch(t.label){case 0:
|
|
426
432
|
// Don't redirect while the logged-in international-address confirm
|
|
427
433
|
// dialog is open — the user hasn't made their choice yet.
|
|
428
|
-
if(
|
|
434
|
+
if(p||k){return[2/*return*/]}p=true;t.label=1;case 1:t.trys.push([1,3,,4]);return[4/*yield*/,d()];case 2:e=t.sent();
|
|
429
435
|
// Stop the interval once either:
|
|
430
436
|
// - the user is being redirected to Zonos international checkout
|
|
431
437
|
// - the logged-in customer is in a bypass group (stay on BC checkout)
|
|
432
|
-
if(e==="redirected"||e==="bypass"){clearInterval(
|
|
438
|
+
if(e==="redirected"||e==="bypass"){clearInterval(C);return[2/*return*/]}p=false;return[3/*break*/,4];case 3:o=t.sent();p=false;return[3/*break*/,4];case 4:return[2/*return*/]}}))}))}),1e3);x=setInterval((function(){var e;if(!window.bcStripeElements){clearInterval(x);return}var o=(e=window.bcStripeElements)===null||e===void 0?void 0:e.getElement("address");if(!o){return}clearInterval(x);o.on("change",(function(e){var o=e.value.address.country;if(o&&!k){void d(o)}}));
|
|
433
439
|
// we want to attacch event to addressElement as soon as it's loaded
|
|
434
|
-
}),500);return[2/*return*/]}}))}))}));
|
|
440
|
+
}),500);return[2/*return*/]}}))}))}));y.observe(document.body,{childList:true,subtree:true})};var Uo=function(){var e=new URLSearchParams(window.location.search);_e("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=
|
|
435
441
|
// fallback to selected country code if country is not provided
|
|
436
|
-
|
|
442
|
+
oe(e)||X.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var f=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:f,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var Eo=0;var Lo=function(){return __awaiter(Re,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:
|
|
437
443
|
// Don't send the log if there are no API calls to send
|
|
438
|
-
if(window.Zonos.loadTimeApiInfoList.length===0){return[2/*return*/]}
|
|
444
|
+
if(window.Zonos.loadTimeApiInfoList.length===0){return[2/*return*/]}_e("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};
|
|
439
445
|
// Clear the list after sending the log successfully
|
|
440
|
-
window.Zonos.loadTimeApiInfoList.length=0;return[4/*yield*/,
|
|
446
|
+
window.Zonos.loadTimeApiInfoList.length=0;return[4/*yield*/,fe("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){
|
|
441
447
|
// If there are errors, add the logs back to the list so we can try again later
|
|
442
|
-
(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);
|
|
448
|
+
(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);Eo++;if(Eo>5&&window.Zonos.logIntervalId){
|
|
443
449
|
// If there are more than 3 failures, stop the interval
|
|
444
|
-
clearInterval(window.Zonos.logIntervalId)}}return[2/*return*/]}}))}))};var
|
|
450
|
+
clearInterval(window.Zonos.logIntervalId)}}return[2/*return*/]}}))}))};var Po=function(){return __awaiter(Re,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=Ce().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:xe},pe()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};void fe("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var Do=function(e){return __awaiter(Re,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:xe},pe()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};void fe("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var jo=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var No=function(e){var o;var t=(o=te.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Ro=function(e){return ae.enabledVariantTestKeys.includes(e)};var Fo=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;
|
|
445
451
|
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
446
|
-
var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+
|
|
452
|
+
var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+ne,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var Mo=function(e){return __awaiter(Re,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=he();return[4/*yield*/,fe("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3/*break*/,3];_e("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});
|
|
447
453
|
// wait 1 second before retrying
|
|
448
454
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,500)}))];case 2:
|
|
449
455
|
// wait 1 second before retrying
|
|
450
|
-
e.sent();return[2/*return*/,
|
|
456
|
+
e.sent();return[2/*return*/,Mo({cartId:s,retries:c-1})];case 3:if(i){return[2/*return*/,null]}return[2/*return*/,r]}}))}))};var Ho=function(e){return __awaiter(Re,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=Se(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){me("[ZONOS - loadZonos] invalid cart id");return[2/*return*/,null]}return[4/*yield*/,Mo({cartId:e,retries:5})];case 1:r=i.sent();_e("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){me("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2/*return*/,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2/*return*/,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Ko='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var Zo=function(){return".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h{z-index:2147483647;position:fixed}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}"};
|
|
451
457
|
// 90 minutes
|
|
452
|
-
var
|
|
458
|
+
var Go=90*60*1e3;
|
|
453
459
|
// 6 hours
|
|
454
|
-
var
|
|
460
|
+
var Vo=6*60*60*1e3;var Qo=e("zonos_checkout",/** @class */function(){function e(e){var t=this;o(this,e);this.storeUnsubscribeList=[];this.isRedirectAfterOrder=false;
|
|
455
461
|
/**
|
|
456
462
|
* Preview checkout without needing to click on the button. This would be useful for demo purpose
|
|
457
463
|
*/this.preview=false;
|
|
@@ -529,21 +535,21 @@ this.collapseReviewMobile=true;
|
|
|
529
535
|
*/this.loggedInIntlAddressResolver=null;
|
|
530
536
|
/**
|
|
531
537
|
* Client secret value
|
|
532
|
-
*/this.clientSecret=
|
|
538
|
+
*/this.clientSecret=d.clientSecret;
|
|
533
539
|
/**
|
|
534
540
|
* Client secret value of customer session (use to load saved payment method and render saved consent)
|
|
535
|
-
*/this.stripeCustomerSessionClientSecret=
|
|
541
|
+
*/this.stripeCustomerSessionClientSecret=d.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||ae.appearance.theme;return[4/*yield*/,l({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,
|
|
536
542
|
// only override theme or theme from appearance if it's mobile
|
|
537
|
-
overrideTheme:this.isMobile?r:undefined,paypalEnabled:
|
|
543
|
+
overrideTheme:this.isMobile?r:undefined,paypalEnabled:Z()})];case 1:i.sent();return[2/*return*/]}}))}))};
|
|
538
544
|
/**
|
|
539
545
|
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
540
|
-
*/this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,a,
|
|
546
|
+
*/this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,c,a,u;var l=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=l===null||l===void 0?void 0:l.matches("#".concat(Ie));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");
|
|
541
547
|
// Allow to proceed to order if Checkout is triggered by Checkout button click by user
|
|
542
|
-
if(!o){
|
|
548
|
+
if(!o){_e("Checkout is triggered by user, no need to check stripe payment intent status");return[2/*return*/,{shouldAllowOrder:true}]}_e("Payment intent exist, checking stripe payment intent status");
|
|
543
549
|
// Allow to proceed to order if there's no stripe client secret and cart data is available
|
|
544
|
-
if(!r){
|
|
550
|
+
if(!r){_e("No stripe client secret found in the URL, proceed to order if cart data is available");return[2/*return*/,{shouldAllowOrder:t}]}return[4/*yield*/,f({clientSecret:r})];case 1:s=e.sent(),c=s.error,a=s.status;u=new URLSearchParams(window.location.search).get("redirect_status");
|
|
545
551
|
// If just redirected from Payment provider, show the success screen or error screen based on the status
|
|
546
|
-
if(
|
|
552
|
+
if(u){if(!c){_e("Payment intent is succeeded or in a good state to move forward, show success screen")}else{_e("Payment intent failed, show status from error")}this.open=true;te.checkoutSessionId=i;d.clientSecret=r;void this.setToFinishStep(a);return[2/*return*/,{shouldAllowOrder:false}]}if(!t){_e("Cart data is not available, only check payment intent status, skip order.");return[2/*return*/,{shouldAllowOrder:false}]}_e("Payment intent is not succeeded, proceed to order");return[2/*return*/,{shouldAllowOrder:true}]}}))}))};
|
|
547
553
|
/**
|
|
548
554
|
* Recover an order-modification payment-only session that was already
|
|
549
555
|
* completed (or already paid but not yet completed) by the time this cart
|
|
@@ -558,38 +564,38 @@ if(l){if(!a){ye("Payment intent is succeeded or in a good state to move forward,
|
|
|
558
564
|
* caller should proceed with a normal init.
|
|
559
565
|
*/this.recoverCompletedOrderModificationSession=function(e){return __awaiter(t,void 0,void 0,(function(){var o,t,n,r,i;return __generator(this,(function(s){switch(s.label){case 0:
|
|
560
566
|
// getCheckoutSession() reads storageStore.checkoutSessionId internally.
|
|
561
|
-
|
|
567
|
+
te.checkoutSessionId=e;return[4/*yield*/,h()];case 1:o=s.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2/*return*/,false]}r=n.checkoutSession;
|
|
562
568
|
// Session already finalized → straight to finish. An order-mod
|
|
563
569
|
// payment-only session always has `order` set *before* payment too (see
|
|
564
570
|
// isOrderModificationPaymentOnlySession) - checking `order` alone would
|
|
565
571
|
// treat every first-ever open as already paid, so both must be true.
|
|
566
|
-
if(r.completedAt&&r.order){void this.setToFinishStep("succeeded");return[2/*return*/,true]}if(!r.clientSecret)return[3/*break*/,3];return[4/*yield*/,
|
|
572
|
+
if(r.completedAt&&r.order){void this.setToFinishStep("succeeded");return[2/*return*/,true]}if(!r.clientSecret)return[3/*break*/,3];return[4/*yield*/,f({clientSecret:r.clientSecret})];case 2:i=s.sent().status;if(i==="processing"||i==="succeeded"){d.clientSecret=r.clientSecret;void this.setToFinishStep(i);return[2/*return*/,true]}s.label=3;case 3:return[2/*return*/,false]}}))}))};this.initializeTestKeys=function(){
|
|
567
573
|
// cleanup expired test keys
|
|
568
|
-
|
|
574
|
+
te.enabledVariantTestKeys=jo(te.enabledVariantTestKeys||[]);
|
|
569
575
|
// map existingSelection to the enabled variant test keys from database
|
|
570
|
-
var e=
|
|
576
|
+
var e=ae.enabledVariantTestKeys.map((function(e){var o;
|
|
571
577
|
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
572
|
-
var t=(o=
|
|
578
|
+
var t=(o=te.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+ne,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));re(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){var e;return zo({createCartId:ae.checkoutSettings.createCartId,enabledTestKeys:ae.enabledVariantTestKeys,isBigCommerce:Boolean((e=window.Zonos)===null||e===void 0?void 0:e.isBigCommerce)})};
|
|
573
579
|
// Register test hosted vs native if needed to get the variant selection for this test
|
|
574
|
-
this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2/*return*/]}
|
|
580
|
+
this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2/*return*/]}_e("[TEST] - Registering hosted vs native test");o=No("hosted_vs_native");
|
|
575
581
|
// No need to request variant test for this test if the test already has variant selected
|
|
576
|
-
if(o){
|
|
582
|
+
if(o){_e("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2/*return*/]}return[4/*yield*/,Me({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();
|
|
577
583
|
// Do not prevent user from proceeding if the test is not enabled or failed to get selection
|
|
578
|
-
if(!t){
|
|
584
|
+
if(!t){_e("[TEST] - Failed to get selection for hosted vs native test");return[2/*return*/]}n=Fo({baseTestObj:te.enabledVariantTestKeys||[],mergeTestObj:t});
|
|
579
585
|
// Set the selected variant to the storage store
|
|
580
|
-
|
|
586
|
+
re(n);return[2/*return*/]}}))}))};
|
|
581
587
|
// Handle hosted vs native test
|
|
582
|
-
this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2/*return*/,{redirected:false}]}t=
|
|
588
|
+
this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2/*return*/,{redirected:false}]}t=No("hosted_vs_native");_e("[TEST] - hosted_vs_native: ".concat(t));
|
|
583
589
|
// This test is only applicable to checkout that's using createCartid callback
|
|
584
|
-
if(typeof
|
|
590
|
+
if(typeof ae.checkoutSettings.createCartId!=="function"){_e("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2/*return*/,{redirected:false}]}
|
|
585
591
|
// No need to do anything if the test is enabled for native
|
|
586
|
-
if(t!=="hosted"){
|
|
592
|
+
if(t!=="hosted"){_e("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=ae.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){_e("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}_e('"createCartId" is provided, start building cart');return[4/*yield*/,ae.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=Uo();c=He(Object.assign(Object.assign({cartId:r,checkoutSessionId:te.checkoutSessionId||undefined,hostedCheckoutUrl:ae.genericSettings.hostedCheckoutUrl,isTestMode:he(),isVariantTest:true},s),i));_e("[TEST] - Redirecting to: ".concat(c));
|
|
587
593
|
// Open new page with the cart URL
|
|
588
594
|
window.open(c,"_blank");return[2/*return*/,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}
|
|
589
595
|
// get date in 24/12/2024 format (without time)
|
|
590
596
|
var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}
|
|
591
597
|
// get date in 24/12/2024 format (without time)
|
|
592
|
-
var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(
|
|
598
|
+
var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(v.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=v.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};
|
|
593
599
|
/**
|
|
594
600
|
* For BigCommerce stores with a logged-in shopper, seed
|
|
595
601
|
* `defaultCustomerProfileAddress` from the BC Storefront API so the
|
|
@@ -597,10 +603,10 @@ var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=f
|
|
|
597
603
|
* forcing them to retype anything. Skips when an address has already been
|
|
598
604
|
* prefilled by another path (Stripe customer profile, merchant-provided
|
|
599
605
|
* `defaultAddress`, or the BC redirect's session-storage handoff).
|
|
600
|
-
*/this.prefillBigCommerceCustomerAddresses=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/]}if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}e=Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&typeof this.defaultAddress==="object"&&this.defaultAddress!==null;if(e){return[2/*return*/]}return[4/*yield*/,
|
|
606
|
+
*/this.prefillBigCommerceCustomerAddresses=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!window.Zonos.isBigCommerce){return[2/*return*/]}if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}e=Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&typeof this.defaultAddress==="object"&&this.defaultAddress!==null;if(e){return[2/*return*/]}return[4/*yield*/,Y()];case 1:o=r.sent();if(!o){return[2/*return*/]}return[4/*yield*/,q(o)];case 2:t=r.sent();if(!J(t)){return[2/*return*/]}n=go(t,{isShippable:function(e){return ko(false,e)},selectedCountryCode:X.selectedCountryCode||undefined});if(!n.length){return[2/*return*/]}
|
|
601
607
|
// Re-check after the awaits — another prefill path may have populated state
|
|
602
608
|
// while we were waiting on the network.
|
|
603
|
-
if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}this.defaultCustomerProfileAddress=n;
|
|
609
|
+
if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}this.defaultCustomerProfileAddress=n;_e("Prefilled ".concat(String(n.length)," BigCommerce customer address(es) for logged-in shopper"),"info");return[2/*return*/]}}))}))};this.getDefaultAddress=function(){
|
|
604
610
|
// If checkout customer is authenticated, use the address from the customer profile
|
|
605
611
|
if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}
|
|
606
612
|
// If default address is provided directly from the component, use it
|
|
@@ -609,7 +615,7 @@ if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAdd
|
|
|
609
615
|
* Message listener from the hosted checkout tab just openned from the hosted vs native variant test
|
|
610
616
|
*/this.handleHostedOpenWindowCallback=function(e){var o;
|
|
611
617
|
// check if it's from origin of hosted checkout url
|
|
612
|
-
var t=(o=
|
|
618
|
+
var t=(o=ae.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;
|
|
613
619
|
// Do nothing if hosted checkout url is not set
|
|
614
620
|
if(!origin){return}
|
|
615
621
|
// Do nothing if it's not from the origin of hosted checkout url
|
|
@@ -617,23 +623,23 @@ var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.incl
|
|
|
617
623
|
// Do not allow to receive message if not from origin we expected when it's not dev environment
|
|
618
624
|
if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":
|
|
619
625
|
// Update and set checkout session id to storage so that if user come back to merchant site, it will persist the test variance selection
|
|
620
|
-
|
|
626
|
+
te.checkoutSessionId=e.data.checkoutSessionId;break}};
|
|
621
627
|
/**
|
|
622
628
|
* Capture params from the url and set to the store when it's redirected from hosted checkout url for variant test
|
|
623
629
|
*/this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";
|
|
624
630
|
// Do nothing if the url is not loaded from hosted vs native variant test
|
|
625
|
-
if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){
|
|
631
|
+
if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){te.checkoutSessionId=t}
|
|
626
632
|
// merge variant test input from url to storageStore.enabledVariantTestKeys
|
|
627
|
-
var n=
|
|
633
|
+
var n=te.enabledVariantTestKeys||[];
|
|
628
634
|
// override the selected variant key if it's not "hosted" since we are in hosted checkout tab
|
|
629
|
-
if(window.Zonos.isLegacyCheckout){var r=
|
|
635
|
+
if(window.Zonos.isLegacyCheckout){var r=No("hosted_vs_native");
|
|
630
636
|
// Set selected variant key "hosted" to enabledVariantTestKeys if it's not in enabledVariantTestKeys already
|
|
631
|
-
if(!r){n.push({expiresAt:Date.now()+
|
|
637
|
+
if(!r){n.push({expiresAt:Date.now()+ne,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});re(n)}else{re(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}
|
|
632
638
|
// Remove query params from the url
|
|
633
639
|
e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}
|
|
634
640
|
/**
|
|
635
641
|
* Init cart info handler event
|
|
636
|
-
*/e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void
|
|
642
|
+
*/e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void m({adjustments:v.adjustments,cartItems:o});return[2/*return*/]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2/*return*/]}))}))};
|
|
637
643
|
/**
|
|
638
644
|
* Close dialog action
|
|
639
645
|
*/e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){
|
|
@@ -642,46 +648,46 @@ return[2/*return*/]}
|
|
|
642
648
|
// Only proceed when user select confirmed.
|
|
643
649
|
if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2/*return*/]}
|
|
644
650
|
// Close the confirm dialog
|
|
645
|
-
this.confirmDialogOpen=false;
|
|
651
|
+
this.confirmDialogOpen=false;G({event:"zonos-checkout-close",metadata:{checkoutSessionId:te.checkoutSessionId}});this.open=this.forceDialogOpen||false;if(!this.preview&&v.step==="finish"){
|
|
646
652
|
// reset cart store if it's not preview mode and only when checkout is in the finish step.
|
|
647
|
-
|
|
653
|
+
p()}
|
|
648
654
|
// Clear policy consent on every close (not just finish) so a buyer who
|
|
649
655
|
// checked the box mid-flow and then closed can't carry the prior
|
|
650
656
|
// acceptance into a new attempt without a fresh checkbox click.
|
|
651
|
-
if(!this.preview){
|
|
657
|
+
if(!this.preview){g()}
|
|
652
658
|
// reset step to customer info
|
|
653
|
-
|
|
659
|
+
v.step="customer-info";
|
|
654
660
|
// reset the tab item, so that user needs to click on Continue button to re-quote the landed cost if needed.
|
|
655
|
-
|
|
661
|
+
w();
|
|
656
662
|
// clear the checkout session timeout timer when checkout dialog close action is triggered
|
|
657
|
-
|
|
663
|
+
z();
|
|
658
664
|
/**
|
|
659
665
|
* Trigger callback when the checkout is closed
|
|
660
|
-
*/(t=(o=
|
|
666
|
+
*/(t=(o=ae.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2/*return*/]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c,a,u,l,s,c,c,f,h,s,p,g,w,z;return __generator(this,(function(_){switch(_.label){case 0:if(!(typeof ae.checkoutSettings.createCartId==="function"))return[3/*break*/,4];_e('"createCartId" is provided, start building cart');
|
|
661
667
|
// Reset before awaiting the merchant callback so a stale banner from a
|
|
662
668
|
// previous open is not visible while the network call is in flight.
|
|
663
|
-
|
|
669
|
+
v.customMessage=[];return[4/*yield*/,ae.checkoutSettings.createCartId()];case 1:o=_.sent();t=void 0;if(typeof o==="object"){_e("object detected, use cartId and prefill address from createCartId","info",o);t=o.cartId;
|
|
664
670
|
// set prefill address if provided in createCartId callback result
|
|
665
|
-
this.useShippingDataFromCreateCartId(o.shippingData);
|
|
671
|
+
this.useShippingDataFromCreateCartId(o.shippingData);v.customerAuthenticationToken=o.customerAuthenticationToken||null;
|
|
666
672
|
// Normalize against misbehaving merchant callbacks: only accept an
|
|
667
673
|
// array of strings, drop everything else so a bad value can't crash
|
|
668
674
|
// the renderer (`.filter(...)` would throw on non-arrays).
|
|
669
|
-
|
|
675
|
+
v.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((function(e){return typeof e==="string"})):[]}else{t=o}window.Zonos.cartId=t;return[4/*yield*/,Ho(t)];case 2:n=_.sent();r=n===null||n===void 0?void 0:n.cartData;if(!r){me("Failed to build cart, please try again.");return[2/*return*/,false]}window.Zonos.cartData=r;i=le(r),s=i.adjustments,c=i.cartItems;return[4/*yield*/,m({adjustments:s,cartItems:c})];case 3:_.sent();return[3/*break*/,12];case 4:if(!window.Zonos.cartData)return[3/*break*/,9];_e("tempCartUUID is provided, start building cart");a=(e=window.Zonos.cartData.references)===null||e===void 0?void 0:e.checkoutSessionId;if(!a)return[3/*break*/,6];_e("Setting checkout session id from cart reference","info",a);return[4/*yield*/,this.recoverCompletedOrderModificationSession(a)];case 5:u=_.sent();if(u){
|
|
670
676
|
// Recovery routes straight to the finish step, bypassing the
|
|
671
677
|
// cartStoreUpdateItems call below that would normally clear this -
|
|
672
678
|
// without it, the finish screen would spin forever (dialogLoading
|
|
673
679
|
// stays true while isFetchingSession is true).
|
|
674
|
-
|
|
680
|
+
d.isFetchingSession=false;return[2/*return*/,true]}te.checkoutSessionId=a;return[3/*break*/,7];case 6:
|
|
675
681
|
// Same as zonos-collect/zonos-invoice: without this, a checkout
|
|
676
682
|
// session id left over from a previous cart in this tab would leak
|
|
677
683
|
// into this unrelated one.
|
|
678
|
-
|
|
684
|
+
_e("Clear checkout session id from storage so we start from a fresh session for this cart");te.checkoutSessionId=null;_.label=7;case 7:l=le(window.Zonos.cartData),s=l.adjustments,c=l.cartItems;return[4/*yield*/,m({adjustments:s,cartItems:c})];case 8:_.sent();return[3/*break*/,12];case 9:if(!(ae.checkoutSettings.buildCartDetail&&X.selectedCountryCode))return[3/*break*/,12];_e("build cart detail");return[4/*yield*/,ae.checkoutSettings.buildCartDetail({countryCode:X.selectedCountryCode,currencyCode:X.targetCurrency})];case 10:c=_.sent();f=c.filter((function(e){return e.amount>=0}));h=c.filter((function(e){return e.amount<0}));_e("cartItems","info",{cartItems:c});s=h.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4/*yield*/,m({adjustments:s,cartItems:f})];case 11:_.sent();_.label=12;case 12:if(!!te.checkoutSessionId)return[3/*break*/,14];return[4/*yield*/,k()];case 13:p=_.sent();_e("stripeStoreInitCheckoutSession: ".concat(p));if(!p){return[2/*return*/,false]}_.label=14;case 14:
|
|
679
685
|
// get and set payment intent async except for staging mode
|
|
680
|
-
if(!
|
|
686
|
+
if(!v.isStagingMode){void y()}
|
|
681
687
|
// apply theme to stripe elements
|
|
682
688
|
return[4/*yield*/,this.applyStripeTheme()];case 15:
|
|
683
689
|
// apply theme to stripe elements
|
|
684
|
-
_.sent();
|
|
690
|
+
_.sent();g=ae.checkoutSettings,w=g.successBehavior,z=g.successRedirectUrl;this.isRedirectAfterOrder=w==="REDIRECT_TO_SUCCESS_PAGE"||w==="CLOSE_MODAL"&&!!z||!!v.externalConfirmationPageURL;
|
|
685
691
|
// A session tied to an order that hasn't completed yet is an
|
|
686
692
|
// order-modification/adjustment collection: the shopper is only paying a
|
|
687
693
|
// delta against an already-approved landed cost, so the address/shipping
|
|
@@ -690,65 +696,65 @@ _.sent();k=se.checkoutSettings,y=k.successBehavior,b=k.successRedirectUrl;this.i
|
|
|
690
696
|
// to payment, same as the Collect flow does for its own cart type. Lives
|
|
691
697
|
// here (rather than at each buildCartAndInit call site) so every caller
|
|
692
698
|
// gets it, including the forceDialogOpen/preview init path.
|
|
693
|
-
if(
|
|
699
|
+
if(b()){v.step="payment"}return[2/*return*/,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=ve(ge("local","zonos--placed-order-info"));if(!e){we("local","zonos--placed-order-info");return}var o=Date.now()-e.time;_e("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Vo;
|
|
694
700
|
// if the order is placed within 5 minutes, confirm with the user to proceed with the order duplication
|
|
695
|
-
if(o>t){
|
|
701
|
+
if(o>t){_e("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");
|
|
696
702
|
// remove the placed order info if it's older than 5 minutes and do nothing.
|
|
697
|
-
|
|
703
|
+
we("local","zonos--placed-order-info");return}
|
|
698
704
|
// Set placed order info to show the confirm notification to the user
|
|
699
|
-
this.placedOrderInfo=e;
|
|
705
|
+
this.placedOrderInfo=e;_e("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!te.checkoutSessionId){return}
|
|
700
706
|
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
701
|
-
void
|
|
707
|
+
void be({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:te.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){
|
|
702
708
|
// Reset the placed order info
|
|
703
|
-
this.placedOrderInfo=null;if(!
|
|
709
|
+
this.placedOrderInfo=null;if(!te.checkoutSessionId){return}
|
|
704
710
|
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
705
|
-
void
|
|
711
|
+
void be({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:te.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!te.checkoutSessionId){return}void be({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:te.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;
|
|
706
712
|
// Reset the placed order info
|
|
707
713
|
this.placedOrderInfo=null;
|
|
708
714
|
// Redirect to the vendor store url if this is legacy checkout
|
|
709
|
-
if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||
|
|
715
|
+
if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||ae.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=ae.checkoutSettings.placeOrderButtonSelector;var t=ae.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;
|
|
710
716
|
// `_zonosBase` injects this hidden button on page load when Stripe
|
|
711
717
|
// redirects the shopper back with a `payment_intent_client_secret` query
|
|
712
718
|
// param. We must still attach (and auto-click) it even when the merchant
|
|
713
719
|
// is on a `buildCartDetail` only setup (no cartId / no place-order
|
|
714
720
|
// selector configured yet) — otherwise the redirect-back never reopens
|
|
715
721
|
// the checkout dialog to show the success/finish screen.
|
|
716
|
-
var n=!!document.querySelector("#".concat(
|
|
722
|
+
var n=!!document.querySelector("#".concat(Ie));_e("attach checkout ".concat(o),"info",{href:window.location.href});_e("attach checkout to always trigger international checkout selector: ".concat(t));
|
|
717
723
|
// allow to load checkout if cartData is ready (Checkout can be loaded right away if tempCartUUID is in the URL)
|
|
718
724
|
if(!o&&!t&&!window.Zonos.cartData&&!n){
|
|
719
725
|
// do nothing if button element is not found
|
|
720
726
|
return}var r=[o,t,
|
|
721
727
|
// hidden button for domestic redirected
|
|
722
|
-
"#".concat(
|
|
728
|
+
"#".concat(Te),
|
|
723
729
|
// hidden button for legacy checkout facade and when client secret is provided in the query param or session storage when user is redirected from stripe
|
|
724
|
-
"#".concat(
|
|
730
|
+
"#".concat(Ie),
|
|
725
731
|
// hidden button for international checkout
|
|
726
|
-
"#".concat(
|
|
732
|
+
"#".concat(Ae)].filter(Boolean);
|
|
727
733
|
// also attach event to hidden button if user was redirected with shipping address session
|
|
728
734
|
var i=document.querySelectorAll(r.join(","));
|
|
729
735
|
// only attach event once, and looping through all of the button elements
|
|
730
736
|
i.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){
|
|
731
737
|
// do nothing if event is already attached
|
|
732
|
-
return}
|
|
738
|
+
return}_e("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,c,a,u,l,f,h,m,p,g,w,z,k,y,b,T,A;return __generator(this,(function(O){switch(O.label){case 0:i=performance.now();s=t&&n.matches(t);c=n.matches("#".concat(Ae));a=n.matches("#".concat(Te))||n.matches("#".concat(Ie));
|
|
733
739
|
// Allow no country set for legacy facades. Otherwise enforce it being a shippable country and not disabled.
|
|
734
|
-
if(!window.Zonos.isLegacyCheckout&&(!
|
|
740
|
+
if(!window.Zonos.isLegacyCheckout&&(!ko()||wo())&&!s&&!c&&!a){return[2/*return*/]}o.preventDefault();o.stopPropagation();_e("zonos checkout button clicked");return[4/*yield*/,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:u=O.sent().shouldAllowOrder;
|
|
735
741
|
// Only allow order to proceed if payment intent is not succeeded
|
|
736
|
-
if(!
|
|
742
|
+
if(!u){return[2/*return*/]}
|
|
737
743
|
/**
|
|
738
744
|
* We are checking the payment state when Zonos script is loaded (user clicked "Checkout" button prviously), the hidden checkout button would be injected and clicked when the page is loaded, which leads to recording the load time on page load.
|
|
739
745
|
* Move the logic below checking Stripe payment state so we don't record the load time on page load and only do so when checkout modal is actually showed up.
|
|
740
746
|
*/if(!window.Zonos.logIntervalId){
|
|
741
747
|
// log the load time of all API calls every 2 seconds. This is to track the load time of all API calls for checkout user
|
|
742
|
-
window.Zonos.logIntervalId=setInterval((function(){void
|
|
748
|
+
window.Zonos.logIntervalId=setInterval((function(){void Lo()}),2e3)}if(!Ro("hosted_vs_native"))return[3/*break*/,4];this.isOverlayLoading=true;return[4/*yield*/,this.registerTestHostedVsNative()];case 2:O.sent();return[4/*yield*/,this.handleHostedVsNative()];case 3:l=O.sent().redirected;this.isOverlayLoading=false;
|
|
743
749
|
// Stop the process if the user is being redirected to the hosted checkout page
|
|
744
|
-
if(
|
|
750
|
+
if(l){return[2/*return*/]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3/*break*/,7];return[4/*yield*/,Xe()];case 5:f=O.sent().shouldBypass;if(f){_e("Bypass customer group detected, redirecting to BigCommerce native checkout","info");
|
|
745
751
|
// Carry over zonosQaUrl / zonosTestMode so the BC native
|
|
746
752
|
// checkout keeps loading the same Zonos elements build/env.
|
|
747
|
-
window.location.href=
|
|
753
|
+
window.location.href=Ve("/checkout");return[2/*return*/]}return[4/*yield*/,uo()];case 6:h=O.sent();if(h.shouldForceLogin&&h.redirectUrl){window.location.href=h.redirectUrl;return[2/*return*/]}O.label=7;case 7:
|
|
748
754
|
// start loading
|
|
749
|
-
|
|
755
|
+
d.isFetchingSession=true;this.open=true;O.label=8;case 8:O.trys.push([8,16,,17]);return[4/*yield*/,this.buildCartAndInit()];case 9:m=O.sent();if(!m){throw new Error("Error building cart")}if(!!window.Zonos.isLegacyCheckout)return[3/*break*/,14];p=null;O.label=10;case 10:O.trys.push([10,12,,13]);return[4/*yield*/,_()];case 11:p=O.sent();return[3/*break*/,13];case 12:g=O.sent();
|
|
750
756
|
// A throwing merchant callback should stop checkout, not open it.
|
|
751
|
-
p=
|
|
757
|
+
p=ie("Unable to check inventory. Please try again.");return[3/*break*/,13];case 13:if(p){
|
|
752
758
|
// Surface the same "Couldn't place order" dialog and stop
|
|
753
759
|
// before the checkout is revealed. We return here before the
|
|
754
760
|
// session/analytics setup below runs, so close the (still
|
|
@@ -756,60 +762,60 @@ p=ne("Unable to check inventory. Please try again.");return[3/*break*/,13];case
|
|
|
756
762
|
// half-initialized checkout visible behind the alert. The
|
|
757
763
|
// inventory-failure dialog renders independently of `this.open`,
|
|
758
764
|
// and "Return to cart" resets the message + closes cleanly.
|
|
759
|
-
|
|
765
|
+
v.inventoryCheckErrorMessage=p;d.isFetchingSession=false;this.open=false;return[2/*return*/]}O.label=14;case 14:(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:te.checkoutSessionId,type:"zonos-checkout-session-update"},"*");
|
|
760
766
|
// start the timer to validate the price
|
|
761
|
-
|
|
767
|
+
C({isPreview:this.preview,sessionTimeout:Go});G({event:"zonos-checkout-start",metadata:{checkoutSessionId:te.checkoutSessionId}});w=te.checkoutSessionId;void x({checkoutSessionId:w,eventName:"checkout_open"});return[4/*yield*/,Fe()];case 15:z=O.sent().enabled;
|
|
762
768
|
// Hide discount input if there's no active discount configured for the store
|
|
763
|
-
|
|
769
|
+
v.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void Po()}else{k=performance.now();y=k-i;void Do({loadTime:y})}this.recordCheckoutInfo();b=!!Oe();if(b){this.markTheSessionAsAbandonedCart()}return[3/*break*/,17];case 16:T=O.sent();if(T instanceof Error){A=T.message;if(A==="Cart is expired."){this.isCartExpired=true}}
|
|
764
770
|
// stop loading
|
|
765
|
-
|
|
771
|
+
d.isFetchingSession=false;me(T);if(this.isCartExpired){d.isFetchingSession=true;return[2/*return*/]}
|
|
766
772
|
// We want to log the error anytime we fail to create a checkout session
|
|
767
|
-
void
|
|
773
|
+
void ze({endpoint:"Error creating Checkout",errors:[T instanceof Error?T.toString():"Unknown error"],metadata:{allLogs:xe,cartId:window.Zonos.cartId,checkoutSessionBody:S(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||ae.onlineStoreSettings.url}});I({messages:[ie("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:ie("Error creating Checkout")});return[3/*break*/,17];case 17:return[2/*return*/]}}))}))}),{
|
|
768
774
|
// Trigger this event before any other event
|
|
769
|
-
capture:true,passive:false});if(!
|
|
775
|
+
capture:true,passive:false});if(!ae.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");
|
|
770
776
|
// if this button is the hidden button, trigger the click event
|
|
771
|
-
if(n.matches("#".concat(
|
|
777
|
+
if(n.matches("#".concat(Te))){n.dispatchEvent(Le("click"));
|
|
772
778
|
// cleanup shipping session after button is clicked
|
|
773
|
-
|
|
779
|
+
c();
|
|
774
780
|
// remove the button after it's clicked
|
|
775
781
|
n.remove()}
|
|
776
782
|
// For legacy checkout facade and in case the cart or stripe client secret is provided in the query param, open Checkout right away
|
|
777
|
-
if(n.matches("#".concat(
|
|
783
|
+
if(n.matches("#".concat(Ie))){
|
|
778
784
|
// trigger the click event on the button
|
|
779
|
-
n.dispatchEvent(
|
|
785
|
+
n.dispatchEvent(Le("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}
|
|
780
786
|
// apply theme to stripe elements
|
|
781
787
|
void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){
|
|
782
788
|
// Do only if prefill address is provided
|
|
783
|
-
if(!e){return}
|
|
784
|
-
r
|
|
789
|
+
if(!e){return}_e("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var f=new URLSearchParams(window.location.search);var h=// fallback to selected country code if country is not provided
|
|
790
|
+
r||oe(f)||X.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:h,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};
|
|
785
791
|
/**
|
|
786
792
|
* Set default address from query param if it's valid
|
|
787
|
-
*/e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);
|
|
793
|
+
*/e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);_e("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=
|
|
788
794
|
// fallback to selected country code if country is not provided
|
|
789
|
-
|
|
795
|
+
oe(e)||X.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerFirstName");var u=o("customerLastName");var d=o("customerPhone");var l=o("customerZip");var f=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:a,customerLastName:u,customerName:c,customerPhone:d,customerState:f,customerZip:l})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";
|
|
790
796
|
/**
|
|
791
797
|
* If one of the value is null, no need to preset the default address.
|
|
792
798
|
* City and state are optional (they are not always provided for example Puerto Rico)
|
|
793
|
-
**/if(!o||!s||!c||!t){
|
|
799
|
+
**/if(!o||!s||!c||!t){_e("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&X.shippingZoneCountries&&!(t in X.shippingZoneCountries)){_e('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];_e("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){v.isStagingMode=!!this.overrideStagingMode};
|
|
794
800
|
/**
|
|
795
801
|
* Setup all of the event listeners for the component on first load
|
|
796
|
-
*/e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){
|
|
802
|
+
*/e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){d.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;
|
|
797
803
|
// Set staging mode on init
|
|
798
|
-
|
|
804
|
+
v.isStagingMode=ke();
|
|
799
805
|
// Override staging mode if it's provided
|
|
800
|
-
if(typeof this.overrideStagingMode!=="undefined"){
|
|
806
|
+
if(typeof this.overrideStagingMode!=="undefined"){v.isStagingMode=this.overrideStagingMode}
|
|
801
807
|
// Start fetching BigCommerce customer group on page load so the bypass
|
|
802
808
|
// result is ready by the time checkout opens or the BC watcher fires
|
|
803
|
-
|
|
809
|
+
Je();
|
|
804
810
|
// Warm the BigCommerce `/checkouts/settings` fetch (merchant's
|
|
805
811
|
// `guest_checkout_type`) so force-login gating resolves instantly when
|
|
806
812
|
// the shopper clicks checkout — otherwise the first checkout open
|
|
807
813
|
// would block on a proxy round trip.
|
|
808
|
-
|
|
814
|
+
ao();
|
|
809
815
|
// On BC's `/login.php`, rewrite the "Create account" button href so
|
|
810
816
|
// the post-signup round trip preserves the `from=cart.php?...` flag
|
|
811
817
|
// that carries the shopper back into Zonos international checkout.
|
|
812
|
-
|
|
818
|
+
vo();
|
|
813
819
|
// If BC redirected the shopper back here after login with the Zonos
|
|
814
820
|
// resume flag, auto-open the international checkout. Strip the flag
|
|
815
821
|
// from the URL so a refresh doesn't keep re-triggering the dialog.
|
|
@@ -820,7 +826,7 @@ this.handleBigcommerceInternationalResumeFlag();
|
|
|
820
826
|
// the prefill itself guards against overwriting other prefill sources.
|
|
821
827
|
void this.prefillBigCommerceCustomerAddresses();
|
|
822
828
|
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
823
|
-
|
|
829
|
+
Bo({domesticRedirectedBtnSelector:Te,onInternationalCheckoutSelected:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.detectedDomesticCheckoutDialogOpen=true;
|
|
824
830
|
// wait for 2 secs
|
|
825
831
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,2e3)}))];case 1:
|
|
826
832
|
// wait for 2 secs
|
|
@@ -836,7 +842,12 @@ onLoggedInInternationalAddressDetected:function(){return new Promise((function(e
|
|
|
836
842
|
o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});
|
|
837
843
|
/**
|
|
838
844
|
* When temp cart data is available, set default address if it exists
|
|
839
|
-
*/if(window.Zonos){this.useLegacyQueryParams()}
|
|
845
|
+
*/if(window.Zonos){this.useLegacyQueryParams()}
|
|
846
|
+
// Native BigCommerce checkout never loads Stripe.js. The address watcher
|
|
847
|
+
// above still has to run. Skip the poll so checkout does not wait 10s
|
|
848
|
+
// for a Stripe instance that will not arrive, and so attachCheckout
|
|
849
|
+
// cannot bind the store's place-order buttons.
|
|
850
|
+
if(Ue()){return[2/*return*/]}e=setInterval((function(){d.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){_e("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}_e("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){
|
|
840
851
|
// With legacy checkout, avoid the mutation observer. We are using a hidden button to trigger checkout.
|
|
841
852
|
o.attachCheckout()}else if(window){o.attachCheckout();
|
|
842
853
|
// create a mutation observer to see if any new elements that match our selector is added to the DOM
|
|
@@ -857,90 +868,90 @@ clearInterval(e)}),1e4);return[2/*return*/]}))}))};
|
|
|
857
868
|
* fires against a half-initialized store, which is what happens when
|
|
858
869
|
* the shopper refreshes back into cart.php straight from the login
|
|
859
870
|
* round trip.
|
|
860
|
-
*/e.prototype.handleBigcommerceInternationalResumeFlag=function(){if(!window.Zonos.isBigCommerce){return}var e=new URL(window.location.href);if(e.searchParams.get(
|
|
871
|
+
*/e.prototype.handleBigcommerceInternationalResumeFlag=function(){if(!window.Zonos.isBigCommerce){return}var e=new URL(window.location.href);if(e.searchParams.get(Ke)!=="true"){return}e.searchParams.delete(Ke);window.history.replaceState({},"",e.toString());var o=Date.now();var t=setInterval((function(){if(!X.localizationLoaded||!X.selectedCountryCode){if(Date.now()-o>15e3){clearInterval(t);_e("BigCommerce international checkout resume flag: localization did not initialize within 15s","info")}return}var e=document.querySelector("#".concat(Ae));if(e){clearInterval(t);e.dispatchEvent(Le("click"));return}if(Date.now()-o>15e3){clearInterval(t);_e("BigCommerce international checkout resume flag: trigger button did not mount within 15s","info")}}),200)};
|
|
861
872
|
/**
|
|
862
873
|
* For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
|
|
863
|
-
*/e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){
|
|
874
|
+
*/e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){v.step="finish";this.storybookPaymentStatusOverride=e;return[2/*return*/]}))}))};
|
|
864
875
|
/**
|
|
865
876
|
* For usage in storybook for a mocked flow.
|
|
866
|
-
*/e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){
|
|
877
|
+
*/e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){T(e);return[2/*return*/]}))}))};
|
|
867
878
|
/**
|
|
868
879
|
* Trigger the checkout international button
|
|
869
|
-
*/e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(
|
|
880
|
+
*/e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(Ae));if(e){e.dispatchEvent(Le("click"))}return[2/*return*/]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;var a=this;return __generator(this,(function(u){switch(u.label){case 0:
|
|
870
881
|
// submit google tag when the form is complete
|
|
871
|
-
|
|
882
|
+
G({event:"zonos-checkout-customer-info",metadata:{checkoutSessionId:te.checkoutSessionId}});r=te.checkoutSessionId;void x({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4/*yield*/,A()];case 1:i=u.sent().isRequestNotReady;
|
|
872
883
|
// If the request is not ready at the time user click Continue, logging it out so we can investigate the issue
|
|
873
|
-
if(i&&
|
|
884
|
+
if(i&&v.addressFormRenderType==="stripe"){void ze({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=d.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=d.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(v.step!=="customer-info"){
|
|
874
885
|
// stop interval if the step is not customer-info
|
|
875
|
-
clearInterval(e);return}if(!
|
|
886
|
+
clearInterval(e);return}if(!d.isFetchingLandedCost){if(v.landedCostData){
|
|
876
887
|
// start init paypal with the presentment currency when landed cost is fetched
|
|
877
|
-
void
|
|
888
|
+
void Q({currency:v.currency});
|
|
878
889
|
// only go to next step if landed cost data is ready
|
|
879
|
-
|
|
890
|
+
O()}a.submitLoading=false;if(e){clearInterval(e)}}};
|
|
880
891
|
// Immediately move to the next step
|
|
881
|
-
s();
|
|
892
|
+
s();c=setInterval((function(){s(c)}),20);
|
|
882
893
|
// cleanup interval if no data is fetched after 10 seconds
|
|
883
|
-
setTimeout((function(){clearInterval(
|
|
894
|
+
setTimeout((function(){clearInterval(c)}),1e4);return[2/*return*/]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){O();return[2/*return*/]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){
|
|
884
895
|
// reset inventory check message to close the inventory check alert
|
|
885
|
-
|
|
896
|
+
v.inventoryCheckErrorMessage=null;
|
|
886
897
|
// close the dialog only when it's not hosted checkout
|
|
887
898
|
if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;
|
|
888
899
|
// Redirect to the vendor store url if this is legacy checkout
|
|
889
900
|
if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}
|
|
890
901
|
/**
|
|
891
902
|
* For normal integration, the checkout modal opens on top of merchant site. Therefore, should reload the page when cart is expired so whole page can be reloaded and merchant cart might also be reset.
|
|
892
|
-
**/if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,a,u,
|
|
903
|
+
**/if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c,a,u,l;return __generator(this,(function(f){switch(f.label){case 0:e=d.checkoutSettlementCurrency==="USD";
|
|
893
904
|
// open the confirm dialog if the settlement currency is in USD, and if call this method again, proceed and confirm with Stripe.
|
|
894
|
-
if(e&&
|
|
905
|
+
if(e&&d.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;
|
|
895
906
|
// Don't unlock consent here — the USD-confirm dialog is mid-flow; the
|
|
896
907
|
// lock should hold until the user resolves the dialog and we re-enter.
|
|
897
908
|
return[2/*return*/]}
|
|
898
909
|
// Close the dialog after the user confirms to proceed with the payment in USD
|
|
899
|
-
this.payInUsdConfirmDialogOpen=false;o=
|
|
910
|
+
this.payInUsdConfirmDialogOpen=false;o=B();f.label=1;case 1:f.trys.push([1,,18,19]);
|
|
900
911
|
// reset paypal error message
|
|
901
|
-
|
|
912
|
+
V.paypalErrorMessage=null;
|
|
902
913
|
// reset error state
|
|
903
|
-
|
|
914
|
+
d.hasPaymentError=false;this.submitLoading=true;
|
|
904
915
|
// reset inventory check message
|
|
905
|
-
|
|
916
|
+
v.inventoryCheckErrorMessage=null;return[4/*yield*/,U()];case 2:t=f.sent();
|
|
906
917
|
// Should not proceed to confirm payment if base currency update failed
|
|
907
|
-
if(!t){
|
|
918
|
+
if(!t){d.hasPaymentError=true;d.customErrorMessage=ie("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:d.checkoutSettlementCurrency});this.submitLoading=false;return[2/*return*/]}f.label=3;case 3:f.trys.push([3,5,,6]);
|
|
908
919
|
// check inventory before proceeding to payment
|
|
909
|
-
n=
|
|
920
|
+
n=v;return[4/*yield*/,_()];case 4:
|
|
910
921
|
// check inventory before proceeding to payment
|
|
911
|
-
n.inventoryCheckErrorMessage=
|
|
922
|
+
n.inventoryCheckErrorMessage=f.sent();return[3/*break*/,6];case 5:r=f.sent();
|
|
912
923
|
// If user provide callback and it throw an exception, default to this message and stop the payment.
|
|
913
|
-
|
|
924
|
+
v.inventoryCheckErrorMessage=ie("Unable to check inventory. Please try again.");return[3/*break*/,6];case 6:
|
|
914
925
|
// Don't proceed to payment if there's an error message
|
|
915
|
-
if(
|
|
926
|
+
if(v.inventoryCheckErrorMessage){
|
|
916
927
|
// stop the submit loading state
|
|
917
|
-
this.submitLoading=false;return[2/*return*/]}i=
|
|
928
|
+
this.submitLoading=false;return[2/*return*/]}i=K();if(!(i>0))return[3/*break*/,8];return[4/*yield*/,E()];case 7:s=f.sent();if(!s.success){d.hasPaymentError=true;d.customErrorMessage=s.error||ie("Unable to apply store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}f.label=8;case 8:if(!L())return[3/*break*/,14];f.label=9;case 9:f.trys.push([9,12,,13]);return[4/*yield*/,P()];case 10:c=f.sent();if(!c.valid){d.hasPaymentError=true;d.customErrorMessage=c.errorMessage;this.submitLoading=false;return[2/*return*/]}return[4/*yield*/,D()];case 11:a=f.sent();if(!a.success){d.hasPaymentError=true;d.customErrorMessage=a.error||ie("Unable to place order with store credit. Please try again.");this.submitLoading=false;return[2/*return*/]}O();z();return[3/*break*/,13];case 12:u=f.sent();me(u);G({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:te.checkoutSessionId}});d.hasPaymentError=true;return[3/*break*/,13];case 13:this.submitLoading=false;return[2/*return*/];case 14:f.trys.push([14,16,,17]);
|
|
918
929
|
// Order-modification payment-only sessions skip the shipping step,
|
|
919
930
|
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
920
931
|
// landed-cost guard the same way zonos-collect does for its own
|
|
921
932
|
// no-shipping-step flow.
|
|
922
|
-
return[4/*yield*/,
|
|
933
|
+
return[4/*yield*/,j({noLandedCostCheck:b()})];case 15:
|
|
923
934
|
// Order-modification payment-only sessions skip the shipping step,
|
|
924
935
|
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
925
936
|
// landed-cost guard the same way zonos-collect does for its own
|
|
926
937
|
// no-shipping-step flow.
|
|
927
|
-
|
|
938
|
+
f.sent();O();
|
|
928
939
|
// clear the checkout session timeout timer when purchase is complete
|
|
929
|
-
|
|
940
|
+
z();return[3/*break*/,17];case 16:l=f.sent();me(l);G({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:te.checkoutSessionId}});d.hasPaymentError=true;
|
|
930
941
|
// should request inventory refund if there's an error during payment
|
|
931
|
-
if(
|
|
942
|
+
if(d.shouldInventoryRefund){void N();d.shouldInventoryRefund=false}return[3/*break*/,17];case 17:this.submitLoading=false;return[3/*break*/,19];case 18:
|
|
932
943
|
// Release the consent lock on every terminal exit (success or failure)
|
|
933
944
|
// so the buyer can re-toggle / retry. On success the cart advances and
|
|
934
945
|
// the close-handler reset would clean this up anyway.
|
|
935
|
-
if(o){
|
|
946
|
+
if(o){R.locked=false}return[7/*endfinally*/];case 19:return[2/*return*/]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:
|
|
936
947
|
// reset stripe store
|
|
937
|
-
|
|
948
|
+
F();if(!this.preview)return[3/*break*/,2];v.step="customer-info";return[4/*yield*/,this.init()];case 1:r.sent();return[2/*return*/];case 2:
|
|
938
949
|
// reset cart store
|
|
939
|
-
|
|
950
|
+
p();
|
|
940
951
|
// reset policy consent so the next checkout starts un-accepted
|
|
941
|
-
|
|
952
|
+
g();
|
|
942
953
|
// redirect to vendor store url if this is legacy checkout.
|
|
943
|
-
if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||
|
|
954
|
+
if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||ae.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2/*return*/]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");
|
|
944
955
|
/**
|
|
945
956
|
* Update the URL without query parameters only when checkout is not running in dashboard.zonos.com.
|
|
946
957
|
* We don't want to reload the page when dashboard is running it. Test mode should do what live mode does.
|
|
@@ -950,15 +961,15 @@ if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData
|
|
|
950
961
|
* @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
|
|
951
962
|
**/if(!n){window.history.replaceState(window.history.state,document.title,t);
|
|
952
963
|
// Reload the page
|
|
953
|
-
window.location.reload()}return[2/*return*/]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=
|
|
964
|
+
window.location.reload()}return[2/*return*/]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=ye(this.mobile);
|
|
954
965
|
// apply theme to stripe elements
|
|
955
|
-
void this.applyStripeTheme();
|
|
966
|
+
void this.applyStripeTheme();_e("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=ye(this.mobile);
|
|
956
967
|
// apply theme to stripe elements
|
|
957
|
-
void this.applyStripeTheme();
|
|
968
|
+
void this.applyStripeTheme();_e("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){
|
|
958
969
|
// update theme to browser preference theme if appearance theme is system
|
|
959
|
-
this.appearanceSettingsOverride.theme=
|
|
970
|
+
this.appearanceSettingsOverride.theme=ue(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){F()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){_e("No customer profile","info");this.defaultCustomerProfileAddress=[];return}_e("Customer profile found","info",{customerProfile:this.customerProfile});
|
|
960
971
|
// Build and set saved locations from checkout customers
|
|
961
|
-
this.defaultCustomerProfileAddress=((o=(e=
|
|
972
|
+
this.defaultCustomerProfileAddress=((o=(e=d.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=d.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){_e("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});
|
|
962
973
|
// apply theme to stripe elements
|
|
963
974
|
void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;
|
|
964
975
|
// disable scroll on the body when dialog is open
|
|
@@ -976,93 +987,93 @@ o.style.removeProperty("overflow")}
|
|
|
976
987
|
// reset overflow state to original state
|
|
977
988
|
if(r){t.removeAttribute(e);t.style.overflow=r}else{
|
|
978
989
|
// just remove the overflow style if it's not set
|
|
979
|
-
t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=
|
|
990
|
+
t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=ye(this.mobile);this.isIframed=window.self!==window.top;_e("iframed: ".concat(this.isIframed));
|
|
980
991
|
// Set checkout session if redirect
|
|
981
992
|
if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}
|
|
982
993
|
// update theme to browser preference theme if appearance theme is system
|
|
983
|
-
this.handleAppearanceSettingsOverrideChange();this.storeUnsubscribeList=[
|
|
994
|
+
this.handleAppearanceSettingsOverrideChange();this.storeUnsubscribeList=[se("selectedLocale",(function(){
|
|
984
995
|
// Update stripe locale when selected country code is changed
|
|
985
|
-
void e.applyStripeTheme()})),
|
|
996
|
+
void e.applyStripeTheme()})),M("selectedShippingOption",(function(){var o,t,n,r;var i=v.selectedShippingOption;
|
|
986
997
|
// Canada requires GAA form to be filled out for FedEx Ground shipping option
|
|
987
|
-
if(((o=
|
|
998
|
+
if(((o=ae.genericSettings)===null||o===void 0?void 0:o.shouldFedExShippingConsentForCanadianShopper)&&((n=(t=i===null||i===void 0?void 0:i.shippingProfile)===null||t===void 0?void 0:t.serviceLevel.code)===null||n===void 0?void 0:n.toLowerCase().startsWith("fedex."))&&((r=d.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)==="CA"){e.shouldShowFedexShippingConsentDialog=true}})),H("stripeAddressEventData",(function(o){var t;
|
|
988
999
|
// For BigCommerce stores: redirect to domestic checkout when user selects a domestic country
|
|
989
1000
|
// Only redirect when the store's native currency is USD and the feature is enabled
|
|
990
|
-
if(!window.Zonos.isBigCommerce||!o||e.redirectToDomesticCheckoutDialogOpen||!((t=
|
|
1001
|
+
if(!window.Zonos.isBigCommerce||!o||e.redirectToDomesticCheckoutDialogOpen||!((t=ae.genericSettings)===null||t===void 0?void 0:t.isBigcommerceDomesticCheckoutRedirectEnabled)||ae.sourceCurrency!=="USD"){return}
|
|
991
1002
|
// Only redirect when checkout modal is opened
|
|
992
1003
|
if(!e.open){return}
|
|
993
1004
|
// Check if the page is checkout page, if so, do nothing since they're already at the right page
|
|
994
|
-
if(window.location.pathname
|
|
1005
|
+
if(Be(window.location.pathname)){return}var n=o.value.address.country;if(n&&ae.disabledCountries.includes(n)){e.redirectToDomesticCheckoutDialogOpen=true;_e("Domestic country ".concat(n," selected in international checkout, redirecting to BigCommerce domestic checkout"),"info");setTimeout((function(){
|
|
995
1006
|
// Carry over zonosQaUrl / zonosTestMode so the BC native checkout
|
|
996
1007
|
// keeps loading the same Zonos elements build/env.
|
|
997
|
-
window.location.href=
|
|
1008
|
+
window.location.href=Ve("/checkout")}),2e3)}}))];
|
|
998
1009
|
// Initialize test keys
|
|
999
|
-
this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);
|
|
1010
|
+
this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);_e("mobile: ".concat(this.isMobile))};
|
|
1000
1011
|
// do clean up when component is unmounted
|
|
1001
1012
|
e.prototype.disconnectedCallback=function(){
|
|
1002
1013
|
// reset stripe store
|
|
1003
|
-
|
|
1014
|
+
F();
|
|
1004
1015
|
// reset cart store
|
|
1005
|
-
|
|
1016
|
+
p();
|
|
1006
1017
|
// reset policy consent
|
|
1007
|
-
|
|
1018
|
+
g();
|
|
1008
1019
|
// cleanup onChange listener
|
|
1009
|
-
this.storeUnsubscribeList.forEach((function(e){return e()}));window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,
|
|
1020
|
+
this.storeUnsubscribeList.forEach((function(e){return e()}));window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,c;this.customerProfile=d.customerProfile;
|
|
1010
1021
|
// Set client secret so that we can add this to @Watch listener
|
|
1011
|
-
this.clientSecret=
|
|
1022
|
+
this.clientSecret=d.clientSecret;
|
|
1012
1023
|
// Only set and update stripeCustomerSession state if it's available, since it would only be available at the time checkout session is created, afterward access checkout session the value would be `null`.
|
|
1013
|
-
if(
|
|
1024
|
+
if(d.stripeCustomerSessionClientSecret){
|
|
1014
1025
|
// Set stripe customer session client secret so that we can add this to @Watch listener
|
|
1015
|
-
this.stripeCustomerSessionClientSecret=
|
|
1026
|
+
this.stripeCustomerSessionClientSecret=d.stripeCustomerSessionClientSecret}var a=
|
|
1016
1027
|
// if it's last step, don't need to check stripe elements
|
|
1017
|
-
|
|
1028
|
+
v.step!=="finish"&&v.step!=="error"&&!d.stripeElements||d.isFetchingSession;
|
|
1018
1029
|
// An order-modification/adjustment session (order attached, not yet
|
|
1019
1030
|
// completed) skips straight to payment — see buildCartAndInit. The
|
|
1020
1031
|
// customer-info/shipping steps never ran, so the progress tabs (which
|
|
1021
1032
|
// track completion via cartStore.tabItems, only ever flipped by those
|
|
1022
1033
|
// steps' own continue handlers) would otherwise show a stale, frozen
|
|
1023
1034
|
// bar instead of reflecting that this is a single-step flow.
|
|
1024
|
-
var
|
|
1035
|
+
var u=b();var l=de(ae.appearance,this.appearanceSettingsOverride||null),f=l.colorPrimary,h=l.colorSecondary,m=l.logoUrl,p=l.style;var g=ae.appearance.zonosAttribution==="ENABLED";var w=ae.appearance.theme;var z=f&&De(f)?"DARK":"LIGHT";
|
|
1025
1036
|
// use right side theme if it's mobile, otherwise use themePrimaryColorBased
|
|
1026
|
-
var
|
|
1037
|
+
var k=this.isMobile?w:z;
|
|
1027
1038
|
// only use submit button color if it's on desktop
|
|
1028
|
-
var
|
|
1039
|
+
var y=!this.isMobile?h:undefined;var _=X.customMessages;var C=(o=_.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var x=this.getCurrentLocalePageEnum();var S=_.filter((function(e){return e.pageName===x}));
|
|
1029
1040
|
|
|
1030
|
-
var
|
|
1041
|
+
var I=this.getBaseCurrencySettlementInfo();var T=function(){
|
|
1031
1042
|
// add timestamp to logo url if it's preview mode so browser won't cache it on the dashboard setting
|
|
1032
|
-
var o=e.preview?"".concat(m,"?timestamp=").concat(Date.now()):m;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(
|
|
1043
|
+
var o=e.preview?"".concat(m,"?timestamp=").concat(Date.now()):m;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(ae.organizationName," logo"),src:o}))};var A=he();var O=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||ke();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},T(),A&&t("zonos-badge",{badgeColor:"orange",size:"small"},ie("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},ie("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),!u&&t("zonos-checkout-progress-tabs",{backgroundColor:
|
|
1033
1044
|
// only use different contrast color when the secondary color is too off with the background in mobile
|
|
1034
|
-
e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return t("zonos-custom-message",{icon:
|
|
1045
|
+
e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return t("zonos-custom-message",{icon:Ko,message:e.message})})))};var B=function(){if(v.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:ie("Your checkout session has expired. Please reload the page to continue."),restStateTitle:ie("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},ie("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":Pe({overrideBorderStyle:p})}},v.step!=="finish"&&v.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":k,style:je({"--zonos--primary-color":!e.isMobile?f:undefined})},!e.isMobile&&O(),v.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:y}),v.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:y}),v.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,this.handleStripePaymentContinue()];case 1:e.sent();return[2/*return*/]}}))}))},submitBtnColor:y})),t("div",{class:"zonos--right","data-theme":w},e.isMobile&&O(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Ne}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){
|
|
1035
1046
|
// do nothing if it's not mobile
|
|
1036
1047
|
if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{
|
|
1037
1048
|
// only collapsible on mobile
|
|
1038
|
-
collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:
|
|
1049
|
+
collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:y}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Ko,message:C})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Ko,message:C}))))),(v.step==="finish"||v.step==="error")&&t("div",{class:"zonos--done","data-theme":w},t("div",{class:"zonos--header"},T(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Ne}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:w})),t("zonos-checkout-finish",{borderRadius:p,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:v.step==="error"&&!!v.error?Object.assign(Object.assign({},v.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":w,mobile:e.isMobile,
|
|
1039
1050
|
/**
|
|
1040
1051
|
* For this component, use slot instead of passing JSX through prop of other component. Because
|
|
1041
1052
|
* the click outside event will be triggered on and targeted to whichever component that it's attached to.
|
|
1042
1053
|
* Move it into <slot /> would resolve the issue.
|
|
1043
1054
|
*/
|
|
1044
|
-
slot:!e.isMobile?"dialog-footer":undefined}))};return t(r,{class:
|
|
1055
|
+
slot:!e.isMobile?"dialog-footer":undefined}))};return t(r,{class:Ee(["zonos--checkout zonos--elements",v.step==="payment"&&"zonos--processing-payment",g&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?B():t("zonos-dialog",{borderStyle:p,class:"zonos--checkout-dialog","data-theme":w,height:"980px",isLoading:a,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},B()),t("zonos-dialog",{isLoading:true,loadingText:ie("You will be redirected to international checkout shortly."),loadingTitle:ie("We detected that you are shipping to an international address."),noClickOutside:true,noCloseButton:true,open:this.detectedDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-dialog",{isLoading:true,loadingText:ie("You will be redirected to domestic checkout shortly."),loadingTitle:ie("We detected that you are shipping to a domestic address."),noClickOutside:true,noCloseButton:true,open:this.redirectToDomesticCheckoutDialogOpen,width:"450px"}),t("zonos-confirm-dialog",{class:"zonos--logged-in-intl-address-dialog",dialogCancelBtnText:ie("Stay on this page"),dialogConfirmBtnText:ie("Continue to international checkout"),dialogIntent:"info",dialogOpen:this.loggedInIntlAddressConfirmDialogOpen,dialogSubtitle:ie("Your selected address ships internationally. Would you like to continue to international checkout, or stay here and select a domestic address?"),dialogTitle:ie("International shipping address detected"),dialogWidth:480,onCancelClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"stay");e.loggedInIntlAddressResolver=null},onConfirmClicked:function(){var o;e.loggedInIntlAddressConfirmDialogOpen=false;(o=e.loggedInIntlAddressResolver)===null||o===void 0?void 0:o.call(e,"redirect");e.loggedInIntlAddressResolver=null}}),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:ie("Don't close"),dialogConfirmBtnText:ie("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:ie("Would you like to close checkout and return to the site?"),dialogTitle:ie("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},
|
|
1045
1056
|
// Mark user selected confirm to close the dialog
|
|
1046
|
-
onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:
|
|
1057
|
+
onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:ie("Return to merchant site"),dialogConfirmBtnText:ie("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:
|
|
1047
1058
|
/**
|
|
1048
1059
|
* Show order number if it's available, otherwise just show the time
|
|
1049
1060
|
*/
|
|
1050
|
-
((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?
|
|
1061
|
+
((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?ie("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):ie("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null)}),dialogTitle:ie("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},
|
|
1051
1062
|
// Mark user selected confirm to close the dialog
|
|
1052
1063
|
onConfirmClicked:function(){
|
|
1053
1064
|
// Reset the placed order info and close the dialog
|
|
1054
|
-
e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:
|
|
1065
|
+
e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:ie("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:t(n,null,ie("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),t("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},ie("View GAA Form."))),dialogTitle:ie("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:function(){return e.shouldShowFedexShippingConsentDialog=false}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:ie("Return to cart"),dialogIntent:"danger",
|
|
1055
1066
|
// Show dialog if inventory check error message is not null
|
|
1056
|
-
dialogOpen:!!
|
|
1067
|
+
dialogOpen:!!v.inventoryCheckErrorMessage,
|
|
1057
1068
|
// If dialog is in open state, the message should not be null
|
|
1058
|
-
dialogSubtitle:
|
|
1069
|
+
dialogSubtitle:v.inventoryCheckErrorMessage,dialogTitle:ie("Couldn't place order"),dialogType:"alert",
|
|
1059
1070
|
// Mark user selected confirm to close the dialog
|
|
1060
|
-
onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),
|
|
1071
|
+
onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),I&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:ie("Cancel"),dialogConfirmBtnText:ie("Pay [orderTotal]",{orderTotal:ce({amount:I.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:ie("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:ie("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},
|
|
1061
1072
|
// Mark user selected confirm to continue with payment
|
|
1062
|
-
onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:
|
|
1073
|
+
onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:ie("OK"),dialogIntent:"danger",
|
|
1063
1074
|
// Show dialog if inventory check error message is not null
|
|
1064
1075
|
dialogOpen:this.isCartExpired,
|
|
1065
1076
|
// If dialog is in open state, the message should not be null
|
|
1066
|
-
dialogSubtitle:
|
|
1077
|
+
dialogSubtitle:ie("You are being sent back to the shop to re-add items to your cart."),dialogTitle:ie("Shopping cart expired"),dialogType:"alert",
|
|
1067
1078
|
// Mark user selected confirm to close the dialog
|
|
1068
|
-
onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:[{appearanceSettingsOverrideChanged:0},{handleAppearanceSettingsOverrideChange:0}],overrideStagingMode:[{overrideStagingModeChanged:0}],mobile:[{handleMobileChange:0}],defaultAddress:[{handleAddressChange:0}],customerProfile:[{handleCustomerProfileChange:0}],clientSecret:[{handleClientSecretChange:0}],stripeCustomerSessionClientSecret:[{handleClientSecretChange:0}],open:[{handleOpenChange:0}]}},enumerable:false,configurable:true});return e}());
|
|
1079
|
+
onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:[{appearanceSettingsOverrideChanged:0},{handleAppearanceSettingsOverrideChange:0}],overrideStagingMode:[{overrideStagingModeChanged:0}],mobile:[{handleMobileChange:0}],defaultAddress:[{handleAddressChange:0}],customerProfile:[{handleCustomerProfileChange:0}],clientSecret:[{handleClientSecretChange:0}],stripeCustomerSessionClientSecret:[{handleClientSecretChange:0}],open:[{handleOpenChange:0}]}},enumerable:false,configurable:true});return e}());Qo.style=Zo()}}}));
|