@zonos/elements 1.4.2 → 1.5.0
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/index.cjs.js +7 -7
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +66 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +20 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +10 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +7 -10
- package/dist/collection/components/utils/checkout/isHostedVsNativeTestAllowed.js +13 -0
- package/dist/collection/components/utils/checkout/itemCustomization.js +53 -0
- package/dist/collection/components/utils/checkout/parseItemCustomizations.js +6 -0
- package/dist/collection/types/checkout/itemCustomization.js +1 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/zonos-cart-items_12.entry.js +66 -3
- package/dist/esm/zonos-checkout.entry.js +20 -10
- package/dist/esm-es5/index.js +4 -4
- package/dist/esm-es5/zonos-cart-items_12.entry.js +23 -10
- package/dist/esm-es5/zonos-checkout.entry.js +6 -6
- 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/utils/checkout/isHostedVsNativeTestAllowed.d.ts +11 -0
- package/dist/types/components/utils/checkout/itemCustomization.d.ts +23 -0
- package/dist/types/components/utils/checkout/parseItemCustomizations.d.ts +7 -0
- package/dist/types/types/checkout/itemCustomization.d.ts +4 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-30b3c9d3.entry.js +1 -0
- package/dist/zonos-elements/p-5873ab8e.entry.js +1 -0
- package/dist/zonos-elements/{p-be1237fc.system.entry.js → p-7f031592.system.entry.js} +55 -55
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-DCS8qcL6.system.js → p-CXxvn4GX.system.js} +4 -4
- package/dist/zonos-elements/{p-5016d71b.system.entry.js → p-d82fd8a9.system.entry.js} +68 -54
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/item-customization.d.ts +25 -0
- package/item-customization.js +52 -0
- package/package.json +7 -4
- package/dist/zonos-elements/p-0457f579.entry.js +0 -1
- package/dist/zonos-elements/p-34656e6c.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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-DS-qw_qc.system.js","./p-XDxdMlQl.system.js","./p-DOD2I44l.system.js","./p-BuU_p5DP.system.js","./p-BDopxBpR.system.js","./p-zVLAvre1.system.js","./p-CBx5nYet.system.js","./p-BbgqQIHv.system.js","./p-smUku7Ku.system.js","./p-C2j7R11h.system.js","./p-DBOI98r5.system.js","./p-DQZncB2d.system.js","./p-DW-fW8yR.system.js","./p-BNtWsPPP.system.js","./p-0D0aCMu6.system.js","./p-Cby4EkFu.system.js","./p-B3GRrRtL.system.js","./p-DoEHepOc.system.js","./p-BGktDPwA.system.js","./p-8PPEbm_0.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,P,E,U,D,L,N,j,R,F,M,H,Z,G,
|
|
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-DS-qw_qc.system.js","./p-XDxdMlQl.system.js","./p-DOD2I44l.system.js","./p-BuU_p5DP.system.js","./p-BDopxBpR.system.js","./p-zVLAvre1.system.js","./p-CBx5nYet.system.js","./p-BbgqQIHv.system.js","./p-smUku7Ku.system.js","./p-C2j7R11h.system.js","./p-DBOI98r5.system.js","./p-DQZncB2d.system.js","./p-DW-fW8yR.system.js","./p-BNtWsPPP.system.js","./p-0D0aCMu6.system.js","./p-Cby4EkFu.system.js","./p-B3GRrRtL.system.js","./p-DoEHepOc.system.js","./p-BGktDPwA.system.js","./p-8PPEbm_0.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,P,E,U,D,L,N,j,R,F,M,H,Z,K,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,Pe;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.i;u=e.c;d=e.g;l=e.d;f=e.e;h=e.f;v=e.p;m=e.h;p=e.j;g=e.k;w=e.l;z=e.m;k=e.n;y=e.o;b=e.t;_=e.q;C=e.r;x=e.u;S=e.v;I=e.w;T=e.x;A=e.y;O=e.z;B=e.A;P=e.B;E=e.C;U=e.D;D=e.E;L=e.F;N=e.G;j=e.H;R=e.I;F=e.J;M=e.K},function(e){H=e.p;Z=e.s;K=e.a;G=e.b},function(e){V=e.f;Q=e.a;W=e.b;Y=e.i;q=e.l;J=e.c;X=e.d;$=e.g;ee=e.s;oe=e.V;te=e.e;ne=e.t;re=e.h;ie=e.j},function(e){se=e.z;ce=e.g;ae=e.m},function(e){ue=e.b},function(e){de=e.h;le=e.g;fe=e.j;he=e.l;ve=e.b;me=e.s;pe=e.a;ge=e.i},function(e){we=e.u},function(e){ze=e.l;ke=e.g;ye=e.b},function(e){be=e._;_e=e.c;Ce=e.d;xe=e.a;Se=e.g},function(e){Ie=e.c},function(e){Te=e.c},function(e){Ae=e.g},function(e){Oe=e.i},function(e){Be=e.s},function(e){Pe=e.R},null,null,null,null,null],execute:function(){var Ee=this;
|
|
2
2
|
/**
|
|
3
3
|
* Check if store discount is enabled
|
|
4
4
|
*/var Ue=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4/*yield*/,de("/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 De=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:
|
|
@@ -77,7 +77,7 @@ return[2/*return*/,{conclusive:true,result:Me}]}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 Ze=null;var
|
|
80
|
+
*/var Ze=null;var Ke=function(e){var o=He(e);var t=o.then((function(e){var o=e.conclusive,n=e.result;if(!o&&Ze===t){
|
|
81
81
|
// Invalidate cache so the next caller performs a fresh fetch.
|
|
82
82
|
Ze=null}return n}));Ze=t;return t};
|
|
83
83
|
/**
|
|
@@ -85,9 +85,9 @@ Ze=null}return n}));Ze=t;return t};
|
|
|
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 Ge=function(){var e;if(!window.Zonos.isBigCommerce){return}var o=(e=se.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 Ke()};
|
|
91
91
|
/**
|
|
92
92
|
* Check if the current BigCommerce customer belongs to a customer group
|
|
93
93
|
* that should bypass Zonos Checkout.
|
|
@@ -102,7 +102,7 @@ void Ge()};
|
|
|
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 Ve=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ee,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!Ze){return[2/*return*/,
|
|
105
|
+
*/var Ve=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}return __awaiter(Ee,__spreadArray([],e,true),void 0,(function(e){if(e===void 0){e={}}return __generator(this,(function(o){if(e.forceRefresh||!Ze){return[2/*return*/,Ke(e.preFetched)]}return[2/*return*/,Ze]}))}))};var Qe={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
|
|
@@ -233,26 +233,30 @@ state:e.stateOrProvinceCode||e.stateOrProvince||""},email:o,name:t,phone:e.phone
|
|
|
233
233
|
for(var h=0,v=__spreadArray(__spreadArray([],d,true),u,true);h<v.length;h++){var m=v[h];var p=ao(m,a);if(!p){continue}if(!s(p.address.country)){continue}var g=uo(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 fo=function(e){if(e===void 0){e=true}if(!q.localizationLoaded){return true}if(q.isDisabledCountry){if(e){ze("Checkout: disabled country")}return true}return false};
|
|
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 fo=function(e){if(e===void 0){e=true}if(!q.localizationLoaded){return true}if(q.isDisabledCountry){if(e){ze("Checkout: disabled country")}return true}return false};
|
|
237
|
+
/**
|
|
238
|
+
* BigCommerce checkout depends on storefront callbacks (clear cart, inventory).
|
|
239
|
+
* The hosted variant leaves the storefront, so the test does not apply there.
|
|
240
|
+
*/var ho=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 vo=function(e,
|
|
237
241
|
/**
|
|
238
242
|
* If provided, will check if the country is shippable based on the provided country code instead of the Hello selected country code
|
|
239
243
|
*/
|
|
240
244
|
o){if(e===void 0){e=true}if(!q.localizationLoaded){return false}if(o){var t=J(o);if(e&&!t){ze("Checkout: ".concat(o," is not a shippable country: ").concat(t))}return t}
|
|
241
245
|
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
242
|
-
if(!q.isShippableCountry){if(e){ze("Checkout: not shippable country")}return false}return true};var
|
|
246
|
+
if(!q.isShippableCountry){if(e){ze("Checkout: not shippable country")}return false}return true};var mo=["1","true","yes"];
|
|
243
247
|
/**
|
|
244
248
|
* Page-load result of reading the checkout `zBypass` query. Later calls on the
|
|
245
249
|
* same checkout URL reuse this so stripping the parameter does not change the
|
|
246
250
|
* answer.
|
|
247
|
-
*/var
|
|
251
|
+
*/var po=null;var go=function(){return window.location.pathname.includes("/checkout")};var wo=function(e){if(e===null){return false}return mo.includes(e.trim().toLowerCase())};
|
|
248
252
|
/**
|
|
249
253
|
* True only when zonos-settings set
|
|
250
254
|
* `checkoutSettings.plugins.bigcommerce.allowBypassQuery` to `true`.
|
|
251
|
-
*/var
|
|
255
|
+
*/var zo=function(){var e,o;return((o=(e=se.checkoutSettings.plugins)===null||e===void 0?void 0:e.bigcommerce)===null||o===void 0?void 0:o.allowBypassQuery)===true};
|
|
252
256
|
/**
|
|
253
257
|
* Read an accepted `zBypass` query on the checkout page once, then remove it
|
|
254
258
|
* from the URL. A later call on that same URL returns the same answer.
|
|
255
|
-
*/var
|
|
259
|
+
*/var ko=function(){var e=window.location,o=e.pathname,t=e.search;if(po&&po.pathname===o&&po.search===t){return po.enabled}var n=new URLSearchParams(t);var r=wo(n.get("zBypass"));if(!r){po={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=zo();po={enabled:a,pathname:o,search:window.location.search};return a};
|
|
256
260
|
/**
|
|
257
261
|
* True when this BigCommerce checkout page should skip address detection.
|
|
258
262
|
* That is only when zonos-settings allows the `zBypass` query and this
|
|
@@ -260,17 +264,17 @@ if(!q.isShippableCountry){if(e){ze("Checkout: not shippable country")}return fal
|
|
|
260
264
|
* the query stays in the URL until checkout. The query is removed once, and
|
|
261
265
|
* later calls on that checkout URL keep the same answer. Nothing is written
|
|
262
266
|
* to storage.
|
|
263
|
-
*/var
|
|
267
|
+
*/var yo=function(){var e;if(!((e=window.Zonos)===null||e===void 0?void 0:e.isBigCommerce)||!go()){return false}return ko()};var bo='select[name="shippingAddress.countryCode"]';
|
|
264
268
|
/**
|
|
265
269
|
* Native BigCommerce shipping-step "Continue" button. Clicking it commits the
|
|
266
270
|
* selected shipping address and advances to the payment step.
|
|
267
|
-
*/var
|
|
271
|
+
*/var _o="#checkout-shipping-continue, #checkout-billing-continue, #checkout-payment-continue";
|
|
268
272
|
/**
|
|
269
273
|
* Check if the logged-in user already has a shipping address on the checkout
|
|
270
274
|
* that is internationally shippable. If so, optionally prompt the user to
|
|
271
275
|
* confirm before saving the address to session and redirecting to the home
|
|
272
276
|
* page to open the international checkout.
|
|
273
|
-
*/var
|
|
277
|
+
*/var Co=function(e){return __awaiter(Ee,[e],void 0,(function(e){var o,t,n,r,i,c,a,u,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*/,Q()];case 1:f=e.sent();if(!f){return[2/*return*/,"noAction"]}return[4/*yield*/,W(f)];case 2:h=e.sent();v={checkout:h,checkoutId:f};return[4/*yield*/,Ve({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(!vo(false,g)){return[2/*return*/,"noAction"]}ze(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"){ze("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*/,no({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:
|
|
274
278
|
// Update localization store with the detected country
|
|
275
279
|
X({isInitializing:false,newSelectedCountryCode:g,persistOverride:false});
|
|
276
280
|
// Save the shipping address to session storage for the international checkout
|
|
@@ -282,19 +286,19 @@ window.location.href=Fe("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
282
286
|
/**
|
|
283
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.
|
|
284
288
|
* @note Only works on default bigcommerce checkout page
|
|
285
|
-
*/var
|
|
289
|
+
*/var xo=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onInternationalCheckoutSelected,n=e.onLoggedInInternationalAddressDetected,r=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}
|
|
286
290
|
// Only the native checkout page skips address detection. Storefront pages
|
|
287
291
|
// still run the domestic-session handoff below, and they do not consume
|
|
288
292
|
// a `zBypass` query, so the parameter can survive until `/checkout`.
|
|
289
|
-
if(window.location.pathname.includes("/checkout")&&
|
|
293
|
+
if(window.location.pathname.includes("/checkout")&&yo()){return}
|
|
290
294
|
/**
|
|
291
295
|
* Keep checking.
|
|
292
296
|
* @returns `true` if the caller should stop polling — either because the user
|
|
293
297
|
* is being redirected to Zonos international checkout, or because the
|
|
294
298
|
* logged-in customer is in a bypass group and should stay on BC checkout.
|
|
295
|
-
*/var c=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,n,r,i,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:n=document.querySelector(((o=se.genericSettings)===null||o===void 0?void 0:o.bigcommerceDomesticCheckoutCountrySelector)||
|
|
299
|
+
*/var c=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,n,r,i,c,a,u,d,l,f;return __generator(this,(function(h){switch(h.label){case 0:n=document.querySelector(((o=se.genericSettings)===null||o===void 0?void 0:o.bigcommerceDomesticCheckoutCountrySelector)||bo);r=(n===null||n===void 0?void 0:n.value)||e;if(!r){
|
|
296
300
|
// do nothing if shipping country is not found
|
|
297
|
-
return[2/*return*/,"noAction"]}if(!
|
|
301
|
+
return[2/*return*/,"noAction"]}if(!vo(false,r)){
|
|
298
302
|
// do nothing if shipping country is not shippable
|
|
299
303
|
return[2/*return*/,"noAction"]}return[4/*yield*/,Q()];case 1:i=h.sent();if(!i)return[3/*break*/,3];return[4/*yield*/,W(i)];case 2:a=h.sent();return[3/*break*/,4];case 3:a=null;h.label=4;case 4:c=a;u={checkout:c,checkoutId:i};return[4/*yield*/,Ve({forceRefresh:true,preFetched:u})];case 5:d=h.sent().shouldBypass;if(d){
|
|
300
304
|
// Logged-in customer is in a bypass group — keep them on BC native
|
|
@@ -322,7 +326,7 @@ window.location.href=Fe("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
322
326
|
* checkout. Logged-in shoppers picking a saved address don't expose a
|
|
323
327
|
* country `<select>`, so read it from the active checkout consignment via the
|
|
324
328
|
* Storefront API; fall back to the `<select>` value when one is present.
|
|
325
|
-
*/var d=function(){return __awaiter(Ee,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*/,Q()];case 1:r=a.sent();if(!r)return[3/*break*/,3];return[4/*yield*/,W(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=se.genericSettings)===null||n===void 0?void 0:n.bigcommerceDomesticCheckoutCountrySelector)||
|
|
329
|
+
*/var d=function(){return __awaiter(Ee,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*/,Q()];case 1:r=a.sent();if(!r)return[3/*break*/,3];return[4/*yield*/,W(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=se.genericSettings)===null||n===void 0?void 0:n.bigcommerceDomesticCheckoutCountrySelector)||bo);return[2/*return*/,(c===null||c===void 0?void 0:c.value)||null]}}))}))};
|
|
326
330
|
/**
|
|
327
331
|
* Req 2 (05CHECK-887): once a logged-in shopper with an international default
|
|
328
332
|
* address has chosen to "Stay on this page", we must still force them onto
|
|
@@ -345,7 +349,7 @@ window.location.href=Fe("/");return[2/*return*/,"redirected"]}}))}))};
|
|
|
345
349
|
// open checkout locally, consuming and clearing the session before the
|
|
346
350
|
// navigation to `/` lands, leaving the redirect a no-op. (The `/` page
|
|
347
351
|
// runs its own fresh watcher to open checkout.)
|
|
348
|
-
if(n&&
|
|
352
|
+
if(n&&vo(false,n)){o.disconnect()}if(!n)return[3/*break*/,7];return[4/*yield*/,c(n)];case 6:s=l.sent();return[3/*break*/,8];case 7:s="noAction";l.label=8;case 8:i=s;
|
|
349
353
|
// `redirected` → the page is navigating to the Zonos international
|
|
350
354
|
// checkout, so don't replay. `bypass` / `noAction` → the shopper stays on
|
|
351
355
|
// BC native checkout, so fall through and replay the click.
|
|
@@ -366,7 +370,7 @@ he("Error handling BC continue international redirect",u);return[3/*break*/,10];
|
|
|
366
370
|
*/var f=function(e){if(u){return}u=true;document.addEventListener("click",(function(o){
|
|
367
371
|
// Programmatic replay for the domestic / bypass case — let BC's own
|
|
368
372
|
// handler run without interference.
|
|
369
|
-
if(a){return}var t=o.target;if(!(t instanceof Element)){return}var n=t.closest(
|
|
373
|
+
if(a){return}var t=o.target;if(!(t instanceof Element)){return}var n=t.closest(_o);if(!n){return}
|
|
370
374
|
// Block BC's native advance until we know whether the selected shipping
|
|
371
375
|
// country forces an international redirect. Capture phase +
|
|
372
376
|
// stopImmediatePropagation (done synchronously here, before the async
|
|
@@ -401,7 +405,7 @@ if(!s&&a){u=document.createElement("button");u.style.display="none";u.id="zonos-
|
|
|
401
405
|
// disconnect the observer after we found the shipping continue button
|
|
402
406
|
w.disconnect();return[2/*return*/]}d=window.location.pathname.includes("/checkout")&&window.Zonos.isBigCommerce;
|
|
403
407
|
// Should just disconnect the observer if it's not bigcommerce domestic checkout page
|
|
404
|
-
if(!d){w.disconnect();return[2/*return*/]}if(!(!p&&!m))return[3/*break*/,5];m=true;g=true;C.label=1;case 1:C.trys.push([1,3,4,5]);return[4/*yield*/,
|
|
408
|
+
if(!d){w.disconnect();return[2/*return*/]}if(!(!p&&!m))return[3/*break*/,5];m=true;g=true;C.label=1;case 1:C.trys.push([1,3,4,5]);return[4/*yield*/,Co({onInternationalCheckoutSelected:t,onLoggedInInternationalAddressDetected:n})];case 2:l=C.sent();if(l==="redirected"){w.disconnect();return[2/*return*/]}if(l==="optedOut"){
|
|
405
409
|
// User elected to stay on BC native checkout — don't prompt again
|
|
406
410
|
// for the rest of this session. Continue with the rest of the
|
|
407
411
|
// observer logic so the country-change watcher still fires when
|
|
@@ -410,7 +414,7 @@ p=true;
|
|
|
410
414
|
// Attach the "Continue" redirect hook now (once). Delegation on
|
|
411
415
|
// `document` keeps it working even after this observer disconnects
|
|
412
416
|
// when the country <select> path sets up its interval below.
|
|
413
|
-
f(w)}return[3/*break*/,5];case 3:z=C.sent();he("Error checking logged-in user shipping address",z);return[3/*break*/,5];case 4:m=false;g=false;return[7/*endfinally*/];case 5:k=document.querySelector(((e=se.genericSettings)===null||e===void 0?void 0:e.bigcommerceDomesticCheckoutCountrySelector)||
|
|
417
|
+
f(w)}return[3/*break*/,5];case 3:z=C.sent();he("Error checking logged-in user shipping address",z);return[3/*break*/,5];case 4:m=false;g=false;return[7/*endfinally*/];case 5:k=document.querySelector(((e=se.genericSettings)===null||e===void 0?void 0:e.bigcommerceDomesticCheckoutCountrySelector)||bo);
|
|
414
418
|
// Shouldn't do anything if it's not bigcommerce domestic checkout page
|
|
415
419
|
if(!k){
|
|
416
420
|
// do nothing if shipping country and the continue button is not found
|
|
@@ -427,27 +431,27 @@ if(h||g){return[2/*return*/]}h=true;t.label=1;case 1:t.trys.push([1,3,,4]);retur
|
|
|
427
431
|
// - the logged-in customer is in a bypass group (stay on BC checkout)
|
|
428
432
|
if(e==="redirected"||e==="bypass"){clearInterval(y);return[2/*return*/]}h=false;return[3/*break*/,4];case 3:o=t.sent();h=false;return[3/*break*/,4];case 4:return[2/*return*/]}}))}))}),1e3);b=setInterval((function(){var e;if(!window.bcStripeElements){clearInterval(b);return}var o=(e=window.bcStripeElements)===null||e===void 0?void 0:e.getElement("address");if(!o){return}clearInterval(b);o.on("change",(function(e){var o=e.value.address.country;if(o&&!g){void c(o)}}));
|
|
429
433
|
// we want to attacch event to addressElement as soon as it's loaded
|
|
430
|
-
}),500);return[2/*return*/]}}))}))}));w.observe(document.body,{childList:true,subtree:true})};var
|
|
434
|
+
}),500);return[2/*return*/]}}))}))}));w.observe(document.body,{childList:true,subtree:true})};var So=function(){var e=new URLSearchParams(window.location.search);ze("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=
|
|
431
435
|
// fallback to selected country code if country is not provided
|
|
432
|
-
$(e)||q.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
|
|
436
|
+
$(e)||q.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 Io=0;var To=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:
|
|
433
437
|
// Don't send the log if there are no API calls to send
|
|
434
438
|
if(window.Zonos.loadTimeApiInfoList.length===0){return[2/*return*/]}ze("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};
|
|
435
439
|
// Clear the list after sending the log successfully
|
|
436
440
|
window.Zonos.loadTimeApiInfoList.length=0;return[4/*yield*/,de("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){
|
|
437
441
|
// If there are errors, add the logs back to the list so we can try again later
|
|
438
|
-
(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);
|
|
442
|
+
(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);Io++;if(Io>5&&window.Zonos.logIntervalId){
|
|
439
443
|
// If there are more than 3 failures, stop the interval
|
|
440
|
-
clearInterval(window.Zonos.logIntervalId)}}return[2/*return*/]}}))}))};var
|
|
444
|
+
clearInterval(window.Zonos.logIntervalId)}}return[2/*return*/]}}))}))};var Ao=function(){return __awaiter(Ee,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=ke().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:ye},ve()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};void de("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var Oo=function(e){return __awaiter(Ee,[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:ye},ve()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};void de("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2/*return*/]}))}))};var Bo=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 Po=function(e){var o;var t=(o=ee.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 Eo=function(e){return se.enabledVariantTestKeys.includes(e)};var Uo=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;
|
|
441
445
|
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
442
|
-
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()+oe,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var
|
|
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()+oe,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var Do=function(e){return __awaiter(Ee,[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=le();return[4/*yield*/,de("/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];ze("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});
|
|
443
447
|
// wait 1 second before retrying
|
|
444
448
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,500)}))];case 2:
|
|
445
449
|
// wait 1 second before retrying
|
|
446
|
-
e.sent();return[2/*return*/,
|
|
450
|
+
e.sent();return[2/*return*/,Do({cartId:s,retries:c-1})];case 3:if(i){return[2/*return*/,null]}return[2/*return*/,r]}}))}))};var Lo=function(e){return __awaiter(Ee,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=be(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){he("[ZONOS - loadZonos] invalid cart id");return[2/*return*/,null]}return[4/*yield*/,Do({cartId:e,retries:5})];case 1:r=i.sent();ze("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){he("[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 No='<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 jo=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}"};
|
|
447
451
|
// 90 minutes
|
|
448
|
-
var
|
|
452
|
+
var Ro=90*60*1e3;
|
|
449
453
|
// 6 hours
|
|
450
|
-
var
|
|
454
|
+
var Fo=6*60*60*1e3;var Mo=e("zonos_checkout",/** @class */function(){function e(e){var t=this;o(this,e);this.storeUnsubscribeList=[];this.isRedirectAfterOrder=false;
|
|
451
455
|
/**
|
|
452
456
|
* Preview checkout without needing to click on the button. This would be useful for demo purpose
|
|
453
457
|
*/this.preview=false;
|
|
@@ -561,29 +565,25 @@ ee.checkoutSessionId=e;return[4/*yield*/,d()];case 1:o=s.sent(),t=o.errors,n=o.j
|
|
|
561
565
|
// treat every first-ever open as already paid, so both must be true.
|
|
562
566
|
if(r.completedAt&&r.order){void this.setToFinishStep("succeeded");return[2/*return*/,true]}if(!r.clientSecret)return[3/*break*/,3];return[4/*yield*/,u({clientSecret:r.clientSecret})];case 2:i=s.sent().status;if(i==="processing"||i==="succeeded"){c.clientSecret=r.clientSecret;void this.setToFinishStep(i);return[2/*return*/,true]}s.label=3;case 3:return[2/*return*/,false]}}))}))};this.initializeTestKeys=function(){
|
|
563
567
|
// cleanup expired test keys
|
|
564
|
-
ee.enabledVariantTestKeys=
|
|
568
|
+
ee.enabledVariantTestKeys=Bo(ee.enabledVariantTestKeys||[]);
|
|
565
569
|
// map existingSelection to the enabled variant test keys from database
|
|
566
570
|
var e=se.enabledVariantTestKeys.map((function(e){var o;
|
|
567
571
|
// We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
|
|
568
|
-
var t=(o=ee.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()+oe,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));te(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){
|
|
569
|
-
// This test is only applicable to checkout that's using createCartid callback
|
|
570
|
-
if(typeof se.checkoutSettings.createCartId!=="function"){return false}var e=se.enabledVariantTestKeys.includes("hosted_vs_native");
|
|
571
|
-
// Should not do anything if the test is not enabled
|
|
572
|
-
if(!e){return false}return true};
|
|
572
|
+
var t=(o=ee.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()+oe,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));te(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){var e;return ho({createCartId:se.checkoutSettings.createCartId,enabledTestKeys:se.enabledVariantTestKeys,isBigCommerce:Boolean((e=window.Zonos)===null||e===void 0?void 0:e.isBigCommerce)})};
|
|
573
573
|
// 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*/]}ze("[TEST] - Registering hosted vs native test");o=
|
|
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*/]}ze("[TEST] - Registering hosted vs native test");o=Po("hosted_vs_native");
|
|
575
575
|
// No need to request variant test for this test if the test already has variant selected
|
|
576
576
|
if(o){ze("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2/*return*/]}return[4/*yield*/,De({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();
|
|
577
577
|
// Do not prevent user from proceeding if the test is not enabled or failed to get selection
|
|
578
|
-
if(!t){ze("[TEST] - Failed to get selection for hosted vs native test");return[2/*return*/]}n=
|
|
578
|
+
if(!t){ze("[TEST] - Failed to get selection for hosted vs native test");return[2/*return*/]}n=Uo({baseTestObj:ee.enabledVariantTestKeys||[],mergeTestObj:t});
|
|
579
579
|
// Set the selected variant to the storage store
|
|
580
580
|
te(n);return[2/*return*/]}}))}))};
|
|
581
581
|
// 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=
|
|
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=Po("hosted_vs_native");ze("[TEST] - hosted_vs_native: ".concat(t));
|
|
583
583
|
// This test is only applicable to checkout that's using createCartid callback
|
|
584
584
|
if(typeof se.checkoutSettings.createCartId!=="function"){ze("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2/*return*/,{redirected:false}]}
|
|
585
585
|
// No need to do anything if the test is enabled for native
|
|
586
|
-
if(t!=="hosted"){ze("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=se.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){ze("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}ze('"createCartId" is provided, start building cart');return[4/*yield*/,se.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=
|
|
586
|
+
if(t!=="hosted"){ze("[TEST] - Hosted vs native test is enabled for native, skipping");return[2/*return*/,{redirected:false}]}if(!((e=se.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){ze("[TEST] - Hosted checkout URL is not provided");return[2/*return*/,{redirected:false}]}ze('"createCartId" is provided, start building cart');return[4/*yield*/,se.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=So();c=Le(Object.assign(Object.assign({cartId:r,checkoutSessionId:ee.checkoutSessionId||undefined,hostedCheckoutUrl:se.genericSettings.hostedCheckoutUrl,isTestMode:le(),isVariantTest:true},s),i));ze("[TEST] - Redirecting to: ".concat(c));
|
|
587
587
|
// Open new page with the cart URL
|
|
588
588
|
window.open(c,"_blank");return[2/*return*/,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}
|
|
589
589
|
// get date in 24/12/2024 format (without time)
|
|
@@ -597,7 +597,7 @@ var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=f
|
|
|
597
597
|
* forcing them to retype anything. Skips when an address has already been
|
|
598
598
|
* prefilled by another path (Stripe customer profile, merchant-provided
|
|
599
599
|
* `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*/,Q()];case 1:o=r.sent();if(!o){return[2/*return*/]}return[4/*yield*/,W(o)];case 2:t=r.sent();if(!Y(t)){return[2/*return*/]}n=lo(t,{isShippable:function(e){return
|
|
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*/,Q()];case 1:o=r.sent();if(!o){return[2/*return*/]}return[4/*yield*/,W(o)];case 2:t=r.sent();if(!Y(t)){return[2/*return*/]}n=lo(t,{isShippable:function(e){return vo(false,e)},selectedCountryCode:q.selectedCountryCode||undefined});if(!n.length){return[2/*return*/]}
|
|
601
601
|
// Re-check after the awaits — another prefill path may have populated state
|
|
602
602
|
// while we were waiting on the network.
|
|
603
603
|
if(this.defaultCustomerProfileAddress.length){return[2/*return*/]}this.defaultCustomerProfileAddress=n;ze("Prefilled ".concat(String(n.length)," BigCommerce customer address(es) for logged-in shopper"),"info");return[2/*return*/]}}))}))};this.getDefaultAddress=function(){
|
|
@@ -626,7 +626,7 @@ if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){ee.checko
|
|
|
626
626
|
// merge variant test input from url to storageStore.enabledVariantTestKeys
|
|
627
627
|
var n=ee.enabledVariantTestKeys||[];
|
|
628
628
|
// override the selected variant key if it's not "hosted" since we are in hosted checkout tab
|
|
629
|
-
if(window.Zonos.isLegacyCheckout){var r=
|
|
629
|
+
if(window.Zonos.isLegacyCheckout){var r=Po("hosted_vs_native");
|
|
630
630
|
// Set selected variant key "hosted" to enabledVariantTestKeys if it's not in enabledVariantTestKeys already
|
|
631
631
|
if(!r){n.push({expiresAt:Date.now()+oe,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});te(n)}else{te(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}
|
|
632
632
|
// Remove query params from the url
|
|
@@ -666,7 +666,7 @@ this.useShippingDataFromCreateCartId(o.shippingData);l.customerAuthenticationTok
|
|
|
666
666
|
// Normalize against misbehaving merchant callbacks: only accept an
|
|
667
667
|
// array of strings, drop everything else so a bad value can't crash
|
|
668
668
|
// the renderer (`.filter(...)` would throw on non-arrays).
|
|
669
|
-
l.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((function(e){return typeof e==="string"})):[]}else{t=o}window.Zonos.cartId=t;return[4/*yield*/,
|
|
669
|
+
l.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((function(e){return typeof e==="string"})):[]}else{t=o}window.Zonos.cartId=t;return[4/*yield*/,Lo(t)];case 2:n=_.sent();r=n===null||n===void 0?void 0:n.cartData;if(!r){he("Failed to build cart, please try again.");return[2/*return*/,false]}window.Zonos.cartData=r;i=ue(r),s=i.adjustments,a=i.cartItems;return[4/*yield*/,f({adjustments:s,cartItems:a})];case 3:_.sent();return[3/*break*/,12];case 4:if(!window.Zonos.cartData)return[3/*break*/,9];ze("tempCartUUID is provided, start building cart");u=(e=window.Zonos.cartData.references)===null||e===void 0?void 0:e.checkoutSessionId;if(!u)return[3/*break*/,6];ze("Setting checkout session id from cart reference","info",u);return[4/*yield*/,this.recoverCompletedOrderModificationSession(u)];case 5:d=_.sent();if(d){
|
|
670
670
|
// Recovery routes straight to the finish step, bypassing the
|
|
671
671
|
// cartStoreUpdateItems call below that would normally clear this -
|
|
672
672
|
// without it, the finish screen would spin forever (dialogLoading
|
|
@@ -690,7 +690,7 @@ _.sent();k=se.checkoutSettings,y=k.successBehavior,b=k.successRedirectUrl;this.i
|
|
|
690
690
|
// to payment, same as the Collect flow does for its own cart type. Lives
|
|
691
691
|
// here (rather than at each buildCartAndInit call site) so every caller
|
|
692
692
|
// gets it, including the forceDialogOpen/preview init path.
|
|
693
|
-
if(z()){l.step="payment"}return[2/*return*/,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=fe(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;ze("=== 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")||
|
|
693
|
+
if(z()){l.step="payment"}return[2/*return*/,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=fe(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;ze("=== 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")||Fo;
|
|
694
694
|
// if the order is placed within 5 minutes, confirm with the user to proceed with the order duplication
|
|
695
695
|
if(o>t){ze("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");
|
|
696
696
|
// remove the placed order info if it's older than 5 minutes and do nothing.
|
|
@@ -731,7 +731,7 @@ i.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r
|
|
|
731
731
|
// do nothing if event is already attached
|
|
732
732
|
return}ze("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,a,u,d,f,h,v,m,p,g,w,z,x,S,I,T,A;return __generator(this,(function(O){switch(O.label){case 0:i=performance.now();s=t&&n.matches(t);a=n.matches("#".concat(xe));u=n.matches("#".concat(Ce))||n.matches("#".concat(_e));
|
|
733
733
|
// Allow no country set for legacy facades. Otherwise enforce it being a shippable country and not disabled.
|
|
734
|
-
if(!window.Zonos.isLegacyCheckout&&(!
|
|
734
|
+
if(!window.Zonos.isLegacyCheckout&&(!vo()||fo())&&!s&&!a&&!u){return[2/*return*/]}o.preventDefault();o.stopPropagation();ze("zonos checkout button clicked");return[4/*yield*/,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=O.sent().shouldAllowOrder;
|
|
735
735
|
// Only allow order to proceed if payment intent is not succeeded
|
|
736
736
|
if(!d){return[2/*return*/]}
|
|
737
737
|
/**
|
|
@@ -739,7 +739,7 @@ if(!d){return[2/*return*/]}
|
|
|
739
739
|
* 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
740
|
*/if(!window.Zonos.logIntervalId){
|
|
741
741
|
// 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
|
|
742
|
+
window.Zonos.logIntervalId=setInterval((function(){void To()}),2e3)}if(!Eo("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:f=O.sent().redirected;this.isOverlayLoading=false;
|
|
743
743
|
// Stop the process if the user is being redirected to the hosted checkout page
|
|
744
744
|
if(f){return[2/*return*/]}O.label=4;case 4:if(!window.Zonos.isBigCommerce)return[3/*break*/,7];return[4/*yield*/,Ve()];case 5:h=O.sent().shouldBypass;if(h){ze("Bypass customer group detected, redirecting to BigCommerce native checkout","info");
|
|
745
745
|
// Carry over zonosQaUrl / zonosTestMode so the BC native
|
|
@@ -758,9 +758,9 @@ p=ne("Unable to check inventory. Please try again.");return[3/*break*/,13];case
|
|
|
758
758
|
// and "Return to cart" resets the message + closes cleanly.
|
|
759
759
|
l.inventoryCheckErrorMessage=p;c.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:ee.checkoutSessionId,type:"zonos-checkout-session-update"},"*");
|
|
760
760
|
// start the timer to validate the price
|
|
761
|
-
y({isPreview:this.preview,sessionTimeout:
|
|
761
|
+
y({isPreview:this.preview,sessionTimeout:Ro});Z({event:"zonos-checkout-start",metadata:{checkoutSessionId:ee.checkoutSessionId}});w=ee.checkoutSessionId;void b({checkoutSessionId:w,eventName:"checkout_open"});return[4/*yield*/,Ue()];case 15:z=O.sent().enabled;
|
|
762
762
|
// Hide discount input if there's no active discount configured for the store
|
|
763
|
-
l.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void
|
|
763
|
+
l.shouldHideDiscountInput=!z;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void Ao()}else{x=performance.now();S=x-i;void Oo({loadTime:S})}this.recordCheckoutInfo();I=!!Se();if(I){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
764
|
// stop loading
|
|
765
765
|
c.isFetchingSession=false;he(T);if(this.isCartExpired){c.isFetchingSession=true;return[2/*return*/]}
|
|
766
766
|
// We want to log the error anytime we fail to create a checkout session
|
|
@@ -800,7 +800,7 @@ l.isStagingMode=pe();
|
|
|
800
800
|
if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}
|
|
801
801
|
// Start fetching BigCommerce customer group on page load so the bypass
|
|
802
802
|
// result is ready by the time checkout opens or the BC watcher fires
|
|
803
|
-
|
|
803
|
+
Ge();
|
|
804
804
|
// Warm the BigCommerce `/checkouts/settings` fetch (merchant's
|
|
805
805
|
// `guest_checkout_type`) so force-login gating resolves instantly when
|
|
806
806
|
// the shopper clicks checkout — otherwise the first checkout open
|
|
@@ -820,7 +820,7 @@ this.handleBigcommerceInternationalResumeFlag();
|
|
|
820
820
|
// the prefill itself guards against overwriting other prefill sources.
|
|
821
821
|
void this.prefillBigCommerceCustomerAddresses();
|
|
822
822
|
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
823
|
-
|
|
823
|
+
xo({domesticRedirectedBtnSelector:Ce,onInternationalCheckoutSelected:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.detectedDomesticCheckoutDialogOpen=true;
|
|
824
824
|
// wait for 2 secs
|
|
825
825
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,2e3)}))];case 1:
|
|
826
826
|
// wait for 2 secs
|
|
@@ -874,7 +874,7 @@ if(i&&l.addressFormRenderType==="stripe"){void me({endpoint:"ADDRESS_NOT_READY_A
|
|
|
874
874
|
// stop interval if the step is not customer-info
|
|
875
875
|
clearInterval(e);return}if(!c.isFetchingLandedCost){if(l.landedCostData){
|
|
876
876
|
// start init paypal with the presentment currency when landed cost is fetched
|
|
877
|
-
void
|
|
877
|
+
void G({currency:l.currency});
|
|
878
878
|
// only go to next step if landed cost data is ready
|
|
879
879
|
T()}u.submitLoading=false;if(e){clearInterval(e)}}};
|
|
880
880
|
// Immediately move to the next step
|
|
@@ -898,7 +898,7 @@ return[2/*return*/]}
|
|
|
898
898
|
// Close the dialog after the user confirms to proceed with the payment in USD
|
|
899
899
|
this.payInUsdConfirmDialogOpen=false;o=A();h.label=1;case 1:h.trys.push([1,,18,19]);
|
|
900
900
|
// reset paypal error message
|
|
901
|
-
|
|
901
|
+
K.paypalErrorMessage=null;
|
|
902
902
|
// reset error state
|
|
903
903
|
c.hasPaymentError=false;this.submitLoading=true;
|
|
904
904
|
// reset inventory check message
|
|
@@ -1031,11 +1031,11 @@ var I=this.getBaseCurrencySettlementInfo();var T=function(){
|
|
|
1031
1031
|
// add timestamp to logo url if it's preview mode so browser won't cache it on the dashboard setting
|
|
1032
1032
|
var o=e.preview?"".concat(m,"?timestamp=").concat(Date.now()):m;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(se.organizationName," logo"),src:o}))};var A=le();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||pe();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},T(),A&&t("zonos-badge",{badgeColor:"orange",size:"small"},ne("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},ne("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")),!d&&t("zonos-checkout-progress-tabs",{backgroundColor:
|
|
1033
1033
|
// 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:
|
|
1034
|
+
e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return t("zonos-custom-message",{icon:No,message:e.message})})))};var B=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:ne("Your checkout session has expired. Please reload the page to continue."),restStateTitle:ne("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},ne("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":Ae({overrideBorderStyle:p})}},l.step!=="finish"&&l.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":y,style:Be({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&O(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:b}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:b}),l.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:b})),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:Pe}),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
1035
|
// do nothing if it's not mobile
|
|
1036
1036
|
if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{
|
|
1037
1037
|
// 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:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:
|
|
1038
|
+
collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:No,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:No,message:C}))))),(l.step==="finish"||l.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:Pe}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:w})),t("zonos-checkout-finish",{borderRadius:p,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":w,mobile:e.isMobile,
|
|
1039
1039
|
/**
|
|
1040
1040
|
* For this component, use slot instead of passing JSX through prop of other component. Because
|
|
1041
1041
|
* the click outside event will be triggered on and targeted to whichever component that it's attached to.
|
|
@@ -1065,4 +1065,4 @@ dialogOpen:this.isCartExpired,
|
|
|
1065
1065
|
// If dialog is in open state, the message should not be null
|
|
1066
1066
|
dialogSubtitle:ne("You are being sent back to the shop to re-add items to your cart."),dialogTitle:ne("Shopping cart expired"),dialogType:"alert",
|
|
1067
1067
|
// 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}());
|
|
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}());Mo.style=jo()}}}));
|