@zonos/elements 1.3.209 → 1.3.210

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.
Files changed (51) hide show
  1. package/dist/cjs/{cart-2ec8cac2.js → cart-313bd2ff.js} +3 -0
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/{paypal-6449314e.js → paypal-67c96668.js} +1 -1
  4. package/dist/cjs/zonos-address_11.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +2 -2
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  7. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  9. package/dist/collection/components/store/checkout/stripe.js +3 -0
  10. package/dist/esm/{cart-2f84f632.js → cart-e0703306.js} +3 -0
  11. package/dist/esm/index.js +7 -7
  12. package/dist/esm/{paypal-1cf701aa.js → paypal-dbaf76fd.js} +1 -1
  13. package/dist/esm/zonos-address_11.entry.js +1 -1
  14. package/dist/esm/zonos-cart-items_14.entry.js +2 -2
  15. package/dist/esm/zonos-checkout.entry.js +2 -2
  16. package/dist/esm/zonos-controller.entry.js +1 -1
  17. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  18. package/dist/esm-es5/cart-e0703306.js +1 -0
  19. package/dist/esm-es5/index.js +1 -1
  20. package/dist/esm-es5/{paypal-1cf701aa.js → paypal-dbaf76fd.js} +1 -1
  21. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  22. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  23. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  24. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  25. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  26. package/dist/scripts/index.js +1 -1
  27. package/dist/scripts/loadZonos.js +1 -1
  28. package/dist/scripts/zonos.js +1 -1
  29. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  30. package/dist/zonos-elements/index.esm.js +1 -1
  31. package/dist/zonos-elements/{p-bfdb4e7a.entry.js → p-03c060d3.entry.js} +1 -1
  32. package/dist/zonos-elements/{p-b1bfeec9.system.entry.js → p-20b702a7.system.entry.js} +1 -1
  33. package/dist/zonos-elements/{p-d1c0bf92.entry.js → p-23142862.entry.js} +1 -1
  34. package/dist/zonos-elements/{p-30a9f802.system.entry.js → p-37058486.system.entry.js} +1 -1
  35. package/dist/zonos-elements/p-3ee44728.system.js +1 -1
  36. package/dist/zonos-elements/{p-371d91d1.js → p-5b3b58ef.js} +1 -1
  37. package/dist/zonos-elements/{p-44c0a584.system.js → p-68650f1e.system.js} +1 -1
  38. package/dist/zonos-elements/{p-08b29f73.system.entry.js → p-7211cb9f.system.entry.js} +1 -1
  39. package/dist/zonos-elements/{p-4f5513dc.entry.js → p-73ff25d8.entry.js} +1 -1
  40. package/dist/zonos-elements/{p-4ed73ff8.entry.js → p-7b02b1f6.entry.js} +1 -1
  41. package/dist/zonos-elements/p-7ec1fecb.system.js +1 -0
  42. package/dist/zonos-elements/{p-3c752420.system.js → p-8d0e116f.system.js} +1 -1
  43. package/dist/zonos-elements/p-992f0b96.js +1 -0
  44. package/dist/zonos-elements/{p-fdf5b8f4.entry.js → p-a1137930.entry.js} +1 -1
  45. package/dist/zonos-elements/{p-db424e02.system.entry.js → p-bf364990.system.entry.js} +1 -1
  46. package/dist/zonos-elements/{p-896f2358.system.entry.js → p-cf999a15.system.entry.js} +1 -1
  47. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/esm-es5/cart-2f84f632.js +0 -1
  50. package/dist/zonos-elements/p-542acc2c.js +0 -1
  51. package/dist/zonos-elements/p-5711e187.system.js +0 -1
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,n,r,t){function o(e){return e instanceof r?e:new r((function(n){n(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(t.next(e))}catch(e){i(e)}}function s(e){try{d(t["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):o(e.value).then(a,s)}d((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return d([e,n])}}function d(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,r){if(r||arguments.length===2)for(var t=0,o=n.length,i;t<o;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-19182dc7.system.js","./p-0751b878.system.js","./p-a411ce2a.system.js","./p-3633a952.system.js","./p-738a49c0.system.js"],(function(e){"use strict";var n,r,t,o,i,a,s,d,u,l,c,v,f,p,h,m,w,g;return{setters:[function(e){n=e.z;r=e.c},function(e){t=e.s;o=e.l;i=e.t;a=e.f;s=e.b},function(e){d=e.l;u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;p=e.d;h=e.b;m=e.j},function(e){w=e.i},function(e){g=e.g}],execute:function(){var y=this;var b=function(e){var n=e.currentAddress,r=e.translatedAddress;var t,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,p=u.postal_code,h=u.state;var m=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((t=r.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=r.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=r.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=r.name)===null||a===void 0?void 0:a[m])||m,phone:n.value.phone||"",postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[p])||p,state:((d=r.state)===null||d===void 0?void 0:d[h])||h}};var _=function(e){var n;var r=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=B.stripeLinkEventData;var i=B.stripeAddressEventData;var a=B.stripeShippingSameAsBilling?B.stripeAddressEventData:B.stripeBillingAddressEventData;if(!i||!a){throw new Error("Missing stripe address data")}var s=b({currentAddress:i,translatedAddress:B.translatedAddress.address});var d=s.name.split(" ")[0]||"";var u=s.name.split(" ").splice(1).join(" ")||"";var l=b({currentAddress:a,translatedAddress:B.translatedAddress.address});var c=l.name.split(" ")[0]||"";var v=l.name.split(" ").splice(1).join(" ")||"";return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:v,phone:l.phone},cartCurrencyCode:(n=_e.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:B.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:d,lastName:u,phone:s.phone},isTest:!!r,landedCostAdjustments:_e.promoCode?[{amount:0,productId:null,promoCode:_e.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:B.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};var S=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=B.stripeLinkEventData;var r=B.stripeAddressEventData;var o=B.stripeShippingSameAsBilling?B.stripeAddressEventData:B.stripeBillingAddressEventData;d({stripeAddressData:r,stripeBillingAddressData:o},"info");if(!r||!o){throw new Error("Missing stripe address data")}var i=b({currentAddress:r,translatedAddress:B.translatedAddress.address});var a=i.name.split(" ")[0]||"";var s=i.name.split(" ").splice(1).join(" ")||"";var u=b({currentAddress:o,translatedAddress:B.translatedAddress.address});var l=u.name.split(" ")[0]||"";var c=u.name.split(" ").splice(1).join(" ")||"";var v=_e.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var f=_e.promoCode?__spreadArray([{amount:0,productId:null,promoCode:_e.promoCode,sku:null,type:"PROMO_CODE"}],v,true):v;return{billingAddress:{addressLine1:u.line1,addressLine2:u.line2||"",city:u.city,country:u.country,postalCode:u.postal_code,state:u.state},billingContact:{firstName:l,lastName:c,phone:u.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:B.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:a,lastName:s,phone:i.phone},isTest:e,items:_e.items,landedCostAdjustments:f,shipToTaxId:B.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var O=function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=S();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:u["vercel"]})];case 1:s=f.sent();if(!s||!((n=s.checkoutSessionWorkflow)===null||n===void 0?void 0:n.length)&&((r=s.errors)===null||r===void 0?void 0:r.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,l("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=f.sent(),c=d.errors,v=d.json;if(!v||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var k=function(e){return __awaiter(y,void 0,void 0,(function(){var r,t,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,O(t)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:S(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=u.sent(),a=i.errors,s=i.json;if(a.length||!s){d=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(d){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}a.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2,s]}return[2,s]}}))}))};var C=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,i,a,s;var d=e.abortController,u=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:_(u),method:"POST",signal:d===null||d===void 0?void 0:d.signal})];case 1:t=e.sent(),o=t.errors,i=t.json;if(o.length||!i){a=((n=o[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((r=o[0])===null||r===void 0?void 0:r.message.includes("signal is aborted"));s=a?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(s)}return[2,i]}}))}))};var A=undefined&&undefined.__rest||function(e,n){var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0)r[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))r[t[o]]=e[t[o]]}return r};var I=function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,k(e)];case 1:r=a.sent();return[2,r];case 2:return[4,C({abortController:e,cartId:n})];case 3:t=a.sent(),o=t.cartWorkflow,i=A(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var T=e("t",(function(e){return __awaiter(y,[e],void 0,(function(e){var r,t,i,a,s,d,u,h,m;var w=e.checkoutSessionId,g=e.eventName,y=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:i=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;h=n.organizationId;if(!w){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:p,checkoutSessionId:w,eventName:g,metadata:y,organizationId:h,trackEventLogs:a}});return[2]}if(!h){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:p,checkoutSessionId:w,eventName:g,metadata:y,organizationId:h,trackEventLogs:a}})}m={checkoutSessionId:w,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:h};return[4,l("/api/zonos-elements/track-conversion-event",{body:m,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var E=function(e){var n=e.address,r=e.invalidAdddressList;if(!n){return}if(!r){return}var t={};if(r.city){t.city=n.city}if(r.line1){t.line1=n.line1}if(r.line2){t.line2=n.line2}if(r.postal_code){t.postal_code=n.postal_code}if(r.state){t.state=n.state}if(r.name){t.name=n.name}return Object.keys(t).length?t:undefined};var j=function(e){var n=e.addressInvalidCharactersList,r=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a,s,d,u;var l=!!(t===null||t===void 0?void 0:t.complete);var c=i?l:!!(o===null||o===void 0?void 0:o.complete);if(!l||!c){return null}if(!n&&!r){return null}var v=t.value;var f=(o===null||o===void 0?void 0:o.value)||null;var p=v.firstName||((a=v.name)===null||a===void 0?void 0:a.split(" ")[0]);var h=v.lastName||((s=v.name)===null||s===void 0?void 0:s.split(" ")[1]);var m="".concat(p," ").concat(h);var w=v.firstName||((d=f===null||f===void 0?void 0:f.name)===null||d===void 0?void 0:d.split(" ")[0]);var g=v.lastName||((u=f===null||f===void 0?void 0:f.name)===null||u===void 0?void 0:u.split(" ")[1]);var y=w&&g?"".concat(w," ").concat(g):"";var b=v.address;var _=f===null||f===void 0?void 0:f.address;return{address:E({address:Object.assign(Object.assign({},b),{name:m}),invalidAdddressList:n}),billingAddress:!i?E({address:_?Object.assign(Object.assign({},_),{name:y}):null,invalidAdddressList:r}):undefined,destinationCountry:b.country}};var N=e("K",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var P=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),r=n.errors,o=n.json;return[2,{errors:r,json:o}]}}))}))};var D=e("z",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,P()];case 1:n=o.sent(),r=n.errors,t=n.json;if(r.length||!t){h("Failed to retrieve checkout session info before confirming payment ",r);void f({endpoint:"validateCheckoutSession",errors:r.map((function(e){return e.message})),metadata:{allLogs:p}});return[2,{errorMessage:i("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){h("Landed cost is not found in the checkout session before confirming payment.");void f({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:p}});return[2,{errorMessage:i('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))}));var L=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var x=function(e){var n=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:g({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var R=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),z=R.onChange,U=R.reset,B=R.state;e("c",B);var F=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,i=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,d=e.paypalEnabled;var u=i||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=u&&w(u)?"night":"flat";var v=s==="DARK"?"night":"flat";var f=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},L({theme:s||"LIGHT"})),theme:s?v:c,variables:Object.assign(Object.assign({},x({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:r||undefined,customerSessionClientSecret:B.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],f,true),locale:o.selectedLocale}};var J=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var M=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var q=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return m(e)}));var W=e("i",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i;return __generator(this,(function(a){t=B.clientSecret;if(!B.stripe){d("Skip. Stripe is not initialized");return[2]}o=F({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(B.stripeElementsOptions);if(!B.stripeElements||!B.stripeElementsForBillingAddress){B.stripeElements=(n=B.stripe)===null||n===void 0?void 0:n.elements(o);B.stripeElementsOptions=o;d("Stripe elements initialized");B.stripeElementsForBillingAddress=(r=B.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");return[2]}if(!i){B.stripeElements.update(o);B.stripeElementsForBillingAddress.update(o);B.stripeElementsOptions=o;void B.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var Y=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");U();B.stripe=window.Zonos.stripe}));var H=function(){var e,n,r,t;var o=JSON.stringify((e=B.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!B.stripeShippingSameAsBilling&&JSON.stringify((r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value)!==JSON.stringify((t=B.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var K=function(){var e,n,r,t,o,i;var a=JSON.stringify((e=B.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((r=B.stripeAddressUsedWhenAsyncAddressUpdate)===null||r===void 0?void 0:r.value)!==JSON.stringify((t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value);var d=!B.stripeShippingSameAsBilling&&JSON.stringify((o=B.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=B.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=B.taxIdUsedWhenAsyncAddressUpdate!==B.taxId;var l=B.companyNameUsedWhenAsyncAddressUpdate!==B.companyName;return a||s||d||u||l};var G=function(e){var n=e.address,r=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=(i===null||i===void 0?void 0:i.split(" ")[0])||r||"";var d=(i===null||i===void 0?void 0:i.split(" ")[1])||o||"";if(!s||!d){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:r,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:s,lastName:d,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}};var V=e("H",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,i,a,s,d,u,c,v,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=B.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!B.stripeShippingSameAsBilling&&!((n=B.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!B.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!_e.landedCostData){return[2,{partiesCreated:false}]}i=(r=_e.landedCostData.find(Boolean))===null||r===void 0?void 0:r.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=K();if(!a){return[2,{partiesCreated:false}]}s=G({address:B.stripeAddressEventData.value.address,firstName:B.stripeAddressEventData.value.firstName,lastName:B.stripeAddressEventData.value.lastName,name:B.stripeAddressEventData.value.name,phone:B.stripeAddressEventData.value.phone});d=B.stripeShippingSameAsBilling?s:G({address:B.stripeBillingAddressEventData.value.address,firstName:B.stripeBillingAddressEventData.value.firstName,lastName:B.stripeBillingAddressEventData.value.lastName,name:B.stripeBillingAddressEventData.value.name,phone:B.stripeBillingAddressEventData.value.phone});u=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,l("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:d,companyName:B.companyName,email:((o=B.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:B.taxId},method:"POST"})];case 1:c=w.sent(),v=c.errors,m=c.json;if(v.length||!m){h("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:v,json:m}});return[2,{partiesCreated:false}]}B.companyNameUsedWhenAsyncAddressUpdate=B.companyName;B.stripeAddressUsedWhenAsyncAddressUpdate=B.stripeAddressEventData;B.stripeBillingAddressUsedWhenAsyncAddressUpdate=B.stripeBillingAddressEventData;B.taxIdUsedWhenAsyncAddressUpdate=B.taxId;B.partyBillingId=m.billToPartyId;B.partyShippingId=m.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Z=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Q=function(){var e,n;var r=JSON.stringify((e=B.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeLinkEventData)===null||n===void 0?void 0:n.value);var t=B.stripeAddressEventData&&JSON.stringify(Z(B.stripeAddressEventData.value))!==JSON.stringify(B.stripeAddressUsedWhenFetchingLC);var o=!B.stripeShippingSameAsBilling&&B.stripeBillingAddressEventData&&JSON.stringify(Z(B.stripeBillingAddressEventData.value))!==JSON.stringify(B.stripeBillingAddressUsedWhenFetchingLC);return r||t||o};var X=function(){var e;var n=_e.landedCostData&&((e=_e.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==_e.subtotal;var r=Q();d("isPrefetchInfoOutdated","info",{isAddressOutdated:r});return!_e.landedCostData&&!B.isFetchingLandedCost||r||n};var $=function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(_e.addressFormRenderType==="stripe"){return a||s}return s};var ee=function(){var e,n,r,t;var o=!!((e=B.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=B.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=B.stripeShippingSameAsBilling?i:!!((r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete);var s=((t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var d=$(s);if(i&&a&&o){return true}if(!d||!B.stripeAddressEventData){return i&&a&&o}var u=B.stripeAddressEventData.value.address.line1.length>0;var l=B.stripeAddressEventData.value.firstName&&B.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&B.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&B.stripeAddressEventData.value.address.postal_code.length>=3;var f=B.stripeAddressEventData.value.phone&&B.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var ne=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;B.fetchingLandedCostAbortController=n;ze();return[4,I(n)];case 1:r=v.sent(),o=r.checkoutSessionWorkflow,i=r.errors,a=r.itemCreateWorkflow,s=r.landedCostCalculateWorkflow,d=r.partyCreateWorkflow,u=r.shipmentRatingCalculateWorkflow;_e.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var n;return((n=e.extensions)===null||n===void 0?void 0:n.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;_e.shippingData=N((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ce(a);B.fetchingLandedCostAbortController=null;_e.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];_e.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var n=s===null||s===void 0?void 0:s.find((function(n){return(n===null||n===void 0?void 0:n.id)===e.landedCostId}));if(!n){return null}return Object.assign(Object.assign({},e),{landedCost:n})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void T({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=_e.promoCodeApplied&&!_e.landedCostData.find((function(e){var n;return(n=e.landedCost.appliedAdjustments)===null||n===void 0?void 0:n.find((function(e){return e.type==="PROMO_CODE"}))}));_e.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",_e.promoCode)}return[2]}}))}))};var re=e("q",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i,a,s,d,u,l,c,v,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=X();d=ee();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=B.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();B.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){B.isFetchingLandedCost=false;setTimeout((function(){B.isFetchingLandedCost=true}),300)}else{B.isFetchingLandedCost=true}if(B.stripeAddressEventData){B.stripeAddressUsedWhenFetchingLC={countryCode:B.stripeAddressEventData.value.address.country,postalCode:B.stripeAddressEventData.value.address.postal_code,state:B.stripeAddressEventData.value.address.state}}if(B.stripeBillingAddressEventData){B.stripeBillingAddressUsedWhenFetchingLC={countryCode:B.stripeBillingAddressEventData.value.address.country,postalCode:B.stripeBillingAddressEventData.value.address.postal_code,state:B.stripeBillingAddressEventData.value.address.state}}if(B.stripeLinkEventData){B.stripeLinkUsedWhenFetchingLC=Object.assign({},B.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);ze();return[4,ne()];case 2:w.sent();u=(r=_e.shippingData)===null||r===void 0?void 0:r.find(Boolean);l=(t=_e.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Te({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();_e.landedCostData=[];_e.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!p.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,re(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=B.stripeAddressEventData)===null||o===void 0?void 0:o.value;void f({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:h(v);return[3,7];case 7:B.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var te=e("B",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,re({applyingPromocode:true})];case 1:o.sent();if(_e.step==="payment"){Fe()}return[4,V()];case 2:o.sent();r=(e=_e.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(n=_e.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(r===null||r===void 0?void 0:r.id)}));if(!r||!t){return[2]}return[4,De(r,t.landedCostId)];case 3:o.sent();return[2]}}))}))}));var oe=e("D",(function(){_e.promoCode="";sessionStorage.removeItem("zonos--promo-code");_e.promoCodeError=false;_e.promoCodeApplied=false}));var ie=e("C",(function(){return __awaiter(y,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(_e.step==="payment"){Fe()}oe();return[4,te()];case 1:e.sent();return[2]}}))}))}));var ae=e("E",(function(e){var n=[];var r=true;switch(e){case"succeeded":{n=[i("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",i("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];r=false;break}case"requires_capture":case"processing":{n=[i("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{n=[i("Payment failed. Please try another payment method.")];break}case"requires_action":{r=false;n=[i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[i("Something went wrong.")];break}}return{isError:r,messages:n}}));var se=e("v",(function(){return __awaiter(y,void 0,void 0,(function(){var e,r,t,o,a,s,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:t=n.checkoutSettings.onInventoryCheck;o=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=v.sent(),s=a.errors,d=a.json;if(s.length||!d){h("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!d.available||d.status===204){return[2,i("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(d.available||d.status===200){B.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,t({items:_e.items})];case 4:u=v.sent();return[2,u];case 5:c=v.sent();u=c instanceof Error?c.message:"Unknown error";void f({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(u)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:_e.items}});throw c;case 6:return[2]}}))}))}));var de=e("x",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r;return __generator(this,(function(t){switch(t.label){case 0:r=!!((n=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||n===void 0?void 0:n.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!r){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var ue=e("d",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,a,s,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=ae(v),r=n.isError,t=n.messages;return[2,{error:r,messages:t}]}o=c||B.clientSecret;if(!B.stripe||!o){h("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[i("Something went wrong.")]}]}return[4,B.stripe.retrievePaymentIntent(o)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;d=ae(s),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var le=e("w",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,a,s,u,l,c,v,f,p;return __generator(this,(function(h){switch(h.label){case 0:r=!!((e=B.stripePaymentEventData)===null||e===void 0?void 0:e.complete);o=B.stripeElements;a=B.stripe;s=B.clientSecret;B.customErrorMessage=null;if(!((n=_e.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,D()];case 1:u=h.sent();if(!u.valid){B.customErrorMessage=u.errorMessage;throw new Error(u.errorMessage)}l=t.checkoutSessionId;if(!(a&&o&&r&&s&&l))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",s);c.searchParams.set("zonosCheckoutSessionId",l);void T({checkoutSessionId:l,eventName:"checkout_paymentInfoCompleted"});return[4,a.confirmPayment({confirmParams:{return_url:c.toString()},elements:o,redirect:"if_required"})];case 2:v=h.sent(),f=v.error,p=v.paymentIntent;d("Payment intent confirmed","info",{error:f,paymentIntent:p});if((p===null||p===void 0?void 0:p.status)==="requires_action"){throw new Error(i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(f){if(f.type==="card_error"||f.type==="validation_error"){throw new Error(f.message)}if(f.type==="invalid_request_error"){if(f.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(p.status==="requires_payment_method"){throw new Error(i("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var ce=e("n",(function(){var e;var n=_e.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var r=t.enabledVariantTestKeys||[];var i={adjustmentsAmount:_e.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=_e.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:_e.customerAuthenticationToken||undefined,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:B.skipPaymentIntent,varianceTestInput:r};return i}));var ve=e("l",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:p,cartId:window.Zonos.cartId}});Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:n=s.sent(),r=n.errors,o=n.json;a=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(r.length||!a){h("Error occurs when getting payment intent",JSON.stringify(r,null,2));void f({endpoint:"Error creating payment intent",errors:r.map((function(e){return e.message})),metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2]}je(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var fe=e("k",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t,i,a,s,u;return __generator(this,(function(c){switch(c.label){case 0:if(!o.targetCurrency){h("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}B.isFetchingSession=true;r=ce();d("Checkout session body","info",r);return[4,l("/api/zonos-elements/create-checkout-session",{body:r,method:"POST"})];case 1:t=c.sent(),i=t.errors,a=t.json;B.isFetchingSession=false;if(i.length||!a){s=(e=i.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}h("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}u=a.checkoutSessionCreate;je(u);Te({method:((n=u.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",_e.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var pe=e("u",(function(){return __awaiter(y,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){h("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:B.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==B.checkoutSettlementCurrency){h("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var he=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,i,a;var s=e.adjustmentsAmount,d=e.cartId,u=e.currency,c=e.id,v=e.itemsAmount,f=e.landedCostId,p=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:n=t.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:B.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:_e.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:p,shipToPartyId:B.partyShippingId,skipPaymentIntent:B.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:r=e.sent(),i=r.errors,a=r.json;if(i.length||!a){h("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var me=function(e){var n,r,t,o,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var u={};if(!d){return u}var l=d.city,c=d.line1,v=d.line2,f=d.name,p=d.postal_code,h=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(r={},r[s.line1]=c,r)}if(s.line2&&v){u.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){u.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&h){u.state=(i={},i[s.state]=h,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var we=e("F",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,i,a,s,d,u,c,v;var f=e.addressInvalidCharactersList,p=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=j({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:p,stripeAddressEventData:B.stripeAddressEventData,stripeBillingAddressEventData:B.stripeBillingAddressEventData,stripeShippingSameAsBilling:B.stripeShippingSameAsBilling});if(!i){B.translatedAddress={address:{},billingAddress:{}};return[2]}a=H();if(!a){return[2]}return[4,l("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,u=s.json;if(d.length||!u){h("Error occurs when translating address to latin",JSON.stringify(d,null,2));B.translatedAddress={address:{},billingAddress:{}};return[2]}B.stripeAddressUsedWhenValidatingAddress=B.stripeAddressEventData;B.stripeBillingAddressUsedWhenValidatingAddress=B.stripeBillingAddressEventData;c=(n=B.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value.address;B.translatedAddress={address:c?me({currentAddress:Object.assign(Object.assign({},c),{name:(t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!B.stripeShippingSameAsBilling?me({currentAddress:Object.assign(Object.assign({},v),{name:(o=B.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));z("clientSecret",(function(e){if(e&&B.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:v(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),ye=ge.onChange,be=ge.reset,_e=ge.state;e({G:ye,e:_e});var Se=function(e){switch(e){case"DAYS":return i("days");case"WEEKS":return i("weeks");case"BUSINESS_DAYS":default:return i("business days")}};var Oe=e("J",(function(e){var n;var r=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(r===null||r===void 0?void 0:r.min)||!(r===null||r===void 0?void 0:r.max)||!(r===null||r===void 0?void 0:r.type)){return null}return{maxTransit:r.max,minTransit:r.min,unit:Se(r.type)}}));var ke=function(e){var n=e.item1,r=e.item2;if(!n||!r){return false}return r.sku&&n.sku&&n.sku===r.sku||r.description&&n.description&&n.description===r.description||n.name&&r.name&&n.name===r.name};var Ce=function(e){d("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var r=_e.items.find((function(n){return ke({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:r},e),{restriction:n})})).filter(Boolean);_e.restrictedItems=n;_e.items=_e.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return ke({item1:n,item2:e})}))})}));return{cartItems:_e.items,restrictedItems:n}};var Ae=e("g",(function(){t.checkoutSessionId=null;be()}));var Ie=e("o",(function(e){var n=e.messages,r=e.title;Ae();Y();_e.step="error";_e.error={messages:n,title:r}}));var Te=function(e){var n=e.dutiesTaxesFeesEstimate,r=e.method,t=e.subtotals;_e.exchangeRate=t.exchangeRate;_e.adjustmentTotal=t.adjustments;_e.dutiesTaxesFees=r==="DAP"?null:t.landedCostTotal;_e.subtotal=t.items;_e.total=t.total;_e.currency=t.presentmentCurrencyCode;_e.dutiesTaxesFeesEstimate=n||null};var Ee=e("A",(function(){var e=_e.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var je=e("p",(function(e){var n,r,o,i,u;B.clientSecret=e.clientSecret;B.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;B.customerProfile=e.customerProfile;_e.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:p,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var l=a(e.varianceTestResults||[]);s(l);var c=((o=(r=(n=_e.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||r===void 0?void 0:r.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((u=(i=window.Zonos.cartData)===null||i===void 0?void 0:i.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||u===void 0?void 0:u.value)||null;if(c){d("Found externalConfirmationPageURL: ".concat(c));_e.externalConfirmationPageURL=c}}));var Ne=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,a,s,u,l;var c=e.adjustmentsAmount,v=e.cartId,f=e.currency,p=e.dutiesTaxesFeesEstimate,m=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&_e.selectedLandedCost){r=_e.selectedLandedCost.subtotals;Te({dutiesTaxesFeesEstimate:p,method:_e.landedCostMethod,subtotals:r});d("Exchange rate updated for cart items (landed cost subtotal)","info",_e.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,he({adjustmentsAmount:c,billToPartyId:B.partyBillingId,cartId:v,currency:f,id:t.checkoutSessionId,itemsAmount:m,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:B.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];h("Error occurs when updating checkout session.");if(!g)return[3,3];d("Initiating checkout session on failure","info");return[4,fe()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Te({method:((n=u.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",_e.exchangeRate)}je(u.checkoutSessionUpdate);return[2,true]}}))}))};var Pe=e("L",(function(e){if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var De=e("I",(function(e,r){return __awaiter(y,void 0,void 0,(function(){var o,i,a,s,u,l,c,v,f,p,h,m,w,g,y,b,_,S,O,k,C,A,I,T;return __generator(this,(function(E){switch(E.label){case 0:_e.selectedShippingOption=e;m=Oe(_e.selectedShippingOption);if(m){w=m.maxTransit,g=m.minTransit,y=m.unit;_e.selectedShippingOptionTransitTime="".concat(g,"-").concat(w," ").concat(y)}else{_e.selectedShippingOptionTransitTime=""}b=(o=_e.landedCostData)===null||o===void 0?void 0:o.find((function(e){return e.landedCostId===r}));_e.selectedLandedCost=b||null;if(!b){return[2,false]}_=((i=b.landedCost.amountSubtotals)===null||i===void 0?void 0:i.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;O=_*S;if(O){d("DAP quote, using estimate: ".concat(O),"info")}_e.landedCostMethod=Pe(b.landedCost);_e.shipping=b.subtotals.shipping;k=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));_e.isSelectedShippingAboveDeminimis=C;_e.isSelectedShippingGuarantee=k;return[4,Ne({adjustmentsAmount:_e.adjustmentTotal,billToPartyId:B.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:O,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:B.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:A=E.sent();I=(c=_e.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;T=((v=B.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";B.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=_e.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((h=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||h===void 0?void 0:h.includes(T));return[2,A]}}))}))}));var Le=e("m",(function(e){var n=e.isPreview,r=e.sessionTimeout;if(n){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):r;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));_e.checkoutTimeoutInterval=setTimeout((function(){_e.checkoutSessionTimeoutShow=true}),o)}));var xe=e("j",(function(){if(_e.checkoutTimeoutInterval){clearTimeout(_e.checkoutTimeoutInterval);_e.checkoutTimeoutInterval=null}}));var Re=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var ze=function(){_e.items=_e.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));_e.restrictedItems=[]};var Ue=e("f",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,o,i;var a=e.adjustments,s=e.cartItems;return __generator(this,(function(e){switch(e.label){case 0:_e.adjustments=a;_e.items=Re(s);r=(n=s.find(Boolean))===null||n===void 0?void 0:n.currencyCode;o=s.reduce((function(e,n){return e+n.amount*n.quantity}),0);i=a.reduce((function(e,n){return e+n.amount}),0);if(!r||!o){return[2]}_e.currency=r;B.isFetchingSession=true;return[4,Ne({adjustmentsAmount:i,billToPartyId:B.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:o,shipToPartyId:B.partyShippingId,shouldInitSessionOnFailure:true,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();B.isFetchingSession=false;return[2]}}))}))}));var Be=function(){_e.selectedShippingOption=null;_e.isSelectedShippingAboveDeminimis=false;_e.isSelectedShippingGuarantee=false;_e.selectedShippingOptionTransitTime="";_e.dutiesTaxesFees=0;_e.dutiesTaxesFeesEstimate=0;_e.shipping=0;_e.total=_e.subtotal};var Fe=function(){if(_e.step==="shipping"){_e.step="customer-info";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})})}else if(_e.step==="payment"){_e.step="shipping";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})})}else if(_e.step==="finish"){_e.step="payment";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{payment:Object.assign(Object.assign({},_e.tabItems.payment),{isDone:false})})}};var Je=e("r",(function(){if(_e.step==="customer-info"){_e.step="shipping";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems["customer-info"]),{isDone:true})})}else if(_e.step==="shipping"){_e.step="payment";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:true})})}else if(_e.step==="payment"){_e.step="finish"}}));var Me=e("h",(function(){_e.step="customer-info";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},_e.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})});Be()}))}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function u(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?t(e.value):o(e.value).then(u,a)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(n){return s([e,n])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=n.call(e,t)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var r=0,o=n.length,i;r<o;r++){if(i||!(r in n)){if(!i)i=Array.prototype.slice.call(n,0,r);i[r]=n[r]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-a411ce2a.system.js","./p-40a4c8a2.system.js","./p-5a2dd041.system.js","./p-2b8345d8.system.js"],(function(e){"use strict";var n,t,r,o,i,u,a,s,c,d,l,f;return{setters:[function(e){n=e.c},function(e){t=e.g;r=e.I},function(e){o=e.g;i=e.a;u=e.l;a=e.h;s=e.b},function(n){c=n.g;d=n._;l=n.c;f=n.a;var t={};t.checkoutHiddenBtnSelector=n.c;t.checkoutHiddenInternationalBtnSelector=n.a;t.domesticRedirectedBtnSelector=n.d;e(t)},function(n){e("availableTestKeys",n.a)},function(n){var t={};t.countryRequireTaxId=n.c;t.euCountryCodes=n.e;t.shipToTaxIdLabels=n.s;e(t)}],execute:function(){var v=this;var m=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(n).origin;var i=t.some((function(e){return o.includes(e)}));var u=r.some((function(e){return o.includes(e)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var w=["jsdelivr","cdnjs","unpkg","vercel"];var p="jsdelivr";var h=function(e){var n=w.indexOf(e);var t=w[n+1];return t||null};var y=function(){return __awaiter(v,void 0,void 0,(function(){var e,n,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:e=o();n=i();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var O=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=O(window.location.href);var t="https://v1.3.209.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(n,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var S="https://js.stripe.com/v3";var _=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var b="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var z=function(){var e=document.querySelectorAll('script[src^="'.concat(S,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!_.test(t.src)){continue}return t}return null};var j=null;var k=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(S).concat(n);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var N=function(e){if(j!==null){return j}j=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(b)}if(window.Stripe){n(window.Stripe);return}try{var r=z();if(r&&e){console.warn(b)}else if(!r){r=k(e)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return j};var A=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var I=function(e,n,t){if(e===null){return null}var r=e.apply(undefined,n);A(r,t);return r};var Z=Promise.resolve().then((function(){return N(null)}));var T=false;Z.catch((function(e){if(!T){console.warn(e)}}));var R=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(v,void 0,void 0,(function(){var n;return __generator(this,(function(t){T=true;n=Date.now();return[2,Z.then((function(t){return I(t,e,n)}))]}))}))};var E="tempCartUUID";var U=function(){var e=new URLSearchParams(window.location.search);var n=e.get(E);return n};var L=function(e){return __awaiter(v,[e],void 0,(function(e){var n,r,i,s,d,l,f,v,m;var w=e.cartId,p=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=o();r=t();i=c()||undefined;s=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){s.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(s.toString()),{body:{isTestMode:n,renewCartExpirationToken:i,tempCartUUID:w},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:d=e.sent(),l=d.errors,f=d.json,v=d.zonosMode;m=!f||l.length;if(!(m&&p))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:p});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,L({cartId:w,retries:p-1})];case 3:if(m){return[2,null]}return[2,Object.assign(Object.assign({},f),{zonosMode:v})]}}))}))};var P=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:n=d(e),t=n.isDgsCartId,r=n.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,L({cartId:e,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var C;var F=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=m({loadScriptSrc:e===null||e===void 0?void 0:e.src}),t=n.currentLoadScriptUrl,r=n.isWhiteListed;if(r){return t}return null}();var D="https://v1.3.209.js.zonos.com";var M=F||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.209";var x="https://unpkg.com/@zonos/elements@1.3.209";var G="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.209";var K="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function e(){}return e}();e("Zonos",V);C=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1749049121169";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.209");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,o,i,a,c,d,f,v,m,w,p,h,O;return __generator(this,(function(S){switch(S.label){case 0:n=e.appearance,t=e.checkoutSettings,r=e.currencyConverter,o=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,c=e.storeId,d=e.zonosApiKey;C.cartId=U();if(C.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(C.version,") ======"));C.zonosApiKey=d;C.storeId=c;if(!C.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=C.isNpm;window.Zonos.isBigCommerce=C.isBigCommerce;window.Zonos.isLegacyCheckout=C.isLegacyCheckout;void window.Zonos.init(e)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!d&&!C.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!C.cartData&&C.cartId))return[3,2];u("Initialize cart data");return[4,P(C.cartId)];case 1:m=S.sent();if(!m){s("Failed to get cart data");return[2]}C.cartData=m.cartData;C.zonosApiKey=m.zonosApiKey;C.cartSettings=m.settings;S.label=2;case 2:return[4,y()];case 3:w=S.sent();if(w){C.zonosApiKey=w}S.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");h=C.cartId&&C.cartData||!!p;if(h){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");O=document.createElement("button");O.style.display="none";O.id="".concat(l);document.body.appendChild(O)}u("init zonos");C.restoreNativeBrowserFunctions();C.injectCustomScriptForHostedCheckout();C.injectZonosCdn();C.injectZonosCss();C.injectFonts();C.injectCheckoutInternationalButton();C.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});C.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(f))){var e=document.createElement("button");e.id=f;e.style.display="none";document.body.appendChild(e)}};V.injectCustomScriptForHostedCheckout=function(){var e=C.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var r=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(v,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.querySelector("#".concat(f));setTimeout((function(){if(e){e.dispatchEvent(n("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};V.showNotification=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.showNotification(e))};V.updateOrganizationName=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};V.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,r=e.config,o=e.disable,i=e.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};a.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(o){e.setAttribute("disabled","true");e.addEventListener("click",s)}else{e.removeAttribute("disabled");e.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((e=r.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(e){var n=e.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=n.checkoutSettings.placeOrderButtonSelector;C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=n.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=n;c.zonosApiKey=C.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(e){return __awaiter(v,void 0,void 0,(function(){var n,t;return __generator(this,(function(r){switch(r.label){case 0:n=e.detail;u("loading Stripe");return[4,R(n.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);C.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(e){var n=e.cdnType,t=e.isModule,r=e.theRestUrl;var o=C.getZonosUrl(n);var i="".concat(o,"/").concat(r);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var e=h(n);if(!e){return}C.injectScript({cdnType:e,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return M;case"unpkg":return x;case"cdnjs":return G;case"vercel":return D}};if(C.isNpm){var t=g();return t||n()}return n()};V.injectZonosCdn=function(){C.injectScript({cdnType:p,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});C.injectScript({cdnType:p,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var r=C.getZonosUrl(n);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(D,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var e=h(n);if(!e){return}C.injectStylesheet({cdnType:e,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){u("Zonos style links already injected","warn");return}C.injectStylesheet({cdnType:p,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){u("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(K,'"]'));for(var t=0;t<n.length;t++){var r=n[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(e()){u("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=K;n.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(K,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};V.injectSupportGoogleFont=function(e){var n;u("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(K,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=K;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))};var W=e("checkoutSessionMutableAttributeKeys",["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"]);var q=e("checkoutSessionImmutableAttributeKeys",["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"]);var H=e("checkoutSessionAttributeKeys",__spreadArray(__spreadArray([],W,true),q,true))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function u(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?t(e.value):o(e.value).then(u,a)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(n){return s([e,n])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=n.call(e,t)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var r=0,o=n.length,i;r<o;r++){if(i||!(r in n)){if(!i)i=Array.prototype.slice.call(n,0,r);i[r]=n[r]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-a411ce2a.system.js","./p-40a4c8a2.system.js","./p-5a2dd041.system.js","./p-2b8345d8.system.js"],(function(e){"use strict";var n,t,r,o,i,u,a,s,c,d,l,f;return{setters:[function(e){n=e.c},function(e){t=e.g;r=e.I},function(e){o=e.g;i=e.a;u=e.l;a=e.h;s=e.b},function(n){c=n.g;d=n._;l=n.c;f=n.a;var t={};t.checkoutHiddenBtnSelector=n.c;t.checkoutHiddenInternationalBtnSelector=n.a;t.domesticRedirectedBtnSelector=n.d;e(t)},function(n){e("availableTestKeys",n.a)},function(n){var t={};t.countryRequireTaxId=n.c;t.euCountryCodes=n.e;t.shipToTaxIdLabels=n.s;e(t)}],execute:function(){var v=this;var m=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(n).origin;var i=t.some((function(e){return o.includes(e)}));var u=r.some((function(e){return o.includes(e)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var w=["jsdelivr","cdnjs","unpkg","vercel"];var p="jsdelivr";var h=function(e){var n=w.indexOf(e);var t=w[n+1];return t||null};var y=function(){return __awaiter(v,void 0,void 0,(function(){var e,n,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:e=o();n=i();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var O=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=O(window.location.href);var t="https://v1.3.210.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(n,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var S="https://js.stripe.com/v3";var _=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var b="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var z=function(){var e=document.querySelectorAll('script[src^="'.concat(S,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!_.test(t.src)){continue}return t}return null};var j=null;var k=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(S).concat(n);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var N=function(e){if(j!==null){return j}j=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(b)}if(window.Stripe){n(window.Stripe);return}try{var r=z();if(r&&e){console.warn(b)}else if(!r){r=k(e)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return j};var A=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var I=function(e,n,t){if(e===null){return null}var r=e.apply(undefined,n);A(r,t);return r};var Z=Promise.resolve().then((function(){return N(null)}));var T=false;Z.catch((function(e){if(!T){console.warn(e)}}));var R=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(v,void 0,void 0,(function(){var n;return __generator(this,(function(t){T=true;n=Date.now();return[2,Z.then((function(t){return I(t,e,n)}))]}))}))};var E="tempCartUUID";var U=function(){var e=new URLSearchParams(window.location.search);var n=e.get(E);return n};var L=function(e){return __awaiter(v,[e],void 0,(function(e){var n,r,i,s,d,l,f,v,m;var w=e.cartId,p=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=o();r=t();i=c()||undefined;s=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){s.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(s.toString()),{body:{isTestMode:n,renewCartExpirationToken:i,tempCartUUID:w},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:d=e.sent(),l=d.errors,f=d.json,v=d.zonosMode;m=!f||l.length;if(!(m&&p))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:p});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,L({cartId:w,retries:p-1})];case 3:if(m){return[2,null]}return[2,Object.assign(Object.assign({},f),{zonosMode:v})]}}))}))};var P=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:n=d(e),t=n.isDgsCartId,r=n.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,L({cartId:e,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var C;var F=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=m({loadScriptSrc:e===null||e===void 0?void 0:e.src}),t=n.currentLoadScriptUrl,r=n.isWhiteListed;if(r){return t}return null}();var D="https://v1.3.210.js.zonos.com";var M=F||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.210";var x="https://unpkg.com/@zonos/elements@1.3.210";var G="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.210";var K="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function e(){}return e}();e("Zonos",V);C=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1749136579531";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.210");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,o,i,a,c,d,f,v,m,w,p,h,O;return __generator(this,(function(S){switch(S.label){case 0:n=e.appearance,t=e.checkoutSettings,r=e.currencyConverter,o=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,c=e.storeId,d=e.zonosApiKey;C.cartId=U();if(C.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(C.version,") ======"));C.zonosApiKey=d;C.storeId=c;if(!C.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=C.isNpm;window.Zonos.isBigCommerce=C.isBigCommerce;window.Zonos.isLegacyCheckout=C.isLegacyCheckout;void window.Zonos.init(e)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!d&&!C.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!C.cartData&&C.cartId))return[3,2];u("Initialize cart data");return[4,P(C.cartId)];case 1:m=S.sent();if(!m){s("Failed to get cart data");return[2]}C.cartData=m.cartData;C.zonosApiKey=m.zonosApiKey;C.cartSettings=m.settings;S.label=2;case 2:return[4,y()];case 3:w=S.sent();if(w){C.zonosApiKey=w}S.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");h=C.cartId&&C.cartData||!!p;if(h){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");O=document.createElement("button");O.style.display="none";O.id="".concat(l);document.body.appendChild(O)}u("init zonos");C.restoreNativeBrowserFunctions();C.injectCustomScriptForHostedCheckout();C.injectZonosCdn();C.injectZonosCss();C.injectFonts();C.injectCheckoutInternationalButton();C.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});C.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(f))){var e=document.createElement("button");e.id=f;e.style.display="none";document.body.appendChild(e)}};V.injectCustomScriptForHostedCheckout=function(){var e=C.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var r=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(v,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.querySelector("#".concat(f));setTimeout((function(){if(e){e.dispatchEvent(n("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};V.showNotification=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.showNotification(e))};V.updateOrganizationName=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};V.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,r=e.config,o=e.disable,i=e.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};a.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(o){e.setAttribute("disabled","true");e.addEventListener("click",s)}else{e.removeAttribute("disabled");e.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((e=r.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(e){var n=e.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=n.checkoutSettings.placeOrderButtonSelector;C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=n.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){C.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=n;c.zonosApiKey=C.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(e){return __awaiter(v,void 0,void 0,(function(){var n,t;return __generator(this,(function(r){switch(r.label){case 0:n=e.detail;u("loading Stripe");return[4,R(n.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);C.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(e){var n=e.cdnType,t=e.isModule,r=e.theRestUrl;var o=C.getZonosUrl(n);var i="".concat(o,"/").concat(r);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var e=h(n);if(!e){return}C.injectScript({cdnType:e,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return M;case"unpkg":return x;case"cdnjs":return G;case"vercel":return D}};if(C.isNpm){var t=g();return t||n()}return n()};V.injectZonosCdn=function(){C.injectScript({cdnType:p,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});C.injectScript({cdnType:p,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var r=C.getZonosUrl(n);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(D,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var e=h(n);if(!e){return}C.injectStylesheet({cdnType:e,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){u("Zonos style links already injected","warn");return}C.injectStylesheet({cdnType:p,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){u("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(K,'"]'));for(var t=0;t<n.length;t++){var r=n[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(e()){u("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=K;n.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(K,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(e){var n;void((n=C.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};V.injectSupportGoogleFont=function(e){var n;u("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(K,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=K;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))};var W=e("checkoutSessionMutableAttributeKeys",["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"]);var q=e("checkoutSessionImmutableAttributeKeys",["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"]);var H=e("checkoutSessionAttributeKeys",__spreadArray(__spreadArray([],W,true),q,true))}}}));
@@ -0,0 +1 @@
1
+ import{z as e,c as t}from"./p-6aa728f2.js";import{s as o,l as n,t as r,f as s,b as i}from"./p-a6f77d44.js";import{l as a,f as d,h as l,g as c,a as u,s as m,d as v,b as p,j as h}from"./p-20839c46.js";import{i as y}from"./p-71c6bdc3.js";import{g as w}from"./p-207bd04a.js";const g=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:v}=e.value.address,p=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[p])||p,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[v])||v}},f=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),r=N.stripeLinkEventData,s=N.stripeAddressEventData,i=N.stripeShippingSameAsBilling?N.stripeAddressEventData:N.stripeBillingAddressEventData;if(!s||!i)throw new Error("Missing stripe address data");const a=g({currentAddress:s,translatedAddress:N.translatedAddress.address}),d=a.name.split(" ")[0]||"",l=a.name.split(" ").splice(1).join(" ")||"",c=g({currentAddress:i,translatedAddress:N.translatedAddress.address}),u=c.name.split(" ")[0]||"",m=c.name.split(" ").splice(1).join(" ")||"";return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:u,lastName:m,phone:c.phone},cartCurrencyCode:null===(t=oe.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:N.companyName,email:null==r?void 0:r.value.email,firstName:d,lastName:l,phone:a.phone},isTest:!!n,landedCostAdjustments:oe.promoCode?[{amount:0,productId:null,promoCode:oe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:N.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}},b=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=N.stripeLinkEventData,n=N.stripeAddressEventData,r=N.stripeShippingSameAsBilling?N.stripeAddressEventData:N.stripeBillingAddressEventData;if(a({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=g({currentAddress:n,translatedAddress:N.translatedAddress.address}),i=s.name.split(" ")[0]||"",d=s.name.split(" ").splice(1).join(" ")||"",l=g({currentAddress:r,translatedAddress:N.translatedAddress.address}),c=l.name.split(" ")[0]||"",u=l.name.split(" ").splice(1).join(" ")||"",m=oe.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),v=oe.promoCode?[{amount:0,productId:null,promoCode:oe.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:N.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:d,phone:s.phone},isTest:e,items:oe.items,landedCostAdjustments:v,shipToTaxId:N.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const S=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=b(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:d.vercel});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:c,json:u}=await l("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(s=c.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await l("/api/zonos-elements/calculate-landed-cost",{body:b(),method:"POST",signal:null==t?void 0:t.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n;const{errors:r,json:s}=await l("/api/zonos-elements/cart-calculate-landed-cost",{body:f(t),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){const e="The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message)||(null===(n=r[0])||void 0===n?void 0:n.message.includes("signal is aborted"));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return s})({abortController:t,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},C=async({checkoutSessionId:t,eventName:o,metadata:r})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((c()||u()||p)&&!window.Zonos.zonosConversionTest)return;const h=n.selectedCountryCode,y=e.organizationId;if(!t)return void m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:v,checkoutSessionId:t,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});y||m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:v,checkoutSessionId:t,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});const w={checkoutSessionId:t,countryCode:h,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},r),{trackEventLogs:d}),organizationId:y};await l("/api/zonos-elements/track-conversion-event",{body:w,method:"POST"})},O=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},A=e=>e.sort(((e,t)=>e.amount-t.amount)),k=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await l(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(p("Failed to retrieve checkout session info before confirming payment ",t),m({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:v}}),{errorMessage:r("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(p("Landed cost is not found in the checkout session before confirming payment."),m({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:v}}),{errorMessage:r('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},I=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},j=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:T,reset:E,state:N}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),P=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},L=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},D=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return h(e)},x=async t=>{var o,r;const s=N.clientSecret;if(!N.stripe)return void a("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:r,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=r||e.appearance.colorPrimary,l=s||e.appearance.colorSecondary,c=d&&y(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},I({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},j({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:N.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),d=JSON.stringify(i)===JSON.stringify(N.stripeElementsOptions);if(!N.stripeElements||!N.stripeElementsForBillingAddress)return N.stripeElements=null===(o=N.stripe)||void 0===o?void 0:o.elements(i),N.stripeElementsOptions=i,a("Stripe elements initialized"),N.stripeElementsForBillingAddress=null===(r=N.stripe)||void 0===r?void 0:r.elements(i),void a("Stripe elements for billing address initialized");d||(N.stripeElements.update(i),N.stripeElementsForBillingAddress.update(i),N.stripeElementsOptions=i,N.stripeElements.fetchUpdates()),a("Stripe elements updated")},R=()=>{sessionStorage.removeItem("zonos--client-secret"),E(),N.stripe=window.Zonos.stripe},_=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const i=(null==r?void 0:r.split(" ")[0])||t||"",a=(null==r?void 0:r.split(" ")[1])||n||"";return i&&a||m({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||m({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},z=async()=>{var e,t,n,r;if(!(null===(e=N.stripeAddressEventData)||void 0===e?void 0:e.complete)||!N.stripeShippingSameAsBilling&&!(null===(t=N.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!N.stripeBillingAddressEventData)return{partiesCreated:!1};if(!oe.landedCostData)return{partiesCreated:!1};const s=null===(n=oe.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return m({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s;const i=JSON.stringify(null===(e=N.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=N.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=N.stripeAddressEventData)||void 0===n?void 0:n.value),d=!N.stripeShippingSameAsBilling&&JSON.stringify(null===(r=N.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=N.stripeBillingAddressEventData)||void 0===s?void 0:s.value);return i||a||d||N.taxIdUsedWhenAsyncAddressUpdate!==N.taxId||N.companyNameUsedWhenAsyncAddressUpdate!==N.companyName})();if(!i)return{partiesCreated:!1};const a=_({address:N.stripeAddressEventData.value.address,firstName:N.stripeAddressEventData.value.firstName,lastName:N.stripeAddressEventData.value.lastName,name:N.stripeAddressEventData.value.name,phone:N.stripeAddressEventData.value.phone}),d=N.stripeShippingSameAsBilling?a:_({address:N.stripeBillingAddressEventData.value.address,firstName:N.stripeBillingAddressEventData.value.firstName,lastName:N.stripeBillingAddressEventData.value.lastName,name:N.stripeBillingAddressEventData.value.name,phone:N.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:u,json:h}=await l("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:N.companyName,email:(null===(r=N.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:c,rootId:s,taxId:N.taxId},method:"POST"});return u.length||!h?(p("Error occurs when creating parties",JSON.stringify(u,null,2)),m({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:u,json:h}}),{partiesCreated:!1}):(N.companyNameUsedWhenAsyncAddressUpdate=N.companyName,N.stripeAddressUsedWhenAsyncAddressUpdate=N.stripeAddressEventData,N.stripeBillingAddressUsedWhenAsyncAddressUpdate=N.stripeBillingAddressEventData,N.taxIdUsedWhenAsyncAddressUpdate=N.taxId,N.partyBillingId=h.billToPartyId,N.partyShippingId=h.shipToPartyId,{partiesCreated:!0})},U=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),B=async t=>{var n,r,s,i;const d=(null==t?void 0:t.retries)||0,l=!!(null==t?void 0:t.applyingPromocode),c=(()=>{var e;const t=oe.landedCostData&&(null===(e=oe.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==oe.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=N.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.value),n=N.stripeAddressEventData&&JSON.stringify(U(N.stripeAddressEventData.value))!==JSON.stringify(N.stripeAddressUsedWhenFetchingLC),r=!N.stripeShippingSameAsBilling&&N.stripeBillingAddressEventData&&JSON.stringify(U(N.stripeBillingAddressEventData.value))!==JSON.stringify(N.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return a("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!oe.landedCostData&&!N.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,r;const s=!!(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=N.stripeAddressEventData)||void 0===o?void 0:o.complete),a=N.stripeShippingSameAsBilling?i:!!(null===(n=N.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const r=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===oe.addressFormRenderType&&(s&&t in s?s[t]:null)||(r&&t in r?r[t]:null)})((null===(r=N.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&N.stripeAddressEventData?s&&N.stripeAddressEventData.value.firstName&&N.stripeAddressEventData.value.lastName&&N.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&N.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&N.stripeAddressEventData.value.address.postal_code.length>=3)&&N.stripeAddressEventData.value.phone&&N.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=N.fetchingLandedCostAbortController)||void 0===n||n.abort(),N.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};d?(N.isFetchingLandedCost=!1,setTimeout((()=>{N.isFetchingLandedCost=!0}),300)):N.isFetchingLandedCost=!0,N.stripeAddressEventData&&(N.stripeAddressUsedWhenFetchingLC={countryCode:N.stripeAddressEventData.value.address.country,postalCode:N.stripeAddressEventData.value.address.postal_code,state:N.stripeAddressEventData.value.address.state}),N.stripeBillingAddressEventData&&(N.stripeBillingAddressUsedWhenFetchingLC={countryCode:N.stripeBillingAddressEventData.value.address.country,postalCode:N.stripeBillingAddressEventData.value.address.postal_code,state:N.stripeBillingAddressEventData.value.address.state}),N.stripeLinkEventData&&(N.stripeLinkUsedWhenFetchingLC=Object.assign({},N.stripeLinkEventData));try{we(),await(async()=>{var e;const t=new AbortController;N.fetchingLandedCostAbortController=t,we();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await S(t);oe.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,oe.shippingData=A((null==d?void 0:d.filter(Boolean))||[]),ie(s),N.fetchingLandedCostAbortController=null,oe.partiesData=(null==a?void 0:a.filter(Boolean))||[],oe.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&C({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=oe.promoCodeApplied&&!oe.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));oe.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",oe.promoCode)})();const e=null===(r=oe.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=oe.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&le({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(oe.landedCostData=[],oe.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(d<1)return await B(Object.assign(Object.assign({},t),{retries:(d||0)+1})),{isRequestNotReady:!1};const o=null===(i=N.stripeAddressEventData)||void 0===i?void 0:i.value;m({endpoint:`Failed to fetch landed cost (${d} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}p(e)}return N.isFetchingLandedCost=!1,{isRequestNotReady:!1}},F=async()=>{var e,t;await B({applyingPromocode:!0}),"payment"===oe.step&&fe(),await z();const o=null===(e=oe.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=oe.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await pe(o,n.landedCostId)},J=()=>{oe.promoCode="",sessionStorage.removeItem("zonos--promo-code"),oe.promoCodeError=!1,oe.promoCodeApplied=!1},$=async()=>{"payment"===oe.step&&fe(),J(),await F()},M=e=>{let t=[],o=!0;switch(e){case"succeeded":t=[r("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",r("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],o=!1;break;case"requires_capture":case"processing":t=[r("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[r("Payment failed. Please try another payment method.")];break;case"requires_action":o=!1,t=[r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[r("Something went wrong.")]}return{isError:o,messages:t}},W=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(p("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(N.shouldInventoryRefund=!0,null):null:r("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:oe.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw m({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:oe.items}}),e}},q=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},Y=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=M(t);return{error:e,messages:o}}const o=e||N.clientSecret;if(!N.stripe||!o)return p("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[r("Something went wrong.")]};const{paymentIntent:n}=await N.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:i,messages:a}=M(s);return{error:i,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},H=async()=>{var e,t;const n=!!(null===(e=N.stripePaymentEventData)||void 0===e?void 0:e.complete),s=N.stripeElements,i=N.stripe,d=N.clientSecret;if(N.customErrorMessage=null,!(null===(t=oe.selectedLandedCost)||void 0===t?void 0:t.landedCost.id))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await k();if(!l.valid)throw N.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(i&&s&&n&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),C({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await i.confirmPayment({confirmParams:{return_url:e.toString()},elements:s,redirect:"if_required"});if(a("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(r("Payment failed. Please try another payment method."))}},K=()=>{var e;const t=oe.items.reduce(((e,t)=>e+t.amount*t.quantity),0),r=o.enabledVariantTestKeys||[];return{adjustmentsAmount:oe.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=oe.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:oe.customerAuthenticationToken||void 0,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:N.skipPaymentIntent,varianceTestInput:r}},G=async()=>{var e;if(!o.checkoutSessionId)return m({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:v,cartId:window.Zonos.cartId}}),void de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")});const{errors:t,json:n}=await l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return p("Error occurs when getting payment intent",JSON.stringify(t,null,2)),m({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")});ue(n.checkoutSessionPaymentIntentCreate)},V=async()=>{var e,t;if(!n.targetCurrency)return p("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;N.isFetchingSession=!0;const o=K();a("Checkout session body","info",o);const{errors:r,json:s}=await l("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(N.isFetchingSession=!1,r.length||!s){const t=null===(e=r.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return p("Error occurred when creating checkout session",JSON.stringify(r,null,2)),!1}const i=s.checkoutSessionCreate;return ue(i),le({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),a("Exchange rate updated for cart items (checkout session create)","info",oe.exchangeRate),a("done-init-checkout-session"),!0},Z=async()=>{const t=o.checkoutSessionId;if(!t)return p("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return a('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:N.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===N.checkoutSettlementCurrency?(a(`Updated checkout session to settlement currency "${r}".`),!0):(p("Failed to update checkout session base currency"),!1)},Q=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},X=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{var s,i,a,d;const l=!!(null==o?void 0:o.complete);if(!l||!(r?l:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const c=o.value,u=(null==n?void 0:n.value)||null,m=`${c.firstName||(null===(s=c.name)||void 0===s?void 0:s.split(" ")[0])} ${c.lastName||(null===(i=c.name)||void 0===i?void 0:i.split(" ")[1])}`,v=c.firstName||(null===(a=null==u?void 0:u.name)||void 0===a?void 0:a.split(" ")[0]),p=c.lastName||(null===(d=null==u?void 0:u.name)||void 0===d?void 0:d.split(" ")[1]),h=v&&p?`${v} ${p}`:"",y=c.address,w=null==u?void 0:u.address;return{address:O({address:Object.assign(Object.assign({},y),{name:m}),invalidAdddressList:e}),billingAddress:r?void 0:O({address:w?Object.assign(Object.assign({},w),{name:h}):null,invalidAdddressList:t}),destinationCountry:y.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:N.stripeAddressEventData,stripeBillingAddressEventData:N.stripeBillingAddressEventData,stripeShippingSameAsBilling:N.stripeShippingSameAsBilling});if(!i)return void(N.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=N.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeAddressEventData)||void 0===t?void 0:t.value),s=!N.stripeShippingSameAsBilling&&JSON.stringify(null===(o=N.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=N.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:c}=await l("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!c)return p("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(N.translatedAddress={address:{},billingAddress:{}});N.stripeAddressUsedWhenValidatingAddress=N.stripeAddressEventData,N.stripeBillingAddressUsedWhenValidatingAddress=N.stripeBillingAddressEventData;const u=null===(o=N.stripeAddressEventData)||void 0===o?void 0:o.value.address,m=null===(n=N.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;N.translatedAddress={address:u?Q({currentAddress:Object.assign(Object.assign({},u),{name:null===(r=N.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:N.stripeShippingSameAsBilling?{}:Q({currentAddress:Object.assign(Object.assign({},m),{name:null===(s=N.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.billingAddress||null})}};T("clientSecret",(e=>{e&&N.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:ee,reset:te,state:oe}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:u(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ne=e=>{switch(e){case"DAYS":return r("days");case"WEEKS":return r("weeks");default:return r("business days")}},re=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ne(o.type)}:null},se=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),ie=e=>{a("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=oe.items.find((t=>se({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return oe.restrictedItems=t,oe.items=oe.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>se({item1:t,item2:e})))}))),{cartItems:oe.items,restrictedItems:t}},ae=()=>{o.checkoutSessionId=null,te()},de=({messages:e,title:t})=>{ae(),R(),oe.step="error",oe.error={messages:e,title:t}},le=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{oe.exchangeRate=o.exchangeRate,oe.adjustmentTotal=o.adjustments,oe.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,oe.subtotal=o.items,oe.total=o.total,oe.currency=o.presentmentCurrencyCode,oe.dutiesTaxesFeesEstimate=e||null},ce=()=>!!oe.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),ue=e=>{var t,n,r,d,l;N.clientSecret=e.clientSecret,N.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,N.customerProfile=e.customerProfile,oe.checkoutSession=e,e.id||m({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:v,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const c=s(e.varianceTestResults||[]);i(c);const u=(null===(r=null===(n=null===(t=oe.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===r?void 0:r.value)||(null===(l=null===(d=window.Zonos.cartData)||void 0===d?void 0:d.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===l?void 0:l.value)||null;u&&(a(`Found externalConfirmationPageURL: ${u}`),oe.externalConfirmationPageURL=u)},me=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:i,itemsAmount:d,landedCostId:c,shouldInitSessionOnFailure:u})=>{var m;if(c&&oe.selectedLandedCost&&(le({dutiesTaxesFeesEstimate:i,method:oe.landedCostMethod,subtotals:oe.selectedLandedCost.subtotals}),a("Exchange rate updated for cart items (landed cost subtotal)","info",oe.exchangeRate)),!o.checkoutSessionId)return a("Could not update cart total without checkout session id","info"),!1;const{errors:v,json:h}=await(async({adjustmentsAmount:e,cartId:t,currency:r,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:m}=await l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:N.partyBillingId,cartId:t,currency:r,customerAuthenticationToken:oe.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:N.partyShippingId,skipPaymentIntent:N.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!m?(p("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:m}):{errors:[],json:m}})({adjustmentsAmount:e,billToPartyId:N.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:d,landedCostId:c,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:N.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(v.length>0||!h){if(p("Error occurs when updating checkout session."),u){a("Initiating checkout session on failure","info");const e=await V();return a(`stripeStoreInitCheckoutSession: ${e}`),!!e||(de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")}),!1)}return!1}return c||(le({method:(null===(m=h.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:h.checkoutSessionUpdate.subtotals}),a("Exchange rate updated for cart items (checkout session update)","info",oe.exchangeRate)),ue(h.checkoutSessionUpdate),!0},ve=e=>"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method,pe=async(t,n)=>{var r,s,i,d,l,c,u,m,v,p,h;oe.selectedShippingOption=t;const y=re(oe.selectedShippingOption);if(y){const{maxTransit:e,minTransit:t,unit:o}=y;oe.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else oe.selectedShippingOptionTransitTime="";const w=null===(r=oe.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(oe.selectedLandedCost=w||null,!w)return!1;const g=((null===(s=w.landedCost.amountSubtotals)||void 0===s?void 0:s.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;g&&a(`DAP quote, using estimate: ${g}`,"info"),oe.landedCostMethod=ve(w.landedCost),oe.shipping=w.subtotals.shipping;const f="ZONOS"===(null===(i=null==w?void 0:w.landedCost)||void 0===i?void 0:i.landedCostGuaranteeCode),b=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));oe.isSelectedShippingAboveDeminimis=b,oe.isSelectedShippingGuarantee=f;const S=await me({adjustmentsAmount:oe.adjustmentTotal,billToPartyId:N.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:N.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]}),C=null===(u=oe.items.find(Boolean))||void 0===u?void 0:u.currencyCode,O=(null===(m=N.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return N.shouldRenderPayInUsdButton="USD"===C&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=oe.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(h=null===(p=e.genericSettings)||void 0===p?void 0:p.usdSettlementCountryEnabled)||void 0===h?void 0:h.includes(O)),S},he=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;a(`==START CHECKOUT TIMEOUT - ${n}==`),oe.checkoutTimeoutInterval=setTimeout((()=>{oe.checkoutSessionTimeoutShow=!0}),n)},ye=()=>{oe.checkoutTimeoutInterval&&(clearTimeout(oe.checkoutTimeoutInterval),oe.checkoutTimeoutInterval=null)},we=()=>{oe.items=oe.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),oe.restrictedItems=[]},ge=async({adjustments:e,cartItems:t})=>{var n;oe.adjustments=e,oe.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const r=null===(n=t.find(Boolean))||void 0===n?void 0:n.currencyCode,s=t.reduce(((e,t)=>e+t.amount*t.quantity),0),i=e.reduce(((e,t)=>e+t.amount),0);r&&s&&(oe.currency=r,N.isFetchingSession=!0,await me({adjustmentsAmount:i,billToPartyId:N.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:s,shipToPartyId:N.partyShippingId,shouldInitSessionOnFailure:!0,varianceTestInput:o.enabledVariantTestKeys||[]}),N.isFetchingSession=!1)},fe=()=>{"shipping"===oe.step?(oe.step="customer-info",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})})):"payment"===oe.step?(oe.step="shipping",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})})):"finish"===oe.step&&(oe.step="payment",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{payment:Object.assign(Object.assign({},oe.tabItems.payment),{isDone:!1})}))},be=()=>{"customer-info"===oe.step?(oe.step="shipping",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems["customer-info"]),{isDone:!0})})):"shipping"===oe.step?(oe.step="payment",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!0})})):"payment"===oe.step&&(oe.step="finish")},Se=()=>{oe.step="customer-info",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},oe.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})}),oe.selectedShippingOption=null,oe.isSelectedShippingAboveDeminimis=!1,oe.isSelectedShippingGuarantee=!1,oe.selectedShippingOptionTransitTime="",oe.dutiesTaxesFees=0,oe.dutiesTaxesFeesEstimate=0,oe.shipping=0,oe.total=oe.subtotal};export{ce as A,F as B,$ as C,J as D,M as E,X as F,ee as G,z as H,pe as I,re as J,A as K,ve as L,P as a,L as b,N as c,Y as d,oe as e,ge as f,ae as g,Se as h,x as i,ye as j,V as k,G as l,he as m,K as n,de as o,ue as p,B as q,be as r,D as s,C as t,Z as u,W as v,H as w,q as x,R as y,k as z}
@@ -1 +1 @@
1
- import{r as t,h as o,H as s,d as n,c as a}from"./p-1640d77f.js";import{f as e}from"./p-6aa728f2.js";import{c as i}from"./p-b4b7f705.js";import{g as r}from"./p-207bd04a.js";import{c as p,t as h}from"./p-542acc2c.js";import{s as c}from"./p-a6f77d44.js";import{b as l,l as y}from"./p-20839c46.js";import{d as m}from"./p-371d91d1.js";import"./p-04a01cb1.js";import"./p-71c6bdc3.js";const d=class{constructor(o){t(this,o),this.theme="LIGHT"}render(){return this.el.shadowRoot?(this.el.shadowRoot.innerHTML="DARK"===this.theme?'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n':'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n',o(s,{class:"zonos--elements",style:{"--zonos--font-family":e(),"--zonos--height":"100%","--zonos--width":"100%"}},o("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))):null}get el(){return n(this)}};d.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";const f=class{constructor(o){t(this,o),this.notificationArray=[]}async showNotification(t){const o=`id-${Math.random().toString(36).substring(2,9)}`,s=Object.assign(Object.assign({},t),{id:o,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=[...this.notificationArray,s],setTimeout((()=>{this.updateTransitionClass({id:o,transitionClass:"show"})}),50),setTimeout((()=>{this.removeNotification(o)}),s.timeout)}updateTransitionClass({id:t,transitionClass:o}){this.notificationArray=this.notificationArray.map((s=>s.id===t?Object.assign(Object.assign({},s),{transitionClass:o}):s))}removeNotification(t){this.updateTransitionClass({id:t,transitionClass:""}),setTimeout((()=>{this.notificationArray=this.notificationArray.filter((o=>o.id!==t))}),300)}render(){return o(s,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:i(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":r(),"--zonos--font-family":e()}},o("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((t=>o("div",{"aria-hidden":"true",class:i(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:()=>{this.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))))))}};f.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";const z=class{constructor(o){t(this,o),this.stripe=p.stripe,this.stripeElements=p.stripeElements,this.isPaymentInfoFilled=!1,this.trackingSent=!1}watchIsPaymentInfoFilled(){var t;this.isPaymentInfoFilled&&!this.trackingSent&&(h({checkoutSessionId:c.checkoutSessionId,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:null===(t=p.stripePaymentEventData)||void 0===t?void 0:t.value.type}}),this.trackingSent=!0)}watchInitStripe(){if(!this.stripeElements)return;const t=p.stripePaymentElement||this.stripeElements.create("payment",{layout:"tabs"}),o=this.el.querySelector(".zonos--payment-component");o?(t.mount(o),t.on("change",(t=>{t.complete&&(this.isPaymentInfoFilled=!0),p.stripePaymentEventData=t})),p.stripePaymentElement=t):l("Cannot find container element for paymentElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(s,{key:"7210a20afba18d167a6e7d875ba23daa0db774e4",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"4f043b3149cca48d2f4463a826541ebe35d0b6ca",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"15721e208e90b969c075877680a02dca5bb81689",class:"zonos--payment-component"}),o("div",{key:"36d5767821464db479feff18e6368e862550c777",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}static get watchers(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}}};z.style=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";const g=class{constructor(o){t(this,o),this.paypalSessionDone=a(this,"paypalSessionDone",7),this.paypalSessionFail=a(this,"paypalSessionFail",7)}async loadPaypal(){if(!window.Zonos.paypal)return void y("Paypal is not available");const t=m({onPaypalFail:()=>{y("onPaypalFail"),this.paypalSessionFail.emit()},onPaypalSessionDone:({orderId:t})=>{y("onPaypalSessionDone","info",{orderId:t}),this.paypalSessionDone.emit({orderId:t})}});if(!(null==t?void 0:t.length))return void y("There are no paypal buttons available");const o=this.el.querySelector(".zonos--payment-paypal-container");o?t.forEach((async t=>{await t.render(o)})):y("Cannot find container element for paypal buttons")}componentDidLoad(){this.loadPaypal()}render(){return o(s,{key:"e8c839cc9d0286f5ae4643243b14fa66f9584833",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"cac06948de1ccca97ba65eca10b3e5d9f3a9a362",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}};g.style=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";export{d as zonos_empty_state_payment,f as zonos_notification,z as zonos_payment,g as zonos_paypal_payment}
1
+ import{r as t,h as o,H as s,d as n,c as a}from"./p-1640d77f.js";import{f as e}from"./p-6aa728f2.js";import{c as i}from"./p-b4b7f705.js";import{g as r}from"./p-207bd04a.js";import{c as p,t as h}from"./p-992f0b96.js";import{s as c}from"./p-a6f77d44.js";import{b as l,l as y}from"./p-20839c46.js";import{d as m}from"./p-5b3b58ef.js";import"./p-04a01cb1.js";import"./p-71c6bdc3.js";const d=class{constructor(o){t(this,o),this.theme="LIGHT"}render(){return this.el.shadowRoot?(this.el.shadowRoot.innerHTML="DARK"===this.theme?'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n':'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n',o(s,{class:"zonos--elements",style:{"--zonos--font-family":e(),"--zonos--height":"100%","--zonos--width":"100%"}},o("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))):null}get el(){return n(this)}};d.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";const f=class{constructor(o){t(this,o),this.notificationArray=[]}async showNotification(t){const o=`id-${Math.random().toString(36).substring(2,9)}`,s=Object.assign(Object.assign({},t),{id:o,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=[...this.notificationArray,s],setTimeout((()=>{this.updateTransitionClass({id:o,transitionClass:"show"})}),50),setTimeout((()=>{this.removeNotification(o)}),s.timeout)}updateTransitionClass({id:t,transitionClass:o}){this.notificationArray=this.notificationArray.map((s=>s.id===t?Object.assign(Object.assign({},s),{transitionClass:o}):s))}removeNotification(t){this.updateTransitionClass({id:t,transitionClass:""}),setTimeout((()=>{this.notificationArray=this.notificationArray.filter((o=>o.id!==t))}),300)}render(){return o(s,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:i(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":r(),"--zonos--font-family":e()}},o("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((t=>o("div",{"aria-hidden":"true",class:i(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:()=>{this.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))))))}};f.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";const z=class{constructor(o){t(this,o),this.stripe=p.stripe,this.stripeElements=p.stripeElements,this.isPaymentInfoFilled=!1,this.trackingSent=!1}watchIsPaymentInfoFilled(){var t;this.isPaymentInfoFilled&&!this.trackingSent&&(h({checkoutSessionId:c.checkoutSessionId,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:null===(t=p.stripePaymentEventData)||void 0===t?void 0:t.value.type}}),this.trackingSent=!0)}watchInitStripe(){if(!this.stripeElements)return;const t=p.stripePaymentElement||this.stripeElements.create("payment",{layout:"tabs"}),o=this.el.querySelector(".zonos--payment-component");o?(t.mount(o),t.on("change",(t=>{t.complete&&(this.isPaymentInfoFilled=!0),p.stripePaymentEventData=t})),p.stripePaymentElement=t):l("Cannot find container element for paymentElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(s,{key:"7210a20afba18d167a6e7d875ba23daa0db774e4",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"4f043b3149cca48d2f4463a826541ebe35d0b6ca",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"15721e208e90b969c075877680a02dca5bb81689",class:"zonos--payment-component"}),o("div",{key:"36d5767821464db479feff18e6368e862550c777",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}static get watchers(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}}};z.style=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";const g=class{constructor(o){t(this,o),this.paypalSessionDone=a(this,"paypalSessionDone",7),this.paypalSessionFail=a(this,"paypalSessionFail",7)}async loadPaypal(){if(!window.Zonos.paypal)return void y("Paypal is not available");const t=m({onPaypalFail:()=>{y("onPaypalFail"),this.paypalSessionFail.emit()},onPaypalSessionDone:({orderId:t})=>{y("onPaypalSessionDone","info",{orderId:t}),this.paypalSessionDone.emit({orderId:t})}});if(!(null==t?void 0:t.length))return void y("There are no paypal buttons available");const o=this.el.querySelector(".zonos--payment-paypal-container");o?t.forEach((async t=>{await t.render(o)})):y("Cannot find container element for paypal buttons")}componentDidLoad(){this.loadPaypal()}render(){return o(s,{key:"e8c839cc9d0286f5ae4643243b14fa66f9584833",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"cac06948de1ccca97ba65eca10b3e5d9f3a9a362",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}};g.style=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";export{d as zonos_empty_state_payment,f as zonos_notification,z as zonos_payment,g as zonos_paypal_payment}
@@ -1 +1 @@
1
- var __extends=this&&this.__extends||function(){var t=function(n,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)if(Object.prototype.hasOwnProperty.call(n,e))t[e]=n[e]};return t(n,e)};return function(n,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(n,e);function i(){this.constructor=n}n.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function u(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(s,u)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(n){return c([t,n])}}function c(u){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,u[0]&&(e=0)),e)try{if(i=1,o&&(r=u[0]&2?o["return"]:u[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;if(o=0,r)u=[u[0]&2,r.value];switch(u[0]){case 0:case 1:r=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){e.label=u[1];break}if(u[0]===6&&e.label<r[1]){e.label=r[1];r=u;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(u);break}if(r[2])e.ops.pop();e.trys.pop();continue}u=n.call(t,e)}catch(t){u=[6,t];o=0}finally{i=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var i=0,o=n.length,r;i<o;i++){if(r||!(i in n)){if(!r)r=Array.prototype.slice.call(n,0,i);r[i]=n[i]}}return t.concat(r||Array.prototype.slice.call(n))};System.register(["./p-02da743b.system.js","./p-5711e187.system.js","./p-0751b878.system.js","./p-19182dc7.system.js","./p-4160bbc2.system.js","./p-a411ce2a.system.js","./p-3633a952.system.js","./p-738a49c0.system.js","./p-5a2dd041.system.js"],(function(t){"use strict";var n,e,i,o,r,s,u,c,a,f,d,l,h,v,w,p,m,g;return{setters:[function(t){n=t.r;e=t.c;i=t.h;o=t.H},function(t){r=t.c},function(t){s=t.i;u=t.e;c=t.s;a=t.a},function(t){f=t.z;d=t.e;l=t.f},function(t){h=t.g;v=t.i;w=t.a},function(t){p=t.h;m=t.b;g=t.l},function(){},function(){},function(){}],execute:function(){var _=this;var y=function(){return __awaiter(_,void 0,void 0,(function(){var t,n,e,i,o,r;return __generator(this,(function(s){switch(s.label){case 0:if(window.Zonos.cartSettings){return[2,{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode}]}t=h();n=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){n.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}return[4,p("/api/zonos-elements/zonos-settings?".concat(n.toString()))];case 1:e=s.sent(),i=e.errors,o=e.json,r=e.zonosMode;if(i.length){m("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:i,json:null,zonosMode:r}]}return[2,{errors:[],json:o,zonosMode:r}]}}))}))};var b=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var S=function(t){if(!t.placeOrderButtonSelector&&!t.alwaysTriggerInternationalCheckoutSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!s(t.placeOrderButtonSelector)){m('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}if(t.alwaysTriggerInternationalCheckoutSelector&&!s(t.alwaysTriggerInternationalCheckoutSelector)){m('Selector alwaysTriggerInternationalCheckoutSelector "'.concat(t.alwaysTriggerInternationalCheckoutSelector,'" is not a valid selector'));return}b()};var z=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var I=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var j=function(t){var n=t.position,e=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var o=document.querySelector(i);if(o){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(e==="top-right"){r.style.top="72px";r.style.right="24px"}if(e==="top-left"){r.style.top="72px";r.style.left="24px"}if(e==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(e==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483007";document.body.appendChild(r);return i};var k=function(t){return __awaiter(_,void 0,void 0,(function(){var n,e,i,o,r;return __generator(this,(function(u){if(window.Zonos.isLegacyCheckout){g("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;e=n;if(!t.anchorElementSelector&&t.desktopLocation){i=j({position:"bottom-right"});e=i}if(!e||!s(e)){m('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}g("Hello init complete");o=z(e);if(!o){r=new MutationObserver((function(){var t=z(e);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){z(e)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){g("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=j({position:I(t.notFoundElementFallback)});z(n)}}),3e3)}return[2]}))}))};var O=function(){function t(t,n){var e=this;this.targetId=t;this.allowedEvents=n;this.listeners=new Map;this.handleMessage=function(t){var n,i,o;var r=t.data;var s=((n=e.iframe)===null||n===void 0?void 0:n.contentWindow)||((o=(i=e.iframe)===null||i===void 0?void 0:i.contentDocument)===null||o===void 0?void 0:o.defaultView);if(t.source!==s){return}if(!e.isValidMessage(r)){return}var u=e.listeners.get(r.type);u===null||u===void 0?void 0:u.forEach((function(t){try{t(r.payload)}catch(t){m("Error in event listener:",t)}}))};this.initializeEventListeners();this.iframe=document.getElementById(this.targetId)}t.prototype.initializeEventListeners=function(){window.addEventListener("message",this.handleMessage)};t.prototype.isValidMessage=function(t){if(!t||typeof t!=="object")return false;var n=t;return n.id===this.targetId&&typeof n.type==="string"&&this.allowedEvents.includes(n.type)&&n.payload!==undefined};t.prototype.on=function(t,n){var e=this;if(!this.listeners.has(t)){this.listeners.set(t,new Set)}g("[CheckoutAddressService] listening to ".concat(t),"info");var i=n;var o=this.listeners.get(t);if(o){o.add(i)}return function(){var n=e.listeners.get(t);if(n){n.delete(i)}}};t.prototype.destroy=function(){window.removeEventListener("message",this.handleMessage);this.listeners.clear()};return t}();var A=function(t){__extends(n,t);function n(){g("=== [Google Places Service] Initializing","info");return t.call(this,v.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])||this}n.prototype.sendMessage=function(t,n){var e;if(!((e=this.iframe)===null||e===void 0?void 0:e.contentWindow)){return}var i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:n,type:t};g("GooglePlacesService] parent --\x3e ".concat(t),"info",n);this.iframe.contentWindow.postMessage(i,"*")};n.prototype.initialize=function(){this.sendMessage("initializeGooglePlacesService",{})};n.prototype.fetchSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!n){return}this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[n],input:e},type:i})};n.prototype.selectPlace=function(t){var n=t.placeId,e=t.type;this.sendMessage("placeSelected",{placeId:n,type:e})};return n}(O);var T=function(){function t(){var t=this;this.googlePlaceInitialized=false;g("=== [CheckoutAddressService] Initializing","info");this.googlePlaces=new A;this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info");t.googlePlaceInitialized=true}));this.initialize()}t.prototype.initialize=function(){this.googlePlaces.initialize()};t.prototype.onInitializeGooglePlacesService=function(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService");t()}))};t.prototype.isGooglePlaceInitialized=function(){return this.googlePlaceInitialized};t.prototype.onAddressSuggestions=function(t){this.suggestionsCallback=t;return this.googlePlaces.on("onFetchAutocompleteSuggestions",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.onAddressSelected=function(t){this.placeSelectedCallback=t;return this.googlePlaces.on("onPlaceSelected",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onPlaceSelected ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.getAddressSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!this.googlePlaceInitialized){return}this.googlePlaces.fetchSuggestions({country:n,query:e,type:i})};t.prototype.selectAddress=function(t){var n=t.placeId,e=t.type;this.googlePlaces.selectPlace({placeId:n,type:e})};t.prototype.destroy=function(){this.googlePlaces.destroy();if(this.suggestionsCallback){this.suggestionsCallback=undefined}if(this.placeSelectedCallback){this.placeSelectedCallback=undefined}};return t}();var E=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var C=E;var P=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=e(this,"paypalInitEvent",7);this.stripeInitEvent=e(this,"stripeInitEvent",7)}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){g("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}r.stripe=t;void S(f.checkoutSettings);g("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,i,o,r,s,u,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||l();if(i==="Inter"){if(!t){return[2]}g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t})}o=new URLSearchParams;o.set("family",i);return[4,p("/api/zonos-elements/get-font-detail?".concat(o.toString()))];case 1:r=a.sent(),s=r.errors,u=r.json;if(s.length>0){g("Failed to load font ".concat(i),"warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:"Inter"});return[2]}c=u===null||u===void 0?void 0:u.fontUrl;if(c){(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,c)}if(!t){return[2]}g("[FONT] ".concat(t," font override applied"));f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void k(f.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout){g("=== Skip injecting custom HTML for hosted checkout","info");return}g("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var e=n.content.querySelectorAll("script");e.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}))};t.prototype.initGooglePlacesService=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;return __generator(this,(function(i){n=t===null||t===void 0?void 0:t.genericSettings;if(!n){return[2]}e=n.signedTokenGooglePlaces;if(!e){return[2]}w({id:v.GOOGLE_PLACES,onload:function(){f.checkoutAddressService=new T},src:"".concat("https://route.elements.zonos.com","/iframe/google-maps?signedToken=").concat(e)});return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();f.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,i,o,r,s,c,a,l,h,v,w,p,m;var _=this;return __generator(this,(function(b){switch(b.label){case 0:return[4,y()];case 1:s=b.sent(),c=s.errors,a=s.json,l=s.zonosMode;if(((n=(t=c[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){g("Failed to load zonos settings. This domain may not have access","warn");return[2]}h=((e=a===null||a===void 0?void 0:a.checkoutSettings)===null||e===void 0?void 0:e.customHTML)||"";this.injectCustomHTML(h);this.initZonosNotification();v=function(){var t,n,e;if(window.Zonos.isLegacyCheckout){return((t=a===null||a===void 0?void 0:a.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=_.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(e=_.config.appearance)===null||e===void 0?void 0:e.logoUrl};w=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((i=this.config.checkoutSettings)===null||i===void 0?void 0:i.successBehavior)==="CLOSE_MODAL";p=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:v()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined,successBehavior:w?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:w?((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||(a===null||a===void 0?void 0:a.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):undefined});d({overrideSettings:p,zonosSettings:a});f.zonosMode=l;void this.setupGoogleFont();if(f.helloSettings.visibilityStatus==="DISABLED"){g("=== Hello is disabled by store owner ===","warn")}if(f.helloSettings&&f.helloSettings.visibilityStatus==="ENABLED"){g("Initializing hello");void k(f.helloSettings)}return[4,u()];case 2:b.sent();m=((r=a===null||a===void 0?void 0:a.checkoutSettings)===null||r===void 0?void 0:r.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!m||!this.stripeInitEvent){g("Checkout failed to load -- missing publishable key","warn");return[2]}if(f.checkoutSettings.subscriptionStatus==="INACTIVE"){g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");g("zonos controller loaded");return[2]}if(f.checkoutSettings.visibilityStatus==="DISABLED"){g("=== Checkout is disabled by store owner ===","warn");g("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:m.token});void this.initGooglePlacesService(a);return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){g("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){c.checkoutSessionId=null;r.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){g("Override country code to ".concat(t));void a(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,f.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){f.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(o,{key:"62c0b3079d64f05800da24daa19e0e1e3a890bca",class:"zonos--elements"})};return t}());P.style=C}}}));
1
+ var __extends=this&&this.__extends||function(){var t=function(n,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)if(Object.prototype.hasOwnProperty.call(n,e))t[e]=n[e]};return t(n,e)};return function(n,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(n,e);function i(){this.constructor=n}n.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function u(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(s,u)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(n){return c([t,n])}}function c(u){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,u[0]&&(e=0)),e)try{if(i=1,o&&(r=u[0]&2?o["return"]:u[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;if(o=0,r)u=[u[0]&2,r.value];switch(u[0]){case 0:case 1:r=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){e.label=u[1];break}if(u[0]===6&&e.label<r[1]){e.label=r[1];r=u;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(u);break}if(r[2])e.ops.pop();e.trys.pop();continue}u=n.call(t,e)}catch(t){u=[6,t];o=0}finally{i=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var i=0,o=n.length,r;i<o;i++){if(r||!(i in n)){if(!r)r=Array.prototype.slice.call(n,0,i);r[i]=n[i]}}return t.concat(r||Array.prototype.slice.call(n))};System.register(["./p-02da743b.system.js","./p-7ec1fecb.system.js","./p-0751b878.system.js","./p-19182dc7.system.js","./p-4160bbc2.system.js","./p-a411ce2a.system.js","./p-3633a952.system.js","./p-738a49c0.system.js","./p-5a2dd041.system.js"],(function(t){"use strict";var n,e,i,o,r,s,u,c,a,f,d,l,h,v,w,p,m,g;return{setters:[function(t){n=t.r;e=t.c;i=t.h;o=t.H},function(t){r=t.c},function(t){s=t.i;u=t.e;c=t.s;a=t.a},function(t){f=t.z;d=t.e;l=t.f},function(t){h=t.g;v=t.i;w=t.a},function(t){p=t.h;m=t.b;g=t.l},function(){},function(){},function(){}],execute:function(){var _=this;var y=function(){return __awaiter(_,void 0,void 0,(function(){var t,n,e,i,o,r;return __generator(this,(function(s){switch(s.label){case 0:if(window.Zonos.cartSettings){return[2,{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode}]}t=h();n=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){n.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}return[4,p("/api/zonos-elements/zonos-settings?".concat(n.toString()))];case 1:e=s.sent(),i=e.errors,o=e.json,r=e.zonosMode;if(i.length){m("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:i,json:null,zonosMode:r}]}return[2,{errors:[],json:o,zonosMode:r}]}}))}))};var b=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var S=function(t){if(!t.placeOrderButtonSelector&&!t.alwaysTriggerInternationalCheckoutSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!s(t.placeOrderButtonSelector)){m('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}if(t.alwaysTriggerInternationalCheckoutSelector&&!s(t.alwaysTriggerInternationalCheckoutSelector)){m('Selector alwaysTriggerInternationalCheckoutSelector "'.concat(t.alwaysTriggerInternationalCheckoutSelector,'" is not a valid selector'));return}b()};var z=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var I=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var j=function(t){var n=t.position,e=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var o=document.querySelector(i);if(o){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(e==="top-right"){r.style.top="72px";r.style.right="24px"}if(e==="top-left"){r.style.top="72px";r.style.left="24px"}if(e==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(e==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483007";document.body.appendChild(r);return i};var k=function(t){return __awaiter(_,void 0,void 0,(function(){var n,e,i,o,r;return __generator(this,(function(u){if(window.Zonos.isLegacyCheckout){g("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;e=n;if(!t.anchorElementSelector&&t.desktopLocation){i=j({position:"bottom-right"});e=i}if(!e||!s(e)){m('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}g("Hello init complete");o=z(e);if(!o){r=new MutationObserver((function(){var t=z(e);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){z(e)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){g("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=j({position:I(t.notFoundElementFallback)});z(n)}}),3e3)}return[2]}))}))};var O=function(){function t(t,n){var e=this;this.targetId=t;this.allowedEvents=n;this.listeners=new Map;this.handleMessage=function(t){var n,i,o;var r=t.data;var s=((n=e.iframe)===null||n===void 0?void 0:n.contentWindow)||((o=(i=e.iframe)===null||i===void 0?void 0:i.contentDocument)===null||o===void 0?void 0:o.defaultView);if(t.source!==s){return}if(!e.isValidMessage(r)){return}var u=e.listeners.get(r.type);u===null||u===void 0?void 0:u.forEach((function(t){try{t(r.payload)}catch(t){m("Error in event listener:",t)}}))};this.initializeEventListeners();this.iframe=document.getElementById(this.targetId)}t.prototype.initializeEventListeners=function(){window.addEventListener("message",this.handleMessage)};t.prototype.isValidMessage=function(t){if(!t||typeof t!=="object")return false;var n=t;return n.id===this.targetId&&typeof n.type==="string"&&this.allowedEvents.includes(n.type)&&n.payload!==undefined};t.prototype.on=function(t,n){var e=this;if(!this.listeners.has(t)){this.listeners.set(t,new Set)}g("[CheckoutAddressService] listening to ".concat(t),"info");var i=n;var o=this.listeners.get(t);if(o){o.add(i)}return function(){var n=e.listeners.get(t);if(n){n.delete(i)}}};t.prototype.destroy=function(){window.removeEventListener("message",this.handleMessage);this.listeners.clear()};return t}();var A=function(t){__extends(n,t);function n(){g("=== [Google Places Service] Initializing","info");return t.call(this,v.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])||this}n.prototype.sendMessage=function(t,n){var e;if(!((e=this.iframe)===null||e===void 0?void 0:e.contentWindow)){return}var i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:n,type:t};g("GooglePlacesService] parent --\x3e ".concat(t),"info",n);this.iframe.contentWindow.postMessage(i,"*")};n.prototype.initialize=function(){this.sendMessage("initializeGooglePlacesService",{})};n.prototype.fetchSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!n){return}this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[n],input:e},type:i})};n.prototype.selectPlace=function(t){var n=t.placeId,e=t.type;this.sendMessage("placeSelected",{placeId:n,type:e})};return n}(O);var T=function(){function t(){var t=this;this.googlePlaceInitialized=false;g("=== [CheckoutAddressService] Initializing","info");this.googlePlaces=new A;this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info");t.googlePlaceInitialized=true}));this.initialize()}t.prototype.initialize=function(){this.googlePlaces.initialize()};t.prototype.onInitializeGooglePlacesService=function(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService");t()}))};t.prototype.isGooglePlaceInitialized=function(){return this.googlePlaceInitialized};t.prototype.onAddressSuggestions=function(t){this.suggestionsCallback=t;return this.googlePlaces.on("onFetchAutocompleteSuggestions",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.onAddressSelected=function(t){this.placeSelectedCallback=t;return this.googlePlaces.on("onPlaceSelected",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onPlaceSelected ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.getAddressSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!this.googlePlaceInitialized){return}this.googlePlaces.fetchSuggestions({country:n,query:e,type:i})};t.prototype.selectAddress=function(t){var n=t.placeId,e=t.type;this.googlePlaces.selectPlace({placeId:n,type:e})};t.prototype.destroy=function(){this.googlePlaces.destroy();if(this.suggestionsCallback){this.suggestionsCallback=undefined}if(this.placeSelectedCallback){this.placeSelectedCallback=undefined}};return t}();var E=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var C=E;var P=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=e(this,"paypalInitEvent",7);this.stripeInitEvent=e(this,"stripeInitEvent",7)}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){g("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}r.stripe=t;void S(f.checkoutSettings);g("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,i,o,r,s,u,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||l();if(i==="Inter"){if(!t){return[2]}g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t})}o=new URLSearchParams;o.set("family",i);return[4,p("/api/zonos-elements/get-font-detail?".concat(o.toString()))];case 1:r=a.sent(),s=r.errors,u=r.json;if(s.length>0){g("Failed to load font ".concat(i),"warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:"Inter"});return[2]}c=u===null||u===void 0?void 0:u.fontUrl;if(c){(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,c)}if(!t){return[2]}g("[FONT] ".concat(t," font override applied"));f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void k(f.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout){g("=== Skip injecting custom HTML for hosted checkout","info");return}g("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var e=n.content.querySelectorAll("script");e.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}))};t.prototype.initGooglePlacesService=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;return __generator(this,(function(i){n=t===null||t===void 0?void 0:t.genericSettings;if(!n){return[2]}e=n.signedTokenGooglePlaces;if(!e){return[2]}w({id:v.GOOGLE_PLACES,onload:function(){f.checkoutAddressService=new T},src:"".concat("https://route.elements.zonos.com","/iframe/google-maps?signedToken=").concat(e)});return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();f.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,i,o,r,s,c,a,l,h,v,w,p,m;var _=this;return __generator(this,(function(b){switch(b.label){case 0:return[4,y()];case 1:s=b.sent(),c=s.errors,a=s.json,l=s.zonosMode;if(((n=(t=c[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){g("Failed to load zonos settings. This domain may not have access","warn");return[2]}h=((e=a===null||a===void 0?void 0:a.checkoutSettings)===null||e===void 0?void 0:e.customHTML)||"";this.injectCustomHTML(h);this.initZonosNotification();v=function(){var t,n,e;if(window.Zonos.isLegacyCheckout){return((t=a===null||a===void 0?void 0:a.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=_.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(e=_.config.appearance)===null||e===void 0?void 0:e.logoUrl};w=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((i=this.config.checkoutSettings)===null||i===void 0?void 0:i.successBehavior)==="CLOSE_MODAL";p=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:v()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined,successBehavior:w?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:w?((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||(a===null||a===void 0?void 0:a.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):undefined});d({overrideSettings:p,zonosSettings:a});f.zonosMode=l;void this.setupGoogleFont();if(f.helloSettings.visibilityStatus==="DISABLED"){g("=== Hello is disabled by store owner ===","warn")}if(f.helloSettings&&f.helloSettings.visibilityStatus==="ENABLED"){g("Initializing hello");void k(f.helloSettings)}return[4,u()];case 2:b.sent();m=((r=a===null||a===void 0?void 0:a.checkoutSettings)===null||r===void 0?void 0:r.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!m||!this.stripeInitEvent){g("Checkout failed to load -- missing publishable key","warn");return[2]}if(f.checkoutSettings.subscriptionStatus==="INACTIVE"){g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");g("zonos controller loaded");return[2]}if(f.checkoutSettings.visibilityStatus==="DISABLED"){g("=== Checkout is disabled by store owner ===","warn");g("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:m.token});void this.initGooglePlacesService(a);return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){g("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){c.checkoutSessionId=null;r.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){g("Override country code to ".concat(t));void a(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,f.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){f.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(o,{key:"62c0b3079d64f05800da24daa19e0e1e3a890bca",class:"zonos--elements"})};return t}());P.style=C}}}));