@zonos/elements 1.3.235 → 1.3.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-22ced7cc.js → cart-e435a549.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-ca85cabd.js → hasInclusivePrice-06d35d3c.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-8fd4242c.js → invoice-fc7bef1e.js} +2 -2
- package/dist/cjs/{isCollectMobileTablet-7962c57f.js → isCollectMobileTablet-aeeb0401.js} +2 -2
- package/dist/cjs/{localization-8ef6250a.js → localization-98db6c18.js} +7 -6
- package/dist/cjs/{paypal-4a086f84.js → paypal-a7bb03b5.js} +2 -2
- package/dist/cjs/{placeTestOrder-f25d08ee.js → placeTestOrder-6d99608b.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-5494e45b.js → renderCheckoutCurrency-530fb636.js} +2 -2
- package/dist/cjs/zonos-address-display_9.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +6 -6
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +7 -6
- package/dist/esm/{cart-66aecbb3.js → cart-d802d953.js} +1 -1
- package/dist/esm/{hasInclusivePrice-2a1bf474.js → hasInclusivePrice-0285118a.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-c7452847.js → invoice-888ae8c9.js} +2 -2
- package/dist/esm/{isCollectMobileTablet-921002b0.js → isCollectMobileTablet-028f8611.js} +2 -2
- package/dist/esm/{localization-04b05867.js → localization-8f12d460.js} +7 -6
- package/dist/esm/{paypal-56564874.js → paypal-9b9e6231.js} +2 -2
- package/dist/esm/{placeTestOrder-6b9eda9e.js → placeTestOrder-42778584.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-cb808110.js → renderCheckoutCurrency-db3ce341.js} +2 -2
- package/dist/esm/zonos-address-display_9.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +6 -6
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/{cart-66aecbb3.js → cart-d802d953.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-2a1bf474.js → hasInclusivePrice-0285118a.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-c7452847.js → invoice-888ae8c9.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-921002b0.js → isCollectMobileTablet-028f8611.js} +1 -1
- package/dist/esm-es5/{localization-04b05867.js → localization-8f12d460.js} +1 -1
- package/dist/esm-es5/{paypal-56564874.js → paypal-9b9e6231.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-6b9eda9e.js → placeTestOrder-42778584.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-cb808110.js → renderCheckoutCurrency-db3ce341.js} +1 -1
- package/dist/esm-es5/zonos-address-display_9.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-f513b231.entry.js → p-09e3ed0d.entry.js} +1 -1
- package/dist/zonos-elements/{p-82febf70.system.js → p-09f2cbc9.system.js} +1 -1
- package/dist/zonos-elements/p-0abc8161.entry.js +1 -0
- package/dist/zonos-elements/{p-00719e49.entry.js → p-0ce28a83.entry.js} +1 -1
- package/dist/zonos-elements/{p-1a30fe18.system.entry.js → p-0e80d189.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-38913b2f.entry.js → p-1f1bf0c6.entry.js} +1 -1
- package/dist/zonos-elements/{p-10316d4d.system.entry.js → p-20dac9d4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-836db369.system.entry.js → p-26ce341c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7e469c5c.entry.js → p-293d7a79.entry.js} +1 -1
- package/dist/zonos-elements/{p-18bc6c7a.entry.js → p-2e74e090.entry.js} +1 -1
- package/dist/zonos-elements/{p-f64207fa.system.entry.js → p-35a1979e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dc94d7eb.js → p-37f46852.js} +1 -1
- package/dist/zonos-elements/{p-a610c24e.system.entry.js → p-387304a0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-48dc96f9.system.entry.js → p-3913b1e4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9479f155.system.js → p-3b598f1d.system.js} +1 -1
- package/dist/zonos-elements/{p-f4e976ae.entry.js → p-3fce3aef.entry.js} +1 -1
- package/dist/zonos-elements/{p-7e17667d.js → p-442f1023.js} +1 -1
- package/dist/zonos-elements/{p-95dc475b.system.js → p-48637bf6.system.js} +1 -1
- package/dist/zonos-elements/{p-9fa32fdf.js → p-48f48767.js} +1 -1
- package/dist/zonos-elements/{p-7f91617c.system.entry.js → p-4f030caf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-170314a3.js → p-59bc0ca9.js} +1 -1
- package/dist/zonos-elements/{p-f3962950.system.entry.js → p-5fc40d18.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d3a62fb.entry.js → p-63a1b931.entry.js} +1 -1
- package/dist/zonos-elements/{p-30c661b3.system.entry.js → p-68991148.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-50f31c12.system.entry.js → p-73718cac.system.entry.js} +1 -1
- package/dist/zonos-elements/p-802a28f5.js +1 -0
- package/dist/zonos-elements/{p-757d4c62.system.entry.js → p-8916f54e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-44b50260.entry.js → p-8e250c09.entry.js} +1 -1
- package/dist/zonos-elements/{p-f1d9dd4e.entry.js → p-a006320c.entry.js} +1 -1
- package/dist/zonos-elements/{p-83b3f824.system.entry.js → p-a12605f5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-17a09191.entry.js → p-a5538e61.entry.js} +1 -1
- package/dist/zonos-elements/{p-6688473e.entry.js → p-a5ac9c92.entry.js} +1 -1
- package/dist/zonos-elements/{p-8af188f8.system.js → p-a87b5eaa.system.js} +1 -1
- package/dist/zonos-elements/{p-34bf7bbe.system.js → p-a8b1c81e.system.js} +1 -1
- package/dist/zonos-elements/{p-9b9bfb6d.entry.js → p-b29c5296.entry.js} +1 -1
- package/dist/zonos-elements/{p-4aa86184.system.entry.js → p-b80d40e5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-18d20206.system.js → p-b9b42171.system.js} +1 -1
- package/dist/zonos-elements/p-bb73eb0f.js +1 -0
- package/dist/zonos-elements/{p-0e82fcea.entry.js → p-bf37c05f.entry.js} +1 -1
- package/dist/zonos-elements/p-c2442878.system.js +1 -1
- package/dist/zonos-elements/{p-976afc17.system.js → p-cca277fb.system.js} +1 -1
- package/dist/zonos-elements/{p-2250e585.entry.js → p-cd8ffc39.entry.js} +1 -1
- package/dist/zonos-elements/{p-4d594c8e.system.js → p-d24dde2c.system.js} +1 -1
- package/dist/zonos-elements/{p-a2a0bf4e.js → p-dadd3f97.js} +1 -1
- package/dist/zonos-elements/{p-0cd5bcb3.entry.js → p-dc08012c.entry.js} +1 -1
- package/dist/zonos-elements/{p-c8cc20d9.system.js → p-dea18dc5.system.js} +1 -1
- package/dist/zonos-elements/{p-73c737aa.js → p-e2e1145c.js} +1 -1
- package/dist/zonos-elements/{p-890bfc42.system.entry.js → p-e8c344c9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ed8ae947.system.entry.js → p-ef1edb24.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-248dd596.system.entry.js → p-f0cbecc3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-851011aa.system.entry.js → p-f7290144.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f1d4d6da.entry.js → p-f9183b9f.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-6626d240.entry.js +0 -1
- package/dist/zonos-elements/p-81e3eb5b.js +0 -1
- package/dist/zonos-elements/p-dc5fb21c.js +0 -1
|
@@ -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 a(e){try{d(r.next(e))}catch(e){i(e)}}function s(e){try{d(r["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):o(e.value).then(a,s)}d((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,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(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(r=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:t.label++;return{value:s[1],done:false};case 5:t.label++;o=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];o=0}finally{r=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,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-d45285aa.system.js","./p-9479f155.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-909e2bc3.system.js","./p-23d497e3.system.js"],(function(e){"use strict";var n,t,r,o,i,a,s,d,u,l,c,v,f,m,p,h,w,g,y;return{setters:[function(e){n=e.z;t=e.c},function(e){r=e.s;o=e.l;i=e.e;a=e.t;s=e.f;d=e.b},function(e){u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;m=e.l;p=e.j},function(e){h=e.l;w=e.b},function(e){g=e.i},function(e){y=e.g}],execute:function(){var b=this;var _=e("K",(function(e){var n=e.firstName,t=e.lastName,r=e.name;var o;if(!r&&!n&&!t){return{firstName:"",lastName:""}}var i=(r===null||r===void 0?void 0:r.split(/\s+/))||[];var a=(n===null||n===void 0?void 0:n.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(t===null||t===void 0?void 0:t.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var S=function(e){var n=e.currentAddress,t=e.translatedAddress;var r,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,m=u.postal_code,p=u.state;var h=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((r=t.city)===null||r===void 0?void 0:r[l])||l,country:c,line1:((o=t.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=t.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=t.name)===null||a===void 0?void 0:a[h])||h,phone:n.value.phone||"",postal_code:((s=t.postal_code)===null||s===void 0?void 0:s[m])||m,state:((d=t.state)===null||d===void 0?void 0:d[p])||p}};var O=function(e){var n;var t=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var a=J.stripeLinkEventData;var s=J.stripeAddressEventData;var d=J.stripeShippingSameAsBilling?J.stripeAddressEventData:J.stripeBillingAddressEventData;if(!s||!d){throw new Error("Missing stripe address data")}var u=S({currentAddress:s,translatedAddress:J.translatedAddress.address});var l=_({name:u.name}),c=l.firstName,v=l.lastName;var f=S({currentAddress:d,translatedAddress:J.translatedAddress.address});var m=_({name:f.name}),p=m.firstName,h=m.lastName;var w=i()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:p,lastName:h,phone:f.phone},cartCurrencyCode:(n=Oe.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionCountry:w||o.selectedCountryCode||undefined,checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:J.companyName,email:a===null||a===void 0?void 0:a.value.email,firstName:c,lastName:v,phone:u.phone},isTest:!!t,landedCostAdjustments:Oe.promoCode?[{amount:0,productId:null,promoCode:Oe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:J.taxId,shippingAddress:{addressLine1:u.line1,addressLine2:u.line2,city:u.city,country:u.country,postalCode:u.postal_code,state:u.state}}};var C=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=J.stripeLinkEventData;var t=J.stripeAddressEventData;var o=J.stripeShippingSameAsBilling?J.stripeAddressEventData:J.stripeBillingAddressEventData;h({stripeAddressData:t,stripeBillingAddressData:o},"info");if(!t||!o){throw new Error("Missing stripe address data")}var i=S({currentAddress:t,translatedAddress:J.translatedAddress.address});var a=_({name:i.name}),s=a.firstName,d=a.lastName;var u=S({currentAddress:o,translatedAddress:J.translatedAddress.address});var l=_({name:u.name}),c=l.firstName,v=l.lastName;var f=Oe.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Oe.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Oe.promoCode,sku:null,type:"PROMO_CODE"}],f,true):f;return{billingAddress:{addressLine1:u.line1,addressLine2:u.line2||"",city:u.city,country:u.country,postalCode:u.postal_code,state:u.state},billingContact:{firstName:c,lastName:v,phone:u.phone},checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:J.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:s,lastName:d,phone:i.phone},isTest:e,items:Oe.items,landedCostAdjustments:m,shipToTaxId:J.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var k=function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=C();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)&&((t=s.errors)===null||t===void 0?void 0:t.length)){throw new Error("Failed to build landed cost: ".concat(((o=(r=s===null||s===void 0?void 0:s.errors)===null||r===void 0?void 0:r[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 A=function(e){return __awaiter(b,void 0,void 0,(function(){var t,r,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:r=n.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,k(r)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:C(),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=((t=a[0])===null||t===void 0?void 0:t.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 I=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:O(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){u=typeof((n=s[0])===null||n===void 0?void 0:n.message)==="string"&&(((t=s[0])===null||t===void 0?void 0:t.message)==="The user aborted a request."||((r=s[0])===null||r===void 0?void 0:r.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));c=u?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(c)}return[2,d]}}))}))};var T=undefined&&undefined.__rest||function(e,n){var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0)t[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++){if(n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o]))t[r[o]]=e[r[o]]}return t};var E=function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,A(e)];case 1:t=a.sent();return[2,t];case 2:return[4,I({abortController:e,cartId:n})];case 3:r=a.sent(),o=r.cartWorkflow,i=T(r,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var N=e("t",(function(e){return __awaiter(b,[e],void 0,(function(e){var t,r,i,a,s,d,u,m,p;var h=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:h,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;m=n.organizationId;if(!h){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:w,checkoutSessionId:h,eventName:g,metadata:y,organizationId:m,trackEventLogs:a}});return[2]}if(!m){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:w,checkoutSessionId:h,eventName:g,metadata:y,organizationId:m,trackEventLogs:a}})}p={checkoutSessionId:h,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:m};return[4,l("/api/zonos-elements/track-conversion-event",{body:p,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var j=function(e){var n=e.address,t=e.invalidAdddressList;if(!n){return}if(!t){return}var r={};if(t.city){r.city=n.city}if(t.line1){r.line1=n.line1}if(t.line2){r.line2=n.line2}if(t.postal_code){r.postal_code=n.postal_code}if(t.state){r.state=n.state}if(t.name){r.name=n.name}return Object.keys(r).length?r:undefined};var P=function(e){var n=e.addressInvalidCharactersList,t=e.billingAddressInvalidCharactersList,r=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(r===null||r===void 0?void 0:r.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!n&&!t){return null}var d=r.value;var u=(o===null||o===void 0?void 0:o.value)||null;var l=_({firstName:d.firstName,lastName:d.lastName,name:d.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var m=_({firstName:u===null||u===void 0?void 0:u.firstName,lastName:u===null||u===void 0?void 0:u.lastName,name:(u===null||u===void 0?void 0:u.name)||""}),p=m.firstName,h=m.lastName;var w=p&&h?"".concat(p," ").concat(h):"";var g=d.address;var y=u===null||u===void 0?void 0:u.address;return{address:j({address:Object.assign(Object.assign({},g),{name:f}),invalidAdddressList:n}),billingAddress:!i?j({address:y?Object.assign(Object.assign({},y),{name:w}):null,invalidAdddressList:t}):undefined,destinationCountry:g.country}};var D=e("O",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var L=function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o;return __generator(this,(function(i){switch(i.label){case 0:if(!r.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",r.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),t=n.errors,o=n.json;return[2,{errors:t,json:o}]}}))}))};var x=e("A",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,L()];case 1:n=o.sent(),t=n.errors,r=n.json;if(t.length||!r){m("Failed to retrieve checkout session info before confirming payment ",t);void f({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:w}});return[2,{errorMessage:a("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=r.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){m("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:w}});return[2,{errorMessage:a('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 R=function(e){var t=e.theme;var r={".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(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var U=function(e){var n=e.borderStyle,t=e.theme;switch(t){case"DARK":return{borderRadius:y({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:y({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var z=t((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:{}}}})),B=z.onChange,F=z.reset,J=z.state;e({B:B,c:J});var M=function(e){var t=e.clientSecret,r=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=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":u&&g(u);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var m=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},R({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},U({borderStyle:r,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||undefined,customerSessionClientSecret:J.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],m,true),locale:o.selectedLocale}};var q=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var W=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var Y=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return p(e)}));var H=e("i",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){r=J.clientSecret;if(!J.stripe){h("Skip. Stripe is not initialized");return[2]}o=M({clientSecret:r,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(J.stripeElementsOptions);if(!J.stripeElements||!J.stripeElementsForBillingAddress){J.stripeElementsForBillingAddress=(n=J.stripe)===null||n===void 0?void 0:n.elements(o);h("Stripe elements for billing address initialized");J.stripeElements=(t=J.stripe)===null||t===void 0?void 0:t.elements(o);J.stripeElementsOptions=o;h("Stripe elements initialized");return[2]}if(!i){J.stripeElements.update(o);J.stripeElementsForBillingAddress.update(o);J.stripeElementsOptions=o;void J.stripeElements.fetchUpdates()}h("Stripe elements updated");return[2]}))}))}));var K=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");F();J.stripe=window.Zonos.stripe}));var G=function(){var e,n,t,r;var o=JSON.stringify((e=J.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!J.stripeShippingSameAsBilling&&JSON.stringify((t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=J.stripeBillingAddressUsedWhenValidatingAddress)===null||r===void 0?void 0:r.value);return o||i};var V=function(){var e,n,t,r,o,i;var a=JSON.stringify((e=J.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((t=J.stripeAddressUsedWhenAsyncAddressUpdate)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value);var d=!J.stripeShippingSameAsBilling&&JSON.stringify((o=J.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=J.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=J.taxIdUsedWhenAsyncAddressUpdate!==J.taxId;var l=J.companyNameUsedWhenAsyncAddressUpdate!==J.companyName;return a||s||d||u||l};var Z=e("C",(function(e){var n=e.address,t=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=_({firstName:t,lastName:o,name:i}),d=s.firstName,u=s.lastName;if(!d||!u){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,firstName:t,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:d,lastName:u,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}}));var Q=e("L",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,c,v,p;return __generator(this,(function(h){switch(h.label){case 0:if(!((e=J.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!J.stripeShippingSameAsBilling&&!((n=J.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!J.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Oe.landedCostData){return[2,{partiesCreated:false}]}i=(t=Oe.landedCostData.find(Boolean))===null||t===void 0?void 0:t.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId}});return[2,{partiesCreated:false}]}a=V();if(!a){return[2,{partiesCreated:false}]}s=Z({address:J.stripeAddressEventData.value.address,firstName:J.stripeAddressEventData.value.firstName,lastName:J.stripeAddressEventData.value.lastName,name:J.stripeAddressEventData.value.name,phone:J.stripeAddressEventData.value.phone});d=J.stripeShippingSameAsBilling?s:Z({address:J.stripeBillingAddressEventData.value.address,firstName:J.stripeBillingAddressEventData.value.firstName,lastName:J.stripeBillingAddressEventData.value.lastName,name:J.stripeBillingAddressEventData.value.name,phone:J.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:J.companyName,email:((o=J.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:J.taxId},method:"POST"})];case 1:c=h.sent(),v=c.errors,p=c.json;if(v.length||!p){m("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,errors:v,json:p}});return[2,{partiesCreated:false}]}J.companyNameUsedWhenAsyncAddressUpdate=J.companyName;J.stripeAddressUsedWhenAsyncAddressUpdate=J.stripeAddressEventData;J.stripeBillingAddressUsedWhenAsyncAddressUpdate=J.stripeBillingAddressEventData;J.taxIdUsedWhenAsyncAddressUpdate=J.taxId;J.partyBillingId=p.billToPartyId;J.partyShippingId=p.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var X=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var $=function(){var e,n;var t=JSON.stringify((e=J.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeLinkEventData)===null||n===void 0?void 0:n.value);var r=J.stripeAddressEventData&&JSON.stringify(X(J.stripeAddressEventData.value))!==JSON.stringify(J.stripeAddressUsedWhenFetchingLC);var o=!J.stripeShippingSameAsBilling&&J.stripeBillingAddressEventData&&JSON.stringify(X(J.stripeBillingAddressEventData.value))!==JSON.stringify(J.stripeBillingAddressUsedWhenFetchingLC);return t||r||o};var ee=function(){var e;var n=Oe.landedCostData&&((e=Oe.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Oe.subtotal;var t=$();h("isPrefetchInfoOutdated","info",{isAddressOutdated:t});return!Oe.landedCostData&&!J.isFetchingLandedCost||t||n};var ne=function(e){var t,r;var o=(t=n.genericSettings)===null||t===void 0?void 0:t.countryFields;var i=(r=n.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Oe.addressFormRenderType==="stripe"){return a||s}return s};var te=function(){var e,n,t,r;var o=!!((e=J.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=J.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=J.stripeShippingSameAsBilling?i:!!((t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete);var s=((r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)||"US";var d=ne(s);if(i&&a&&o){return true}if(!d||!J.stripeAddressEventData){return i&&a&&o}var u=J.stripeAddressEventData.value.address.line1.length>0;var l=J.stripeAddressEventData.value.firstName&&J.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&J.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&J.stripeAddressEventData.value.address.postal_code.length>=3;var f=J.stripeAddressEventData.value.phone&&J.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var re=function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;J.fetchingLandedCostAbortController=n;Be();return[4,E(n)];case 1:t=v.sent(),o=t.checkoutSessionWorkflow,i=t.errors,a=t.itemCreateWorkflow,s=t.landedCostCalculateWorkflow,d=t.partyCreateWorkflow,u=t.shipmentRatingCalculateWorkflow;Oe.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;Oe.shippingData=D((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ie(a);J.fetchingLandedCostAbortController=null;Oe.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];Oe.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=r.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void N({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Oe.promoCodeApplied&&!Oe.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"}))}));Oe.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Oe.promoCode)}return[2]}}))}))};var oe=e("q",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,u,l,c,v,p,h;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=ee();d=te();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=J.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();J.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){J.isFetchingLandedCost=false;setTimeout((function(){J.isFetchingLandedCost=true}),300)}else{J.isFetchingLandedCost=true}if(J.stripeAddressEventData){J.stripeAddressUsedWhenFetchingLC={countryCode:J.stripeAddressEventData.value.address.country,postalCode:J.stripeAddressEventData.value.address.postal_code,state:J.stripeAddressEventData.value.address.state}}if(J.stripeBillingAddressEventData){J.stripeBillingAddressUsedWhenFetchingLC={countryCode:J.stripeBillingAddressEventData.value.address.country,postalCode:J.stripeBillingAddressEventData.value.address.postal_code,state:J.stripeBillingAddressEventData.value.address.state}}if(J.stripeLinkEventData){J.stripeLinkUsedWhenFetchingLC=Object.assign({},J.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);Be();return[4,re()];case 2:w.sent();u=(t=Oe.shippingData)===null||t===void 0?void 0:t.find(Boolean);l=(r=Oe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Ne({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();Oe.landedCostData=[];Oe.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,oe(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:h=(o=J.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:h}});w.label=6;case 6:m(v);return[3,7];case 7:J.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var ie=e("F",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,oe({applyingPromocode:true})];case 1:o.sent();if(Oe.step==="payment"){Me()}return[4,Q()];case 2:o.sent();t=(e=Oe.shippingData)===null||e===void 0?void 0:e.find(Boolean);r=(n=Oe.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(t===null||t===void 0?void 0:t.id)}));if(!t||!r){return[2]}return[4,xe({applySubtotalsOnly:false,landedCostId:r.landedCostId,selectedShippingOption:t})];case 3:o.sent();return[2]}}))}))}));var ae=e("H",(function(){Oe.promoCode="";sessionStorage.removeItem("zonos--promo-code");Oe.promoCodeError=false;Oe.promoCodeApplied=false}));var se=e("G",(function(){return __awaiter(b,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Oe.step==="payment"){Me()}ae();return[4,ie()];case 1:e.sent();return[2]}}))}))}));var de=e("I",(function(e){var n=[];var t=true;var r=window.Zonos.isCollect;var o=window.Zonos.isInvoice;switch(e){case"succeeded":{n=[a("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."),"",a("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.")];if(r||o){n=[a("Thank you for submitting your payment. We appreciate your prompt attention."),"",a("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}t=false;break}case"requires_capture":case"processing":{n=[a("Payment processing. We'll update you when payment is received.")];t=false;break}case"requires_payment_method":{n=[a("Payment failed. Please try another payment method.")];if(r){n=[a("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{t=false;n=[a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[a("Something went wrong.")];break}}return{isError:t,messages:n}}));var ue=e("v",(function(){return __awaiter(b,void 0,void 0,(function(){var e,t,r,o,i,s,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:r=n.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.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:i=v.sent(),s=i.errors,d=i.json;if(s.length||!d){m("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!d.available||d.status===204){return[2,a("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){J.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,r({items:Oe.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:Oe.items}});throw c;case 6:return[2]}}))}))}));var le=e("x",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t;return __generator(this,(function(r){switch(r.label){case 0:t=!!((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||!t){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:r.sent();return[2]}}))}))}));var ce=e("d",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,o,i,s,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=de(v),t=n.isError,r=n.messages;return[2,{error:t,messages:r}]}o=c||J.clientSecret;if(!J.stripe||!o){m("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[a("Something went wrong.")]}]}return[4,J.stripe.retrievePaymentIntent(o)];case 1:i=e.sent().paymentIntent;s=i===null||i===void 0?void 0:i.status;d=de(s),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:s}]}}))}))}));var ve=e("w",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,o,i,s,d,u,l,c,v,f,m;return __generator(this,(function(p){switch(p.label){case 0:o=!!((n=J.stripePaymentEventData)===null||n===void 0?void 0:n.complete);i=J.stripeElements;s=J.stripe;d=J.clientSecret;J.customErrorMessage=null;if(!((t=Oe.selectedLandedCost)===null||t===void 0?void 0:t.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,x()];case 1:u=p.sent();if(!u.valid){J.customErrorMessage=u.errorMessage;throw new Error(u.errorMessage)}l=r.checkoutSessionId;if(!(s&&i&&o&&d&&l))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",d);c.searchParams.set("zonosCheckoutSessionId",l);void N({checkoutSessionId:l,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:c.toString()},elements:i,redirect:"if_required"})];case 2:v=p.sent(),f=v.error,m=v.paymentIntent;h("Payment intent confirmed","info",{error:f,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(a("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(m.status==="requires_payment_method"){throw new Error(a("Payment failed. Please try another payment method."))}p.label=3;case 3:return[2]}}))}))}));var fe=e("n",(function(){var e;var n=Oe.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var t=r.enabledVariantTestKeys||[];var i={adjustmentsAmount:Oe.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=Oe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Oe.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:J.skipPaymentIntent,varianceTestInput:t};return i}));var me=e("l",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i;return __generator(this,(function(s){switch(s.label){case 0:if(!r.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:w,cartId:window.Zonos.cartId}});Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:r.checkoutSessionId},method:"POST"})];case 1:n=s.sent(),t=n.errors,o=n.json;i=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(t.length||!i){m("Error occurs when getting payment intent",JSON.stringify(t,null,2));void f({endpoint:"Error creating payment intent",errors:t.map((function(e){return e.message})),metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,clientSecret:i}});Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2]}Pe(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var pe=e("k",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:if(!o.targetCurrency){m("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}J.isFetchingSession=true;t=fe();h("Checkout session body","info",t);return[4,l("/api/zonos-elements/create-checkout-session",{body:t,method:"POST"})];case 1:r=u.sent(),i=r.errors,a=r.json;J.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.")}m("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}d=a.checkoutSessionCreate;Pe(d);Ne({method:((n=d.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:d.subtotals});h("Exchange rate updated for cart items (checkout session create)","info",Oe.exchangeRate);h("done-init-checkout-session");return[2,true]}}))}))}));var he=e("u",(function(){return __awaiter(b,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(i){switch(i.label){case 0:e=r.checkoutSessionId;if(!e){m("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){h('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:J.checkoutSettlementCurrency},method:"POST"})];case 1:t=i.sent().json;o=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||o!==J.checkoutSettlementCurrency){m("Failed to update checkout session base currency");return[2,false]}h('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var we=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,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=r.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:J.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:Oe.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:p,shipToPartyId:J.partyShippingId,skipPaymentIntent:J.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:t=e.sent(),i=t.errors,a=t.json;if(i.length||!a){m("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var ge=function(e){var n,t,r,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,m=d.postal_code,p=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(t={},t[s.line1]=c,t)}if(s.line2&&v){u.line2=(r={},r[s.line2]=v,r)}if(s.postal_code&&m){u.postal_code=(o={},o[s.postal_code]=m,o)}if(s.state&&p){u.state=(i={},i[s.state]=p,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var ye=e("J",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,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=P({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:p,stripeAddressEventData:J.stripeAddressEventData,stripeBillingAddressEventData:J.stripeBillingAddressEventData,stripeShippingSameAsBilling:J.stripeShippingSameAsBilling});if(!i){J.translatedAddress={address:{},billingAddress:{}};return[2]}a=G();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){m("Error occurs when translating address to latin",JSON.stringify(d,null,2));J.translatedAddress={address:{},billingAddress:{}};return[2]}J.stripeAddressUsedWhenValidatingAddress=J.stripeAddressEventData;J.stripeBillingAddressUsedWhenValidatingAddress=J.stripeBillingAddressEventData;c=(n=J.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value.address;J.translatedAddress={address:c?ge({currentAddress:Object.assign(Object.assign({},c),{name:(r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!J.stripeShippingSameAsBilling?ge({currentAddress:Object.assign(Object.assign({},v),{name:(o=J.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));B("clientSecret",(function(e){if(e&&J.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var be=t((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}})),_e=be.onChange,Se=be.reset,Oe=be.state;e({z:_e,e:Oe});var Ce=function(e){switch(e){case"DAYS":return a("days");case"WEEKS":return a("weeks");case"BUSINESS_DAYS":default:return a("business days")}};var ke=e("M",(function(e){var n;var t=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(t===null||t===void 0?void 0:t.min)||!(t===null||t===void 0?void 0:t.max)||!(t===null||t===void 0?void 0:t.type)){return null}return{maxTransit:t.max,minTransit:t.min,unit:Ce(t.type)}}));var Ae=function(e){var n=e.item1,t=e.item2;if(!n||!t){return false}return t.sku&&n.sku&&n.sku===t.sku||t.description&&n.description&&n.description===t.description||n.name&&t.name&&n.name===t.name};var Ie=function(e){h("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var t=Oe.items.find((function(n){return Ae({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:t},e),{restriction:n})})).filter(Boolean);Oe.restrictedItems=n;Oe.items=Oe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return Ae({item1:n,item2:e})}))})}));return{cartItems:Oe.items,restrictedItems:n}};var Te=e("g",(function(){r.checkoutSessionId=null;Se()}));var Ee=e("o",(function(e){var n=e.messages,t=e.title;Te();K();Oe.step="error";Oe.error={messages:n,title:t}}));var Ne=function(e){var n=e.dutiesTaxesFeesEstimate,t=e.method,r=e.subtotals;Oe.exchangeRate=r.exchangeRate;Oe.adjustmentTotal=r.adjustments;Oe.dutiesTaxesFees=t==="DAP"?null:r.landedCostTotal;Oe.subtotal=r.items;Oe.total=r.total;Oe.currency=r.presentmentCurrencyCode;Oe.dutiesTaxesFeesEstimate=n||null};var je=e("E",(function(){var e=Oe.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var Pe=e("p",(function(e){var n,t,o,i,a;J.clientSecret=e.clientSecret;J.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;J.customerProfile=e.customerProfile;Oe.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:w,checkoutSession:e}})}if(e.id){r.checkoutSessionId=e.id}var u=s(e.varianceTestResults||[]);d(u);var l=((o=(t=(n=Oe.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||t===void 0?void 0:t.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((a=(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||a===void 0?void 0:a.value)||null;if(l){h("Found externalConfirmationPageURL: ".concat(l));Oe.externalConfirmationPageURL=l}}));var De=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,i,s,d,u;var l=e.adjustmentsAmount,c=e.cartId,v=e.currency,f=e.dutiesTaxesFeesEstimate,p=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Oe.selectedLandedCost){t=Oe.selectedLandedCost.subtotals;Ne({dutiesTaxesFeesEstimate:f,method:Oe.landedCostMethod,subtotals:t});h("Exchange rate updated for cart items (landed cost subtotal)","info",Oe.exchangeRate)}if(!r.checkoutSessionId){h("Could not update cart total without checkout session id","info");return[2,false]}return[4,we({adjustmentsAmount:l,billToPartyId:J.partyBillingId,cartId:c,currency:v,id:r.checkoutSessionId,itemsAmount:p,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:J.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:i=e.sent(),s=i.errors,d=i.json;if(!(s.length>0||!d))return[3,4];m("Error occurs when updating checkout session.");if(!g)return[3,3];h("Initiating checkout session on failure","info");return[4,pe()];case 2:u=e.sent();h("stripeStoreInitCheckoutSession: ".concat(u));if(!u){Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Ne({method:((n=d.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:d.checkoutSessionUpdate.subtotals});h("Exchange rate updated for cart items (checkout session update)","info",Oe.exchangeRate)}Pe(d.checkoutSessionUpdate);return[2,true]}}))}))};var Le=e("N",(function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=J.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var xe=e("D",(function(e){return __awaiter(b,[e],void 0,(function(e){var t,o,i,a,s,d,u,l,c,v,f,m,p,w,g,y,b,_,S,O,C,k,A,I,T;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:h("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Oe.selectedShippingOption=j;m=ke(Oe.selectedShippingOption);if(m){p=m.maxTransit,w=m.minTransit,g=m.unit;Oe.selectedShippingOptionTransitTime="".concat(w,"-").concat(p," ").concat(g)}else{Oe.selectedShippingOptionTransitTime=""}y=(t=Oe.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===N}));Oe.selectedLandedCost=y||null;if(!y){return[2,false]}b=((o=y.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;_=y.subtotals.exchangeRate.rate;S=b*_;if(S){h("DAP quote, using estimate: ".concat(S),"info")}Oe.landedCostMethod=Le(y.landedCost);Oe.shipping=y.subtotals.shipping;O=((i=y===null||y===void 0?void 0:y.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";C=!!((s=(a=y===null||y===void 0?void 0:y.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Oe.isSelectedShippingAboveDeminimis=C;Oe.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];A=y.subtotals;Ne({dutiesTaxesFeesEstimate:S,method:Oe.landedCostMethod,subtotals:A});h("Exchange rate updated for cart items (landed cost subtotal)","info",Oe.exchangeRate);k=true;return[3,3];case 1:return[4,De({adjustmentsAmount:Oe.adjustmentTotal,billToPartyId:J.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(d=y.landedCost)===null||d===void 0?void 0:d.id,shipToPartyId:J.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:I=(u=Oe.items.find(Boolean))===null||u===void 0?void 0:u.currencyCode;T=((l=J.stripeAddressEventData)===null||l===void 0?void 0:l.value.address.country)||"US";J.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((c=Oe.checkoutSession)===null||c===void 0?void 0:c.subtotals.presentmentCurrencyCode)!=="USD"&&!!((f=(v=n.genericSettings)===null||v===void 0?void 0:v.usdSettlementCountryEnabled)===null||f===void 0?void 0:f.includes(T));return[2,k]}}))}))}));var Re=e("m",(function(e){var n=e.isPreview,t=e.sessionTimeout;if(n){return}var r=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=r&&!isNaN(parseInt(r,10))?parseInt(r,10):t;h("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Oe.checkoutTimeoutInterval=setTimeout((function(){Oe.checkoutSessionTimeoutShow=true}),o)}));var Ue=e("j",(function(){if(Oe.checkoutTimeoutInterval){clearTimeout(Oe.checkoutTimeoutInterval);Oe.checkoutTimeoutInterval=null}}));var ze=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var Be=function(){Oe.items=Oe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Oe.restrictedItems=[]};var Fe=e("f",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,o,i;var a=e.adjustments,s=e.cartItems,d=e.landedCostId,u=e.shouldInitSessionOnFailure,l=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:Oe.adjustments=a;Oe.items=ze(s);t=(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(!t||!o){return[2]}Oe.currency=t;J.isFetchingSession=true;return[4,De({adjustmentsAmount:i,billToPartyId:J.partyBillingId,cartId:window.Zonos.cartId,currency:t,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:d,shipToPartyId:J.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:e.sent();J.isFetchingSession=false;return[2]}}))}))}));var Je=function(){Oe.selectedShippingOption=null;Oe.isSelectedShippingAboveDeminimis=false;Oe.isSelectedShippingGuarantee=false;Oe.selectedShippingOptionTransitTime="";Oe.dutiesTaxesFees=0;Oe.dutiesTaxesFeesEstimate=0;Oe.shipping=0;Oe.total=Oe.subtotal};var Me=function(){if(Oe.step==="shipping"){Oe.step="customer-info";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})})}else if(Oe.step==="payment"){Oe.step="shipping";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})})}else if(Oe.step==="finish"){Oe.step="payment";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{payment:Object.assign(Object.assign({},Oe.tabItems.payment),{isDone:false})})}};var qe=e("r",(function(){if(Oe.step==="customer-info"){Oe.step="shipping";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems["customer-info"]),{isDone:true})})}else if(Oe.step==="shipping"){Oe.step="payment";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:true})})}else if(Oe.step==="payment"){Oe.step="finish"}}));var We=e("h",(function(){Oe.step="customer-info";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Oe.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})});Je()}))}}}));
|
|
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 a(e){try{d(r.next(e))}catch(e){i(e)}}function s(e){try{d(r["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):o(e.value).then(a,s)}d((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,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(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(r=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:t.label++;return{value:s[1],done:false};case 5:t.label++;o=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];o=0}finally{r=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,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-d45285aa.system.js","./p-3b598f1d.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-909e2bc3.system.js","./p-23d497e3.system.js"],(function(e){"use strict";var n,t,r,o,i,a,s,d,u,l,c,v,f,m,p,h,w,g,y;return{setters:[function(e){n=e.z;t=e.c},function(e){r=e.s;o=e.l;i=e.e;a=e.t;s=e.f;d=e.b},function(e){u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;m=e.l;p=e.j},function(e){h=e.l;w=e.b},function(e){g=e.i},function(e){y=e.g}],execute:function(){var b=this;var _=e("K",(function(e){var n=e.firstName,t=e.lastName,r=e.name;var o;if(!r&&!n&&!t){return{firstName:"",lastName:""}}var i=(r===null||r===void 0?void 0:r.split(/\s+/))||[];var a=(n===null||n===void 0?void 0:n.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(t===null||t===void 0?void 0:t.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var S=function(e){var n=e.currentAddress,t=e.translatedAddress;var r,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,m=u.postal_code,p=u.state;var h=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((r=t.city)===null||r===void 0?void 0:r[l])||l,country:c,line1:((o=t.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=t.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=t.name)===null||a===void 0?void 0:a[h])||h,phone:n.value.phone||"",postal_code:((s=t.postal_code)===null||s===void 0?void 0:s[m])||m,state:((d=t.state)===null||d===void 0?void 0:d[p])||p}};var O=function(e){var n;var t=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var a=J.stripeLinkEventData;var s=J.stripeAddressEventData;var d=J.stripeShippingSameAsBilling?J.stripeAddressEventData:J.stripeBillingAddressEventData;if(!s||!d){throw new Error("Missing stripe address data")}var u=S({currentAddress:s,translatedAddress:J.translatedAddress.address});var l=_({name:u.name}),c=l.firstName,v=l.lastName;var f=S({currentAddress:d,translatedAddress:J.translatedAddress.address});var m=_({name:f.name}),p=m.firstName,h=m.lastName;var w=i()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:p,lastName:h,phone:f.phone},cartCurrencyCode:(n=Oe.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionCountry:w||o.selectedCountryCode||undefined,checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:J.companyName,email:a===null||a===void 0?void 0:a.value.email,firstName:c,lastName:v,phone:u.phone},isTest:!!t,landedCostAdjustments:Oe.promoCode?[{amount:0,productId:null,promoCode:Oe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:J.taxId,shippingAddress:{addressLine1:u.line1,addressLine2:u.line2,city:u.city,country:u.country,postalCode:u.postal_code,state:u.state}}};var C=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=J.stripeLinkEventData;var t=J.stripeAddressEventData;var o=J.stripeShippingSameAsBilling?J.stripeAddressEventData:J.stripeBillingAddressEventData;h({stripeAddressData:t,stripeBillingAddressData:o},"info");if(!t||!o){throw new Error("Missing stripe address data")}var i=S({currentAddress:t,translatedAddress:J.translatedAddress.address});var a=_({name:i.name}),s=a.firstName,d=a.lastName;var u=S({currentAddress:o,translatedAddress:J.translatedAddress.address});var l=_({name:u.name}),c=l.firstName,v=l.lastName;var f=Oe.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Oe.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Oe.promoCode,sku:null,type:"PROMO_CODE"}],f,true):f;return{billingAddress:{addressLine1:u.line1,addressLine2:u.line2||"",city:u.city,country:u.country,postalCode:u.postal_code,state:u.state},billingContact:{firstName:c,lastName:v,phone:u.phone},checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:J.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:s,lastName:d,phone:i.phone},isTest:e,items:Oe.items,landedCostAdjustments:m,shipToTaxId:J.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var k=function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=C();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)&&((t=s.errors)===null||t===void 0?void 0:t.length)){throw new Error("Failed to build landed cost: ".concat(((o=(r=s===null||s===void 0?void 0:s.errors)===null||r===void 0?void 0:r[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 A=function(e){return __awaiter(b,void 0,void 0,(function(){var t,r,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:r=n.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,k(r)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:C(),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=((t=a[0])===null||t===void 0?void 0:t.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 I=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:O(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){u=typeof((n=s[0])===null||n===void 0?void 0:n.message)==="string"&&(((t=s[0])===null||t===void 0?void 0:t.message)==="The user aborted a request."||((r=s[0])===null||r===void 0?void 0:r.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));c=u?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(c)}return[2,d]}}))}))};var T=undefined&&undefined.__rest||function(e,n){var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0)t[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++){if(n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o]))t[r[o]]=e[r[o]]}return t};var E=function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,A(e)];case 1:t=a.sent();return[2,t];case 2:return[4,I({abortController:e,cartId:n})];case 3:r=a.sent(),o=r.cartWorkflow,i=T(r,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var N=e("t",(function(e){return __awaiter(b,[e],void 0,(function(e){var t,r,i,a,s,d,u,m,p;var h=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:h,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;m=n.organizationId;if(!h){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:w,checkoutSessionId:h,eventName:g,metadata:y,organizationId:m,trackEventLogs:a}});return[2]}if(!m){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:w,checkoutSessionId:h,eventName:g,metadata:y,organizationId:m,trackEventLogs:a}})}p={checkoutSessionId:h,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:m};return[4,l("/api/zonos-elements/track-conversion-event",{body:p,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var j=function(e){var n=e.address,t=e.invalidAdddressList;if(!n){return}if(!t){return}var r={};if(t.city){r.city=n.city}if(t.line1){r.line1=n.line1}if(t.line2){r.line2=n.line2}if(t.postal_code){r.postal_code=n.postal_code}if(t.state){r.state=n.state}if(t.name){r.name=n.name}return Object.keys(r).length?r:undefined};var P=function(e){var n=e.addressInvalidCharactersList,t=e.billingAddressInvalidCharactersList,r=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(r===null||r===void 0?void 0:r.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!n&&!t){return null}var d=r.value;var u=(o===null||o===void 0?void 0:o.value)||null;var l=_({firstName:d.firstName,lastName:d.lastName,name:d.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var m=_({firstName:u===null||u===void 0?void 0:u.firstName,lastName:u===null||u===void 0?void 0:u.lastName,name:(u===null||u===void 0?void 0:u.name)||""}),p=m.firstName,h=m.lastName;var w=p&&h?"".concat(p," ").concat(h):"";var g=d.address;var y=u===null||u===void 0?void 0:u.address;return{address:j({address:Object.assign(Object.assign({},g),{name:f}),invalidAdddressList:n}),billingAddress:!i?j({address:y?Object.assign(Object.assign({},y),{name:w}):null,invalidAdddressList:t}):undefined,destinationCountry:g.country}};var D=e("O",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var L=function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o;return __generator(this,(function(i){switch(i.label){case 0:if(!r.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",r.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),t=n.errors,o=n.json;return[2,{errors:t,json:o}]}}))}))};var x=e("A",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,L()];case 1:n=o.sent(),t=n.errors,r=n.json;if(t.length||!r){m("Failed to retrieve checkout session info before confirming payment ",t);void f({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:w}});return[2,{errorMessage:a("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=r.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){m("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:w}});return[2,{errorMessage:a('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 R=function(e){var t=e.theme;var r={".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(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var U=function(e){var n=e.borderStyle,t=e.theme;switch(t){case"DARK":return{borderRadius:y({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:y({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var z=t((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:{}}}})),B=z.onChange,F=z.reset,J=z.state;e({B:B,c:J});var M=function(e){var t=e.clientSecret,r=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=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":u&&g(u);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var m=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},R({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},U({borderStyle:r,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||undefined,customerSessionClientSecret:J.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],m,true),locale:o.selectedLocale}};var q=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var W=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var Y=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return p(e)}));var H=e("i",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){r=J.clientSecret;if(!J.stripe){h("Skip. Stripe is not initialized");return[2]}o=M({clientSecret:r,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(J.stripeElementsOptions);if(!J.stripeElements||!J.stripeElementsForBillingAddress){J.stripeElementsForBillingAddress=(n=J.stripe)===null||n===void 0?void 0:n.elements(o);h("Stripe elements for billing address initialized");J.stripeElements=(t=J.stripe)===null||t===void 0?void 0:t.elements(o);J.stripeElementsOptions=o;h("Stripe elements initialized");return[2]}if(!i){J.stripeElements.update(o);J.stripeElementsForBillingAddress.update(o);J.stripeElementsOptions=o;void J.stripeElements.fetchUpdates()}h("Stripe elements updated");return[2]}))}))}));var K=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");F();J.stripe=window.Zonos.stripe}));var G=function(){var e,n,t,r;var o=JSON.stringify((e=J.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!J.stripeShippingSameAsBilling&&JSON.stringify((t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=J.stripeBillingAddressUsedWhenValidatingAddress)===null||r===void 0?void 0:r.value);return o||i};var V=function(){var e,n,t,r,o,i;var a=JSON.stringify((e=J.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((t=J.stripeAddressUsedWhenAsyncAddressUpdate)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value);var d=!J.stripeShippingSameAsBilling&&JSON.stringify((o=J.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=J.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=J.taxIdUsedWhenAsyncAddressUpdate!==J.taxId;var l=J.companyNameUsedWhenAsyncAddressUpdate!==J.companyName;return a||s||d||u||l};var Z=e("C",(function(e){var n=e.address,t=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=_({firstName:t,lastName:o,name:i}),d=s.firstName,u=s.lastName;if(!d||!u){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,firstName:t,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:d,lastName:u,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}}));var Q=e("L",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,c,v,p;return __generator(this,(function(h){switch(h.label){case 0:if(!((e=J.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!J.stripeShippingSameAsBilling&&!((n=J.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!J.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Oe.landedCostData){return[2,{partiesCreated:false}]}i=(t=Oe.landedCostData.find(Boolean))===null||t===void 0?void 0:t.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId}});return[2,{partiesCreated:false}]}a=V();if(!a){return[2,{partiesCreated:false}]}s=Z({address:J.stripeAddressEventData.value.address,firstName:J.stripeAddressEventData.value.firstName,lastName:J.stripeAddressEventData.value.lastName,name:J.stripeAddressEventData.value.name,phone:J.stripeAddressEventData.value.phone});d=J.stripeShippingSameAsBilling?s:Z({address:J.stripeBillingAddressEventData.value.address,firstName:J.stripeBillingAddressEventData.value.firstName,lastName:J.stripeBillingAddressEventData.value.lastName,name:J.stripeBillingAddressEventData.value.name,phone:J.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:J.companyName,email:((o=J.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:J.taxId},method:"POST"})];case 1:c=h.sent(),v=c.errors,p=c.json;if(v.length||!p){m("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,errors:v,json:p}});return[2,{partiesCreated:false}]}J.companyNameUsedWhenAsyncAddressUpdate=J.companyName;J.stripeAddressUsedWhenAsyncAddressUpdate=J.stripeAddressEventData;J.stripeBillingAddressUsedWhenAsyncAddressUpdate=J.stripeBillingAddressEventData;J.taxIdUsedWhenAsyncAddressUpdate=J.taxId;J.partyBillingId=p.billToPartyId;J.partyShippingId=p.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var X=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var $=function(){var e,n;var t=JSON.stringify((e=J.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=J.stripeLinkEventData)===null||n===void 0?void 0:n.value);var r=J.stripeAddressEventData&&JSON.stringify(X(J.stripeAddressEventData.value))!==JSON.stringify(J.stripeAddressUsedWhenFetchingLC);var o=!J.stripeShippingSameAsBilling&&J.stripeBillingAddressEventData&&JSON.stringify(X(J.stripeBillingAddressEventData.value))!==JSON.stringify(J.stripeBillingAddressUsedWhenFetchingLC);return t||r||o};var ee=function(){var e;var n=Oe.landedCostData&&((e=Oe.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Oe.subtotal;var t=$();h("isPrefetchInfoOutdated","info",{isAddressOutdated:t});return!Oe.landedCostData&&!J.isFetchingLandedCost||t||n};var ne=function(e){var t,r;var o=(t=n.genericSettings)===null||t===void 0?void 0:t.countryFields;var i=(r=n.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Oe.addressFormRenderType==="stripe"){return a||s}return s};var te=function(){var e,n,t,r;var o=!!((e=J.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=J.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=J.stripeShippingSameAsBilling?i:!!((t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete);var s=((r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)||"US";var d=ne(s);if(i&&a&&o){return true}if(!d||!J.stripeAddressEventData){return i&&a&&o}var u=J.stripeAddressEventData.value.address.line1.length>0;var l=J.stripeAddressEventData.value.firstName&&J.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&J.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&J.stripeAddressEventData.value.address.postal_code.length>=3;var f=J.stripeAddressEventData.value.phone&&J.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var re=function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;J.fetchingLandedCostAbortController=n;Be();return[4,E(n)];case 1:t=v.sent(),o=t.checkoutSessionWorkflow,i=t.errors,a=t.itemCreateWorkflow,s=t.landedCostCalculateWorkflow,d=t.partyCreateWorkflow,u=t.shipmentRatingCalculateWorkflow;Oe.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;Oe.shippingData=D((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ie(a);J.fetchingLandedCostAbortController=null;Oe.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];Oe.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=r.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void N({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Oe.promoCodeApplied&&!Oe.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"}))}));Oe.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Oe.promoCode)}return[2]}}))}))};var oe=e("q",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,u,l,c,v,p,h;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=ee();d=te();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=J.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();J.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){J.isFetchingLandedCost=false;setTimeout((function(){J.isFetchingLandedCost=true}),300)}else{J.isFetchingLandedCost=true}if(J.stripeAddressEventData){J.stripeAddressUsedWhenFetchingLC={countryCode:J.stripeAddressEventData.value.address.country,postalCode:J.stripeAddressEventData.value.address.postal_code,state:J.stripeAddressEventData.value.address.state}}if(J.stripeBillingAddressEventData){J.stripeBillingAddressUsedWhenFetchingLC={countryCode:J.stripeBillingAddressEventData.value.address.country,postalCode:J.stripeBillingAddressEventData.value.address.postal_code,state:J.stripeBillingAddressEventData.value.address.state}}if(J.stripeLinkEventData){J.stripeLinkUsedWhenFetchingLC=Object.assign({},J.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);Be();return[4,re()];case 2:w.sent();u=(t=Oe.shippingData)===null||t===void 0?void 0:t.find(Boolean);l=(r=Oe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Ne({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();Oe.landedCostData=[];Oe.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,oe(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:h=(o=J.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:h}});w.label=6;case 6:m(v);return[3,7];case 7:J.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var ie=e("F",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,oe({applyingPromocode:true})];case 1:o.sent();if(Oe.step==="payment"){Me()}return[4,Q()];case 2:o.sent();t=(e=Oe.shippingData)===null||e===void 0?void 0:e.find(Boolean);r=(n=Oe.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(t===null||t===void 0?void 0:t.id)}));if(!t||!r){return[2]}return[4,xe({applySubtotalsOnly:false,landedCostId:r.landedCostId,selectedShippingOption:t})];case 3:o.sent();return[2]}}))}))}));var ae=e("H",(function(){Oe.promoCode="";sessionStorage.removeItem("zonos--promo-code");Oe.promoCodeError=false;Oe.promoCodeApplied=false}));var se=e("G",(function(){return __awaiter(b,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Oe.step==="payment"){Me()}ae();return[4,ie()];case 1:e.sent();return[2]}}))}))}));var de=e("I",(function(e){var n=[];var t=true;var r=window.Zonos.isCollect;var o=window.Zonos.isInvoice;switch(e){case"succeeded":{n=[a("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."),"",a("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.")];if(r||o){n=[a("Thank you for submitting your payment. We appreciate your prompt attention."),"",a("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}t=false;break}case"requires_capture":case"processing":{n=[a("Payment processing. We'll update you when payment is received.")];t=false;break}case"requires_payment_method":{n=[a("Payment failed. Please try another payment method.")];if(r){n=[a("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{t=false;n=[a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[a("Something went wrong.")];break}}return{isError:t,messages:n}}));var ue=e("v",(function(){return __awaiter(b,void 0,void 0,(function(){var e,t,r,o,i,s,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:r=n.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.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:i=v.sent(),s=i.errors,d=i.json;if(s.length||!d){m("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!d.available||d.status===204){return[2,a("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){J.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,r({items:Oe.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:Oe.items}});throw c;case 6:return[2]}}))}))}));var le=e("x",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t;return __generator(this,(function(r){switch(r.label){case 0:t=!!((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||!t){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:r.sent();return[2]}}))}))}));var ce=e("d",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,o,i,s,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=de(v),t=n.isError,r=n.messages;return[2,{error:t,messages:r}]}o=c||J.clientSecret;if(!J.stripe||!o){m("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[a("Something went wrong.")]}]}return[4,J.stripe.retrievePaymentIntent(o)];case 1:i=e.sent().paymentIntent;s=i===null||i===void 0?void 0:i.status;d=de(s),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:s}]}}))}))}));var ve=e("w",(function(e){return __awaiter(b,void 0,void 0,(function(){var n,t,o,i,s,d,u,l,c,v,f,m;return __generator(this,(function(p){switch(p.label){case 0:o=!!((n=J.stripePaymentEventData)===null||n===void 0?void 0:n.complete);i=J.stripeElements;s=J.stripe;d=J.clientSecret;J.customErrorMessage=null;if(!((t=Oe.selectedLandedCost)===null||t===void 0?void 0:t.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,x()];case 1:u=p.sent();if(!u.valid){J.customErrorMessage=u.errorMessage;throw new Error(u.errorMessage)}l=r.checkoutSessionId;if(!(s&&i&&o&&d&&l))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",d);c.searchParams.set("zonosCheckoutSessionId",l);void N({checkoutSessionId:l,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:c.toString()},elements:i,redirect:"if_required"})];case 2:v=p.sent(),f=v.error,m=v.paymentIntent;h("Payment intent confirmed","info",{error:f,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(a("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(m.status==="requires_payment_method"){throw new Error(a("Payment failed. Please try another payment method."))}p.label=3;case 3:return[2]}}))}))}));var fe=e("n",(function(){var e;var n=Oe.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var t=r.enabledVariantTestKeys||[];var i={adjustmentsAmount:Oe.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=Oe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Oe.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:J.skipPaymentIntent,varianceTestInput:t};return i}));var me=e("l",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,o,i;return __generator(this,(function(s){switch(s.label){case 0:if(!r.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:w,cartId:window.Zonos.cartId}});Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:r.checkoutSessionId},method:"POST"})];case 1:n=s.sent(),t=n.errors,o=n.json;i=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(t.length||!i){m("Error occurs when getting payment intent",JSON.stringify(t,null,2));void f({endpoint:"Error creating payment intent",errors:t.map((function(e){return e.message})),metadata:{allLogs:w,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,clientSecret:i}});Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2]}Pe(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var pe=e("k",(function(){return __awaiter(b,void 0,void 0,(function(){var e,n,t,r,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:if(!o.targetCurrency){m("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}J.isFetchingSession=true;t=fe();h("Checkout session body","info",t);return[4,l("/api/zonos-elements/create-checkout-session",{body:t,method:"POST"})];case 1:r=u.sent(),i=r.errors,a=r.json;J.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.")}m("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}d=a.checkoutSessionCreate;Pe(d);Ne({method:((n=d.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:d.subtotals});h("Exchange rate updated for cart items (checkout session create)","info",Oe.exchangeRate);h("done-init-checkout-session");return[2,true]}}))}))}));var he=e("u",(function(){return __awaiter(b,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(i){switch(i.label){case 0:e=r.checkoutSessionId;if(!e){m("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){h('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:J.checkoutSettlementCurrency},method:"POST"})];case 1:t=i.sent().json;o=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||o!==J.checkoutSettlementCurrency){m("Failed to update checkout session base currency");return[2,false]}h('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var we=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,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=r.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:J.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:Oe.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:p,shipToPartyId:J.partyShippingId,skipPaymentIntent:J.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:t=e.sent(),i=t.errors,a=t.json;if(i.length||!a){m("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var ge=function(e){var n,t,r,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,m=d.postal_code,p=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(t={},t[s.line1]=c,t)}if(s.line2&&v){u.line2=(r={},r[s.line2]=v,r)}if(s.postal_code&&m){u.postal_code=(o={},o[s.postal_code]=m,o)}if(s.state&&p){u.state=(i={},i[s.state]=p,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var ye=e("J",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,r,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=P({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:p,stripeAddressEventData:J.stripeAddressEventData,stripeBillingAddressEventData:J.stripeBillingAddressEventData,stripeShippingSameAsBilling:J.stripeShippingSameAsBilling});if(!i){J.translatedAddress={address:{},billingAddress:{}};return[2]}a=G();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){m("Error occurs when translating address to latin",JSON.stringify(d,null,2));J.translatedAddress={address:{},billingAddress:{}};return[2]}J.stripeAddressUsedWhenValidatingAddress=J.stripeAddressEventData;J.stripeBillingAddressUsedWhenValidatingAddress=J.stripeBillingAddressEventData;c=(n=J.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(t=J.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value.address;J.translatedAddress={address:c?ge({currentAddress:Object.assign(Object.assign({},c),{name:(r=J.stripeAddressEventData)===null||r===void 0?void 0:r.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!J.stripeShippingSameAsBilling?ge({currentAddress:Object.assign(Object.assign({},v),{name:(o=J.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));B("clientSecret",(function(e){if(e&&J.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var be=t((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}})),_e=be.onChange,Se=be.reset,Oe=be.state;e({z:_e,e:Oe});var Ce=function(e){switch(e){case"DAYS":return a("days");case"WEEKS":return a("weeks");case"BUSINESS_DAYS":default:return a("business days")}};var ke=e("M",(function(e){var n;var t=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(t===null||t===void 0?void 0:t.min)||!(t===null||t===void 0?void 0:t.max)||!(t===null||t===void 0?void 0:t.type)){return null}return{maxTransit:t.max,minTransit:t.min,unit:Ce(t.type)}}));var Ae=function(e){var n=e.item1,t=e.item2;if(!n||!t){return false}return t.sku&&n.sku&&n.sku===t.sku||t.description&&n.description&&n.description===t.description||n.name&&t.name&&n.name===t.name};var Ie=function(e){h("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var t=Oe.items.find((function(n){return Ae({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:t},e),{restriction:n})})).filter(Boolean);Oe.restrictedItems=n;Oe.items=Oe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return Ae({item1:n,item2:e})}))})}));return{cartItems:Oe.items,restrictedItems:n}};var Te=e("g",(function(){r.checkoutSessionId=null;Se()}));var Ee=e("o",(function(e){var n=e.messages,t=e.title;Te();K();Oe.step="error";Oe.error={messages:n,title:t}}));var Ne=function(e){var n=e.dutiesTaxesFeesEstimate,t=e.method,r=e.subtotals;Oe.exchangeRate=r.exchangeRate;Oe.adjustmentTotal=r.adjustments;Oe.dutiesTaxesFees=t==="DAP"?null:r.landedCostTotal;Oe.subtotal=r.items;Oe.total=r.total;Oe.currency=r.presentmentCurrencyCode;Oe.dutiesTaxesFeesEstimate=n||null};var je=e("E",(function(){var e=Oe.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var Pe=e("p",(function(e){var n,t,o,i,a;J.clientSecret=e.clientSecret;J.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;J.customerProfile=e.customerProfile;Oe.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:w,checkoutSession:e}})}if(e.id){r.checkoutSessionId=e.id}var u=s(e.varianceTestResults||[]);d(u);var l=((o=(t=(n=Oe.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||t===void 0?void 0:t.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((a=(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||a===void 0?void 0:a.value)||null;if(l){h("Found externalConfirmationPageURL: ".concat(l));Oe.externalConfirmationPageURL=l}}));var De=function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,i,s,d,u;var l=e.adjustmentsAmount,c=e.cartId,v=e.currency,f=e.dutiesTaxesFeesEstimate,p=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Oe.selectedLandedCost){t=Oe.selectedLandedCost.subtotals;Ne({dutiesTaxesFeesEstimate:f,method:Oe.landedCostMethod,subtotals:t});h("Exchange rate updated for cart items (landed cost subtotal)","info",Oe.exchangeRate)}if(!r.checkoutSessionId){h("Could not update cart total without checkout session id","info");return[2,false]}return[4,we({adjustmentsAmount:l,billToPartyId:J.partyBillingId,cartId:c,currency:v,id:r.checkoutSessionId,itemsAmount:p,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:J.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:i=e.sent(),s=i.errors,d=i.json;if(!(s.length>0||!d))return[3,4];m("Error occurs when updating checkout session.");if(!g)return[3,3];h("Initiating checkout session on failure","info");return[4,pe()];case 2:u=e.sent();h("stripeStoreInitCheckoutSession: ".concat(u));if(!u){Ee({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Ne({method:((n=d.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:d.checkoutSessionUpdate.subtotals});h("Exchange rate updated for cart items (checkout session update)","info",Oe.exchangeRate)}Pe(d.checkoutSessionUpdate);return[2,true]}}))}))};var Le=e("N",(function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=J.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var xe=e("D",(function(e){return __awaiter(b,[e],void 0,(function(e){var t,o,i,a,s,d,u,l,c,v,f,m,p,w,g,y,b,_,S,O,C,k,A,I,T;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:h("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Oe.selectedShippingOption=j;m=ke(Oe.selectedShippingOption);if(m){p=m.maxTransit,w=m.minTransit,g=m.unit;Oe.selectedShippingOptionTransitTime="".concat(w,"-").concat(p," ").concat(g)}else{Oe.selectedShippingOptionTransitTime=""}y=(t=Oe.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===N}));Oe.selectedLandedCost=y||null;if(!y){return[2,false]}b=((o=y.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;_=y.subtotals.exchangeRate.rate;S=b*_;if(S){h("DAP quote, using estimate: ".concat(S),"info")}Oe.landedCostMethod=Le(y.landedCost);Oe.shipping=y.subtotals.shipping;O=((i=y===null||y===void 0?void 0:y.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";C=!!((s=(a=y===null||y===void 0?void 0:y.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Oe.isSelectedShippingAboveDeminimis=C;Oe.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];A=y.subtotals;Ne({dutiesTaxesFeesEstimate:S,method:Oe.landedCostMethod,subtotals:A});h("Exchange rate updated for cart items (landed cost subtotal)","info",Oe.exchangeRate);k=true;return[3,3];case 1:return[4,De({adjustmentsAmount:Oe.adjustmentTotal,billToPartyId:J.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(d=y.landedCost)===null||d===void 0?void 0:d.id,shipToPartyId:J.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:I=(u=Oe.items.find(Boolean))===null||u===void 0?void 0:u.currencyCode;T=((l=J.stripeAddressEventData)===null||l===void 0?void 0:l.value.address.country)||"US";J.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((c=Oe.checkoutSession)===null||c===void 0?void 0:c.subtotals.presentmentCurrencyCode)!=="USD"&&!!((f=(v=n.genericSettings)===null||v===void 0?void 0:v.usdSettlementCountryEnabled)===null||f===void 0?void 0:f.includes(T));return[2,k]}}))}))}));var Re=e("m",(function(e){var n=e.isPreview,t=e.sessionTimeout;if(n){return}var r=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=r&&!isNaN(parseInt(r,10))?parseInt(r,10):t;h("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Oe.checkoutTimeoutInterval=setTimeout((function(){Oe.checkoutSessionTimeoutShow=true}),o)}));var Ue=e("j",(function(){if(Oe.checkoutTimeoutInterval){clearTimeout(Oe.checkoutTimeoutInterval);Oe.checkoutTimeoutInterval=null}}));var ze=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var Be=function(){Oe.items=Oe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Oe.restrictedItems=[]};var Fe=e("f",(function(e){return __awaiter(b,[e],void 0,(function(e){var n,t,o,i;var a=e.adjustments,s=e.cartItems,d=e.landedCostId,u=e.shouldInitSessionOnFailure,l=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:Oe.adjustments=a;Oe.items=ze(s);t=(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(!t||!o){return[2]}Oe.currency=t;J.isFetchingSession=true;return[4,De({adjustmentsAmount:i,billToPartyId:J.partyBillingId,cartId:window.Zonos.cartId,currency:t,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:d,shipToPartyId:J.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:e.sent();J.isFetchingSession=false;return[2]}}))}))}));var Je=function(){Oe.selectedShippingOption=null;Oe.isSelectedShippingAboveDeminimis=false;Oe.isSelectedShippingGuarantee=false;Oe.selectedShippingOptionTransitTime="";Oe.dutiesTaxesFees=0;Oe.dutiesTaxesFeesEstimate=0;Oe.shipping=0;Oe.total=Oe.subtotal};var Me=function(){if(Oe.step==="shipping"){Oe.step="customer-info";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})})}else if(Oe.step==="payment"){Oe.step="shipping";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})})}else if(Oe.step==="finish"){Oe.step="payment";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{payment:Object.assign(Object.assign({},Oe.tabItems.payment),{isDone:false})})}};var qe=e("r",(function(){if(Oe.step==="customer-info"){Oe.step="shipping";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems["customer-info"]),{isDone:true})})}else if(Oe.step==="shipping"){Oe.step="payment";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:true})})}else if(Oe.step==="payment"){Oe.step="finish"}}));var We=e("h",(function(){Oe.step="customer-info";Oe.tabItems=Object.assign(Object.assign({},Oe.tabItems),{"customer-info":Object.assign(Object.assign({},Oe.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Oe.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Oe.tabItems.shipping),{isDone:false})});Je()}))}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as e,h as s,F as t,H as n,a as i}from"./p-ab41bab5.js";import{c as a,d as r,t as l,H as c,y as d,I as h,e as p,r as m,z as f}from"./p-a2a0bf4e.js";import{s as b,c as u,a as g,b as y}from"./p-73c737aa.js";import{t as v,s as z,l as x}from"./p-170314a3.js";import{z as w}from"./p-b2a0ab4a.js";import{h as k,s as C,g as L,i as I,a as S}from"./p-41dd1cb8.js";import{c as j}from"./p-595f5dd2.js";import{g as M}from"./p-1f894984.js";import{l as H,b as P}from"./p-0a377722.js";import{i as Z,a as _}from"./p-1f3549c6.js";import{c as U}from"./p-b4b7f705.js";import{l as V}from"./p-97aceb11.js";import{c as D}from"./p-7e17667d.js";import{r as B}from"./p-81e3eb5b.js";import{p as $}from"./p-dc5fb21c.js";import{r as F}from"./p-27f6930b.js";import"./p-57fa64d7.js";const R=class{constructor(s){o(this,s),this.closeClick=e(this,"closeClick",7),this.borderRadius="ROUNDED",this.confirmationId=null,this.isLoading=!0,this.notificationType="success",this.notificationTitle="",this.notificationMessages=[],this.notificationActionText=v("Keep shopping"),this.order=null,this.isWaitingToRedirect=!0,this.pullOrder=async()=>{var o,e;const s=z.checkoutSessionId,t=new URLSearchParams;t.set("checkoutSessionId",s||"");const{baseUrl:n,errors:i,json:a}=await k(`/api/zonos-elements/get-order?${t.toString()}`);return i.length||!(null==a?void 0:a.id)?{baseUrl:n,order:null}:(await(null===(e=(o=w.checkoutSettings).onOrderSuccess)||void 0===e?void 0:e.call(o,{zonosApiRoute:n,zonosOrder:a})),{baseUrl:n,order:a})},this.handleSuccessBehavior=async()=>{this.isLoading=!1,await this.getPullOrder()},this.getPullOrder=async(o=0)=>{var e,s;0===o&&H("=== Start to poll for order info","info");const{baseUrl:t,order:n}=await this.pullOrder(),i=!!(null===(s=null===(e=null==n?void 0:n.references)||void 0===e?void 0:e.find((o=>"zonosOrderNumber"===(null==o?void 0:o.key))))||void 0===s?void 0:s.value),a=z.checkoutSessionId,r=parseFloat(new URLSearchParams(window.location.search).get("maxPollingRetries")||"0")||30;H(`=== Polling order (${o} attemps)`,"info"),n?(H("=== InvoiceOrder info found","info"),o>10&&C({endpoint:`${t}/api/zonos-elements/get-order?checkoutSessionId=${a}&orderId=${n.id}`,errors:[`Invoice order found after ${o} attempts`],metadata:{allLogs:P,checkoutSessionId:z.checkoutSessionId||"",orderId:n.id,storeId:w.storeId}}),this.order=n):n&&i||!(o<r)?C({endpoint:`${t}/api/zonos-elements/get-order?checkoutSessionId=${a}`,errors:[`Invoice order not found after ${r} attempts`],metadata:{allLogs:P,checkoutSessionId:z.checkoutSessionId||"",storeId:w.storeId}}):(await new Promise((o=>setTimeout(o,1e3))),await this.getPullOrder(o+1))},this.checkStripePaymentStatus=async()=>{const o=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||a.clientSecret;if(o||this.storybookForceStatus){const{error:e,messages:s,status:t}=await r({clientSecret:o,storybookForceStatus:this.storybookForceStatus}),n="requires_action"===t||e;this.notificationType=n?"error":"success",this.notificationMessages=s||[],this.notificationTitle=v(n?"Payment failed":"You're all set!"),H("=== Payment intent retrieve status","info",{clientSecret:o,error:e,messages:s,status:t});const i=new URL(window.location.href);if(i.searchParams.delete("payment_intent_client_secret"),i.searchParams.delete("payment_intent"),i.searchParams.delete("redirect_status"),i.searchParams.delete("zonosCheckoutSessionId"),window.history.replaceState({},"",i.toString()),e&&(null==s?void 0:s.length))b("zonos-checkout-payment-fail"),C({endpoint:"Stripe payment failed",errors:[`Payment intent "${o.split("_secret_")[0]||o}" status: ${t} - checkout session: ${z.checkoutSessionId}`],metadata:{allLogs:P,credentialToken:window.Zonos.zonosApiKey}});else{b("zonos-checkout-success"),l({checkoutSessionId:z.checkoutSessionId,eventName:"checkout_orderCompleted"});const o=j("zonos-checkout-success",{message:"Zonos Checkout successfully processed order"});document.dispatchEvent(o),await this.handleSuccessBehavior()}}this.isLoading=!1,c(),d(),z.checkoutSessionId=null},this.checkStagingOrderStatus=async()=>{this.notificationType="success",this.notificationTitle=v("You're all set!"),this.notificationMessages=h("succeeded").messages,await this.handleSuccessBehavior(),c(),d(),u(),z.checkoutSessionId=null},this.checkPaypalPaymentStatus=async()=>{if(g.paypalErrorMessage)return this.notificationType="error",this.notificationTitle=v("Payment failed"),this.notificationMessages=[g.paypalErrorMessage],void(this.isLoading=!1);this.isLoading=!1,g.orderIdCreated&&(b("zonos-checkout-success"),l({checkoutSessionId:z.checkoutSessionId,eventName:"checkout_orderCompleted"}),this.notificationType="success",this.notificationTitle=v("You're all set!"),this.notificationMessages=h("succeeded").messages,await this.handleSuccessBehavior()),c(),d(),u(),z.checkoutSessionId=null},this.getReceiptUrl=({cartId:o})=>{const e=new URL(`${window.location.origin}/receipt`);e.searchParams.set("referenceId",o),L()&&e.searchParams.set("zonosTestMode","1");const s=new URLSearchParams(window.location.search).get("zonosQaUrl");return s&&e.searchParams.set("zonosQaUrl",s),e.toString()}}componentDidLoad(){if(this.overrideNotification)return this.notificationType=this.overrideNotification.type,this.notificationTitle=this.overrideNotification.title,this.notificationMessages=this.overrideNotification.messages,void(this.isLoading=!1);p.isStagingMode?this.checkStagingOrderStatus():g.orderIdCreated?this.checkPaypalPaymentStatus():this.checkStripePaymentStatus()}render(){const o=window.Zonos.cartId;return s(n,{key:"2d8d736241298daa30fdf8935cef67bfa748e2df",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":M({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&s("div",{key:"30e1eae6e9ac7289af88f8fe2048d40796dfdf0e",class:"zonos--finish-details"},s("div",{key:"0324e34b72e58d0862ed319576018bd45bd18b18",class:"zonos--group"},s("zonos-icon","success"===this.notificationType?{"aria-label":"Order success",content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"blue-800",size:50}:{"aria-label":"Order failed",content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"red-800",size:50}),s("zonos-text",{key:"227f3cdda8e9cb0ed15ea91acb88c88d15d3d21c",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&s("zonos-badge",{key:"1458ad439dc56e9ca7641a9ca95f3dfb2fd6b28f",badgeColor:"gray"},this.confirmationId),s("zonos-text",{key:"8b0ab258c7beab09b0bc12999198f38813a144b3",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((o=>s(t,null,o,s("br",null))))),this.order&&o&&s("div",{key:"ea6b4f8c1f8cce779fadf358966fece018d9869b",class:"zonos--button-container"},s("zonos-button",{key:"e5140fa1fab1e3150a2b15915c29d988f54468b2",onClick:()=>{window.open(this.getReceiptUrl({cartId:o}),"_blank")},size:"lg",variant:"primary"},v("View receipt"))))))}static get assetsDirs(){return["assets"]}};R.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-direction:column;flex-direction:column;height:100%}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:24px;border-radius:var(--zonos--border-radius, 10px);gap:24px;margin-top:24px;background-color:var(--zonos-elements-gray-50);padding:48px}:host .zonos--finish-details{max-width:640px;min-width:300px;line-height:24px;width:0 auto;margin:auto}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .zonos--finish-button-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto;margin-top:48px;max-width:300px}:host .zonos--button-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto}:host .zonos--subtitle{text-align:center}:host .zonos--order-number{background-color:var(--zonos-elements-gray-0);border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800);border-radius:var(--zonos-elements-radius-6);padding:4px 8px}";const T=class{constructor(e){o(this,e),this.mobile=!1,this.tablet=!1,this.showLanguageDialog=!1,this.isMobile=!1,this.isTablet=!1}handleGlobalClick(o){!this.el.contains(o.target)&&this.showLanguageDialog&&(this.showLanguageDialog=!1)}toggleLanguageDialog(){this.showLanguageDialog=!this.showLanguageDialog}handleMobileChange(){this.isMobile=Z(this.mobile)}handleTabletChange(){this.isTablet=_(this.tablet)}componentWillLoad(){this.isMobile=Z(this.mobile),this.isTablet=_(this.tablet)}render(){var o;const e=null===(o=V.find((o=>o.code===x.selectedLocale)))||void 0===o?void 0:o.label,t="gray-1000";return s(n,{key:"c84163fd8ab0bc0f2c791028b6896379a4ae6a27",class:U(["zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},s("div",{key:"099a3be332fa52c5e7551bdd2a618041c4a6eb22",class:"zonos--invoice-footer"},s("div",{key:"ab727f45f3a67bcdd51eb29b392462f15eb5fedd",class:"zonos--invoice-locale-wrapper"},s("zonos-button",{key:"3d8431c78d54e0fe630677d0dd4ae2c975a208fa",buttonColor:t,class:"zonos--invoice-footer-language-button",icon:s("zonos-icon",{"aria-label":"Language select",content:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n',iconColor:t}),onClick:()=>this.toggleLanguageDialog(),variant:"subtle"},e),s("div",{key:"2920b4105b6209c4177fc91651dc5d9397d6abf2",class:U(["zonos--invoice-language-dialog",this.showLanguageDialog&&"zonos--invoice-language-dialog-open"])},s("zonos-language-select",{key:"705e1a4243dc7ebc73c522a82f93c3d833240a95",handleOnClose:()=>this.toggleLanguageDialog()}))),s("div",{key:"49c2d0ae1f587079b48f12d62d10eb422991255e",class:"zonos--invoice-footer-icon-wrapper"},s("div",{key:"58a4da788527ddf4abd759b5e305e747aa96d540",class:"zonos--invoice-footer-logo"},s("zonos-text",{key:"45bf1af64ec0f0a2e11e8d23361b71f4b4189881",textColor:t},v("Powered by")),s("a",{key:"1dd7224f3e126bcabe60a42c9529ab65c64f0063",href:"https://zonos.com",target:"_blank",title:"Zonos website"},s("zonos-icon",{key:"7dc21ce09b72bf37efd30e2c17b6d8b9328e8c3d",autoHeight:!0,content:'<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n',size:42}))),s("div",{key:"a0d053e6745733cd61868c109628a1835f4fe3ed",class:"dot"}),s("a",{key:"fd467e88aa2ed10b707f88ed0d1a5af80af35539",href:"https://zonos.com/docs/legal/zonos-privacy-policy",target:"_blank"},s("zonos-text",{key:"35db684368ff8abc05c2c7fab22500270b0b7e21",textColor:t},v("Privacy policy"))))))}get el(){return i(this)}static get watchers(){return{mobile:["handleMobileChange"],tablet:["handleTabletChange"]}}};T.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{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--invoice-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo a{line-height:0}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper a{text-decoration:none}:host .zonos--invoice-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{gap:4px}}:host .zonos--invoice-footer .zonos--invoice-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--invoice-footer .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--invoice-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile){-ms-flex-order:3;order:3}:host(.mobile) .zonos--invoice-locale-wrapper{display:none}:host(.mobile) .zonos--invoice-footer{-ms-flex-pack:center;justify-content:center}";const W=class{constructor(s){o(this,s),this.collapseClicked=e(this,"collapseClicked",7),this.mobile=!0,this.landedCostId="",this.isMobile=!1,this.collapseState=this.collapsed}handleCollapseChangeFromProp(o){this.collapseState=o}handleCollapseChange(o){this.collapseClicked.emit(o)}handleWindowResize(){this.isMobile=I(this.mobile)}componentWillLoad(){this.handleWindowResize()}render(){return s(n,{class:U(["zonos--invoice-order-details zonos--elements",this.isMobile&&"mobile"])},s("div",{class:"zonos--wrapper"},s("button",{class:"zonos--order-details-header",onClick:()=>{this.collapseState=!this.collapseState},type:"button"},s("div",{class:"zonos--order-details-header-text"},s("zonos-text",{type:"boldSubheader"},v("Pay [organizationName]",{organizationName:w.organizationName})),(()=>s("zonos-icon",this.collapseState?{"aria-label":"Collapse expanded section",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"}:{"aria-label":"Expand collapsed section",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"}))()),s("zonos-text",{type:"boldSubheader"},B({amount:D.amountTotalDue||0,isForeign:!0}))),s("div",{class:"zonos--order-details-wrapper"},s("zonos-collapse",{collapsed:this.collapseState},s("div",{class:"zonos--invoice-order-details-content"},s("zonos-invoice-cart-items",{isMobile:this.isMobile}),s("zonos-invoice-subtotal",{isMobile:this.isMobile}))))))}static get assetsDirs(){return["assets"]}static get watchers(){return{collapsed:["handleCollapseChangeFromProp"],collapseState:["handleCollapseChange"]}}};W.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{height:100%}:host *{-ms-scroll-chaining:none;overscroll-behavior:contain}:host *::-webkit-scrollbar{width:10px}:host *::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host *::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host *::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex}:host .zonos--wrapper{overflow:auto;background-color:var(--zonos-elements-gray-50);border-radius:16px;height:100%;min-height:56px}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--order-details-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--zonos-elements-gray-50);border:none;display:-ms-flexbox;display:flex;padding:16px 16px 0 16px;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .zonos--order-details-header:focus-visible{outline:none}:host .zonos--order-details-wrapper{position:relative;padding:0 16px 16px 16px}:host .zonos--invoice-order-details-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--invoice-order-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row>*{-ms-flex:1 1 150px;flex:1 1 150px}:host .zonos--invoice-order-info .zonos--invoice-order-details-column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--invoice-order-info .zonos--invoice-order-shipping-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0}";const N=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.paypalSessionFailed=e(this,"paypalSessionFailed",7),this.paypalSessionDone=e(this,"paypalSessionDone",7),this.storeUnsubscribeList=[],this.continueLoading=!1,this.showErrorBanner=!1,this.hasStripePaymentError=!1,this.stagingOrderCreateErrorMessage="",this.internalContinueLoading=this.continueLoading,this.handleValidate=()=>{var o;return!!(null===(o=a.stripePaymentEventData)||void 0===o?void 0:o.complete)},this.continueClickHandler=async({currencyCode:o})=>{var e,s;if(!this.handleValidate())return null===(e=a.stripeBillingAddressElement)||void 0===e||e.getValue(),this.showErrorBanner=!0,null===(s=a.stripeElements)||void 0===s||s.submit(),void setTimeout((()=>{var o;null===(o=this.ele.querySelector("zonos-banner"))||void 0===o||o.scrollIntoView({behavior:"smooth"})}),10);a.checkoutSettlementCurrency=o,b("zonos-checkout-payment-info"),this.continueClicked.emit()},this.copyCardToClipboard=async o=>{try{await navigator.clipboard.writeText(o)}catch(e){const s=document.createElement("textarea");s.style.position="fixed",s.style.left="-1000px",s.style.top="-1000px",s.style.width="1px",s.style.height="1px",s.value=o,s.id="zonos-copy-card-number",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}window.Zonos.showNotification({message:v("Card number copied to clipboard"),timeout:4e3,type:"success"})},this.placeTestOrder=async()=>{this.internalContinueLoading=!0;const{errors:o}=await $();if(o.length)return this.stagingOrderCreateErrorMessage=o[0]||"Failed to create staging order. Please try again.",void(this.internalContinueLoading=!1);this.internalContinueLoading=!1,m()}}continueLoadingWatcher(){this.internalContinueLoading=this.continueLoading}stripePaymentErrorWatcher(){this.hasStripePaymentError&&setTimeout((()=>{var o;null===(o=this.ele.querySelector("zonos-banner"))||void 0===o||o.scrollIntoView({behavior:"smooth"})}),50)}componentWillLoad(){this.storeUnsubscribeList=[f("currency",(()=>{y({currency:p.currency})}))],y({currency:p.currency})}disconnectedCallback(){this.storeUnsubscribeList.forEach((o=>o()))}render(){var o;if(this.hasStripePaymentError=a.hasPaymentError,!a.stripeElements)return null;if(!a.clientSecret)return null;this.showErrorBanner&&(this.showErrorBanner=!this.handleValidate());const e=L(),i=p.isStagingMode||S(),r="external_paypal"===(null===(o=a.stripePaymentEventData)||void 0===o?void 0:o.value.type);return s(n,{class:"zonos--checkout-payment zonos--elements"},s("div",{class:"zonos--group"},s("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},v("Payment method")),(()=>{if(i){const o=w.appearance.theme;return s(t,null,this.stagingOrderCreateErrorMessage&&s("zonos-banner",{class:"zonos--error-banner",intent:"error"},this.stagingOrderCreateErrorMessage),s("zonos-empty-state-payment",{emptyStateText:v("No payment method needed for staging"),theme:o}),s("div",{class:"zonos--group-btn"},s("zonos-button",{backgroundColor:this.submitBtnColor,loading:this.internalContinueLoading,onClick:()=>{this.placeTestOrder()},size:"lg",variant:this.submitBtnType},v("Place test order"))))}return a.isFetchingSession||D.isFetchingPayorInfo?null:s(t,null,this.showErrorBanner&&s("zonos-banner",{class:"zonos--error-banner",intent:"error"},v("Missing required fields. Make sure all fields are completed.")),this.hasStripePaymentError&&s("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},a.customErrorMessage||v("We couldn't complete your payment. Please verify the payment details and try again.")),g.paypalErrorMessage&&s("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},g.paypalErrorMessage),s("zonos-payment",null),s("div",{class:"zonos--group-btn"},!r&&s(t,null,s("zonos-button",{backgroundColor:this.submitBtnColor,bold:!0,isDisabled:this.continueLoading&&"USD"===a.checkoutSettlementCurrency,loading:this.continueLoading&&"USD"!==a.checkoutSettlementCurrency,onClick:async()=>{p.checkoutSession?await this.continueClickHandler({currencyCode:p.checkoutSession.subtotals.presentmentCurrencyCode}):H("Checkout session is not found")},size:"lg",variant:this.submitBtnType},v("Pay [orderTotal]",{orderTotal:B({amount:D.amountTotalDue||0,isForeign:!0})})),a.shouldRenderPayInUsdButton&&s("zonos-button",{class:"zonos--pay-in-base-currency-btn",isDisabled:this.continueLoading&&"USD"!==a.checkoutSettlementCurrency,loading:this.continueLoading&&"USD"===a.checkoutSettlementCurrency,onClick:async()=>{await this.continueClickHandler({currencyCode:"USD"})},size:"lg",variant:"subtle"},v("Click to pay in USD"))),s("zonos-paypal-payment",{onPaypalSessionDone:({detail:{orderId:o}})=>{this.paypalSessionDone.emit(o)},onPaypalSessionFail:()=>this.paypalSessionFailed.emit(),style:{display:r?"block":"none"}})),e&&s("zonos-card",{backgroundColor:"gray-100",borderRadius:12,class:"zonos--test-cards"},s("zonos-v-stack",{spacing:16},s("div",null,s("zonos-text",{type:"semiBoldLabel"},v("Test cards")),s("zonos-text",{textColor:"gray-700"},v("Click to copy the card number. Use any future expiration date and three number CVC."))),s("zonos-button",{icon:s("zonos-icon",{content:'<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M15.342 10.21a.75.75 0 0 0-1.184-.92l-2.978 3.829-1.4-1.4a.75.75 0 1 0-1.06 1.061l1.8 1.8a1 1 0 0 0 1.496-.093l3.326-4.277Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>'}),justifyContent:"flex-start",onClick:()=>this.copyCardToClipboard("4242424242424242")},v("Success")," (****4242)"),s("zonos-button",{icon:s("zonos-icon",{content:'<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>'}),justifyContent:"flex-start",onClick:()=>this.copyCardToClipboard("4000000000000002")},v("Failure")," (****0002)")),s("zonos-notification",null)))})()))}get ele(){return i(this)}static get watchers(){return{continueLoading:["continueLoadingWatcher"],hasStripePaymentError:["stripePaymentErrorWatcher"]}}};N.style=".sc-zonos-invoice-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-payment-h *.sc-zonos-invoice-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-payment-h img.sc-zonos-invoice-payment{max-width:100%}.sc-zonos-invoice-payment-h dl.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h dd.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h1.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h2.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h3.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h4.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h5.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h6.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h hr.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h figure.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h p.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h pre.sc-zonos-invoice-payment{margin:0}.sc-zonos-invoice-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1}.sc-zonos-invoice-payment-h .zonos--title.sc-zonos-invoice-payment{margin-bottom:24px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment{margin-bottom:20px;overflow:auto;padding:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar{width:10px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-payment-h .zonos--payment-error-banner.sc-zonos-invoice-payment{margin-bottom:8px}.sc-zonos-invoice-payment-h .zonos--error-banner.sc-zonos-invoice-payment{margin-bottom:16px}.sc-zonos-invoice-payment-h zonos-button.sc-zonos-invoice-payment{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-invoice-payment-h .zonos--pay-in-base-currency-btn.sc-zonos-invoice-payment{-webkit-box-shadow:none;box-shadow:none}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;gap:12px;bottom:-5px;padding-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0))}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-text.sc-zonos-invoice-payment{text-align:center}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-button.sc-zonos-invoice-payment{width:100%}.sc-zonos-invoice-payment-h .zonos--test-cards.sc-zonos-invoice-payment{margin-top:auto;padding-top:16px}";const O=class{constructor(e){o(this,e),this.mobile=!1,this.tablet=!1,this.collapsed=!1,this.isMobile=!1,this.isTablet=!1,this.isLoading=!0}handleWindowResize(){this.isMobile=Z(this.mobile),this.isTablet=_(this.tablet)}componentWillLoad(){this.handleWindowResize(),setTimeout((()=>{this.isLoading=!1}),1e3)}render(){const o=this.isMobile?"gray-1000":"gray-800";return s(n,{key:"60da23c47f39a94478f1eb83e003b788aab3b98c",class:U(["zonos--invoice-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},s("div",{key:"70bbb1973ec1c7197da666ba30be6dc6a20bd386",class:"zonos--title"},s("zonos-text",{key:"35ffffa411ccde7c702b5d5ac3f11d7a8d62916f",textColor:o,type:"semiBoldLabel"},v("Pay [organizationName]",{organizationName:w.organizationName}))),s("div",{key:"c965e47314d1c3178b1dd2e54e835c0b91966a81",class:"zonos--total-pay"},F({content:s("zonos-text",{type:"secondaryPageHeader"},B({amount:D.amountTotalDue||0,isForeign:!0})),isLoading:D.isFetchingPayorInfo,skeletonHeight:"36px",skeletonWidth:"150px"})))}static get assetsDirs(){return["assets"]}};O.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{position:-webkit-sticky;position:sticky;top:0;background-color:var(--zonos-elements-gray-0);z-index:1}:host .zonos--total-pay{margin:8px 0 24px;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;gap:48px}:host .zonos--total-pay zonos-text{-ms-flex-negative:0;flex-shrink:0}:host .zonos--total-pay::after{content:"";position:relative;height:1px;width:100%;background:var(--zonos-elements-gray-200)}:host(.mobile),:host(.tablet){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;padding:4px 0;background-color:transparent;position:relative}:host(.mobile) .zonos--total-pay,:host(.tablet) .zonos--total-pay{margin:0}';export{R as zonos_invoice_finish,T as zonos_invoice_footer,W as zonos_invoice_order_details,N as zonos_invoice_payment,O as zonos_invoice_review}
|
|
1
|
+
import{r as o,c as e,h as s,F as t,H as n,a as i}from"./p-ab41bab5.js";import{c as a,d as r,t as l,H as c,y as d,I as h,e as p,r as m,z as f}from"./p-dadd3f97.js";import{s as b,c as u,a as g,b as y}from"./p-e2e1145c.js";import{t as v,s as z,l as x}from"./p-59bc0ca9.js";import{z as w}from"./p-b2a0ab4a.js";import{h as k,s as C,g as L,i as I,a as S}from"./p-41dd1cb8.js";import{c as j}from"./p-595f5dd2.js";import{g as M}from"./p-1f894984.js";import{l as H,b as P}from"./p-0a377722.js";import{i as Z,a as _}from"./p-1f3549c6.js";import{c as U}from"./p-b4b7f705.js";import{l as V}from"./p-97aceb11.js";import{c as D}from"./p-442f1023.js";import{r as B}from"./p-bb73eb0f.js";import{p as $}from"./p-802a28f5.js";import{r as F}from"./p-27f6930b.js";import"./p-57fa64d7.js";const R=class{constructor(s){o(this,s),this.closeClick=e(this,"closeClick",7),this.borderRadius="ROUNDED",this.confirmationId=null,this.isLoading=!0,this.notificationType="success",this.notificationTitle="",this.notificationMessages=[],this.notificationActionText=v("Keep shopping"),this.order=null,this.isWaitingToRedirect=!0,this.pullOrder=async()=>{var o,e;const s=z.checkoutSessionId,t=new URLSearchParams;t.set("checkoutSessionId",s||"");const{baseUrl:n,errors:i,json:a}=await k(`/api/zonos-elements/get-order?${t.toString()}`);return i.length||!(null==a?void 0:a.id)?{baseUrl:n,order:null}:(await(null===(e=(o=w.checkoutSettings).onOrderSuccess)||void 0===e?void 0:e.call(o,{zonosApiRoute:n,zonosOrder:a})),{baseUrl:n,order:a})},this.handleSuccessBehavior=async()=>{this.isLoading=!1,await this.getPullOrder()},this.getPullOrder=async(o=0)=>{var e,s;0===o&&H("=== Start to poll for order info","info");const{baseUrl:t,order:n}=await this.pullOrder(),i=!!(null===(s=null===(e=null==n?void 0:n.references)||void 0===e?void 0:e.find((o=>"zonosOrderNumber"===(null==o?void 0:o.key))))||void 0===s?void 0:s.value),a=z.checkoutSessionId,r=parseFloat(new URLSearchParams(window.location.search).get("maxPollingRetries")||"0")||30;H(`=== Polling order (${o} attemps)`,"info"),n?(H("=== InvoiceOrder info found","info"),o>10&&C({endpoint:`${t}/api/zonos-elements/get-order?checkoutSessionId=${a}&orderId=${n.id}`,errors:[`Invoice order found after ${o} attempts`],metadata:{allLogs:P,checkoutSessionId:z.checkoutSessionId||"",orderId:n.id,storeId:w.storeId}}),this.order=n):n&&i||!(o<r)?C({endpoint:`${t}/api/zonos-elements/get-order?checkoutSessionId=${a}`,errors:[`Invoice order not found after ${r} attempts`],metadata:{allLogs:P,checkoutSessionId:z.checkoutSessionId||"",storeId:w.storeId}}):(await new Promise((o=>setTimeout(o,1e3))),await this.getPullOrder(o+1))},this.checkStripePaymentStatus=async()=>{const o=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||a.clientSecret;if(o||this.storybookForceStatus){const{error:e,messages:s,status:t}=await r({clientSecret:o,storybookForceStatus:this.storybookForceStatus}),n="requires_action"===t||e;this.notificationType=n?"error":"success",this.notificationMessages=s||[],this.notificationTitle=v(n?"Payment failed":"You're all set!"),H("=== Payment intent retrieve status","info",{clientSecret:o,error:e,messages:s,status:t});const i=new URL(window.location.href);if(i.searchParams.delete("payment_intent_client_secret"),i.searchParams.delete("payment_intent"),i.searchParams.delete("redirect_status"),i.searchParams.delete("zonosCheckoutSessionId"),window.history.replaceState({},"",i.toString()),e&&(null==s?void 0:s.length))b("zonos-checkout-payment-fail"),C({endpoint:"Stripe payment failed",errors:[`Payment intent "${o.split("_secret_")[0]||o}" status: ${t} - checkout session: ${z.checkoutSessionId}`],metadata:{allLogs:P,credentialToken:window.Zonos.zonosApiKey}});else{b("zonos-checkout-success"),l({checkoutSessionId:z.checkoutSessionId,eventName:"checkout_orderCompleted"});const o=j("zonos-checkout-success",{message:"Zonos Checkout successfully processed order"});document.dispatchEvent(o),await this.handleSuccessBehavior()}}this.isLoading=!1,c(),d(),z.checkoutSessionId=null},this.checkStagingOrderStatus=async()=>{this.notificationType="success",this.notificationTitle=v("You're all set!"),this.notificationMessages=h("succeeded").messages,await this.handleSuccessBehavior(),c(),d(),u(),z.checkoutSessionId=null},this.checkPaypalPaymentStatus=async()=>{if(g.paypalErrorMessage)return this.notificationType="error",this.notificationTitle=v("Payment failed"),this.notificationMessages=[g.paypalErrorMessage],void(this.isLoading=!1);this.isLoading=!1,g.orderIdCreated&&(b("zonos-checkout-success"),l({checkoutSessionId:z.checkoutSessionId,eventName:"checkout_orderCompleted"}),this.notificationType="success",this.notificationTitle=v("You're all set!"),this.notificationMessages=h("succeeded").messages,await this.handleSuccessBehavior()),c(),d(),u(),z.checkoutSessionId=null},this.getReceiptUrl=({cartId:o})=>{const e=new URL(`${window.location.origin}/receipt`);e.searchParams.set("referenceId",o),L()&&e.searchParams.set("zonosTestMode","1");const s=new URLSearchParams(window.location.search).get("zonosQaUrl");return s&&e.searchParams.set("zonosQaUrl",s),e.toString()}}componentDidLoad(){if(this.overrideNotification)return this.notificationType=this.overrideNotification.type,this.notificationTitle=this.overrideNotification.title,this.notificationMessages=this.overrideNotification.messages,void(this.isLoading=!1);p.isStagingMode?this.checkStagingOrderStatus():g.orderIdCreated?this.checkPaypalPaymentStatus():this.checkStripePaymentStatus()}render(){const o=window.Zonos.cartId;return s(n,{key:"2d8d736241298daa30fdf8935cef67bfa748e2df",class:"zonos--checkout-finish zonos--elements",style:{"--zonos--border-radius":M({overrideBorderStyle:this.borderRadius})}},!this.isLoading&&s("div",{key:"30e1eae6e9ac7289af88f8fe2048d40796dfdf0e",class:"zonos--finish-details"},s("div",{key:"0324e34b72e58d0862ed319576018bd45bd18b18",class:"zonos--group"},s("zonos-icon","success"===this.notificationType?{"aria-label":"Order success",content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"blue-800",size:50}:{"aria-label":"Order failed",content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"red-800",size:50}),s("zonos-text",{key:"227f3cdda8e9cb0ed15ea91acb88c88d15d3d21c",class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),this.confirmationId&&s("zonos-badge",{key:"1458ad439dc56e9ca7641a9ca95f3dfb2fd6b28f",badgeColor:"gray"},this.confirmationId),s("zonos-text",{key:"8b0ab258c7beab09b0bc12999198f38813a144b3",class:"zonos--subtitle",textColor:"gray-600"},this.notificationMessages.map((o=>s(t,null,o,s("br",null))))),this.order&&o&&s("div",{key:"ea6b4f8c1f8cce779fadf358966fece018d9869b",class:"zonos--button-container"},s("zonos-button",{key:"e5140fa1fab1e3150a2b15915c29d988f54468b2",onClick:()=>{window.open(this.getReceiptUrl({cartId:o}),"_blank")},size:"lg",variant:"primary"},v("View receipt"))))))}static get assetsDirs(){return["assets"]}};R.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-direction:column;flex-direction:column;height:100%}:host .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:24px;border-radius:var(--zonos--border-radius, 10px);gap:24px;margin-top:24px;background-color:var(--zonos-elements-gray-50);padding:48px}:host .zonos--finish-details{max-width:640px;min-width:300px;line-height:24px;width:0 auto;margin:auto}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host .zonos--finish-button-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto;margin-top:48px;max-width:300px}:host .zonos--button-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;gap:16px;margin:0 auto}:host .zonos--subtitle{text-align:center}:host .zonos--order-number{background-color:var(--zonos-elements-gray-0);border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800);border-radius:var(--zonos-elements-radius-6);padding:4px 8px}";const T=class{constructor(e){o(this,e),this.mobile=!1,this.tablet=!1,this.showLanguageDialog=!1,this.isMobile=!1,this.isTablet=!1}handleGlobalClick(o){!this.el.contains(o.target)&&this.showLanguageDialog&&(this.showLanguageDialog=!1)}toggleLanguageDialog(){this.showLanguageDialog=!this.showLanguageDialog}handleMobileChange(){this.isMobile=Z(this.mobile)}handleTabletChange(){this.isTablet=_(this.tablet)}componentWillLoad(){this.isMobile=Z(this.mobile),this.isTablet=_(this.tablet)}render(){var o;const e=null===(o=V.find((o=>o.code===x.selectedLocale)))||void 0===o?void 0:o.label,t="gray-1000";return s(n,{key:"c84163fd8ab0bc0f2c791028b6896379a4ae6a27",class:U(["zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},s("div",{key:"099a3be332fa52c5e7551bdd2a618041c4a6eb22",class:"zonos--invoice-footer"},s("div",{key:"ab727f45f3a67bcdd51eb29b392462f15eb5fedd",class:"zonos--invoice-locale-wrapper"},s("zonos-button",{key:"3d8431c78d54e0fe630677d0dd4ae2c975a208fa",buttonColor:t,class:"zonos--invoice-footer-language-button",icon:s("zonos-icon",{"aria-label":"Language select",content:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12ZM11.4709 5.80634C11.7686 5.53723 11.9541 5.5 12 5.5C12.0459 5.5 12.2314 5.53723 12.5291 5.80634C12.8115 6.06164 13.1289 6.46913 13.4271 7.03651C13.9505 8.03191 14.3838 9.46098 14.48 11.25H9.51996C9.61624 9.46098 10.0495 8.03191 10.5729 7.03651C10.8711 6.46913 11.1885 6.06164 11.4709 5.80634ZM8.01802 11.25C8.11591 9.23031 8.60319 7.55958 9.24516 6.33849C9.29983 6.23451 9.35585 6.13335 9.41312 6.03514C7.32916 6.94017 5.81218 8.90533 5.5428 11.25H8.01802ZM5.5428 12.75H8.01802C8.11591 14.7697 8.60319 16.4404 9.24516 17.6615C9.29983 17.7655 9.35585 17.8666 9.41312 17.9649C7.32916 17.0598 5.81218 15.0947 5.5428 12.75ZM9.51996 12.75H14.48C14.3838 14.539 13.9505 15.9681 13.4271 16.9635C13.1289 17.5309 12.8115 17.9384 12.5291 18.1937C12.2314 18.4628 12.0459 18.5 12 18.5C11.9541 18.5 11.7686 18.4628 11.4709 18.1937C11.1885 17.9384 10.8711 17.5309 10.5729 16.9635C10.0495 15.9681 9.61624 14.539 9.51996 12.75ZM15.982 12.75C15.8841 14.7697 15.3968 16.4404 14.7548 17.6615C14.7002 17.7655 14.6441 17.8666 14.5869 17.9649C16.6708 17.0598 18.1878 15.0947 18.4572 12.75H15.982ZM18.4572 11.25C18.1878 8.90533 16.6708 6.94017 14.5869 6.03514C14.6441 6.13335 14.7002 6.23451 14.7548 6.33849C15.3968 7.55958 15.8841 9.23031 15.982 11.25H18.4572Z" fill="currentColor"/>\n</svg>\n',iconColor:t}),onClick:()=>this.toggleLanguageDialog(),variant:"subtle"},e),s("div",{key:"2920b4105b6209c4177fc91651dc5d9397d6abf2",class:U(["zonos--invoice-language-dialog",this.showLanguageDialog&&"zonos--invoice-language-dialog-open"])},s("zonos-language-select",{key:"705e1a4243dc7ebc73c522a82f93c3d833240a95",handleOnClose:()=>this.toggleLanguageDialog()}))),s("div",{key:"49c2d0ae1f587079b48f12d62d10eb422991255e",class:"zonos--invoice-footer-icon-wrapper"},s("div",{key:"58a4da788527ddf4abd759b5e305e747aa96d540",class:"zonos--invoice-footer-logo"},s("zonos-text",{key:"45bf1af64ec0f0a2e11e8d23361b71f4b4189881",textColor:t},v("Powered by")),s("a",{key:"1dd7224f3e126bcabe60a42c9529ab65c64f0063",href:"https://zonos.com",target:"_blank",title:"Zonos website"},s("zonos-icon",{key:"7dc21ce09b72bf37efd30e2c17b6d8b9328e8c3d",autoHeight:!0,content:'<svg width="43" height="10" viewBox="0 0 43 10" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.35896 0.0640869H0.30768C0.166068 0.0640869 0.0512695 0.178886 0.0512695 0.320497V1.85896C0.0512695 2.00057 0.166068 2.11537 0.30768 2.11537H4.44439C4.54964 2.11537 4.61005 2.2352 4.54745 2.31982L0.151823 8.2615C0.0865163 8.34978 0.0512695 8.45669 0.0512695 8.56649V9.67947C0.0512695 9.82108 0.166068 9.93588 0.30768 9.93588H7.35896C7.50057 9.93588 7.61537 9.82108 7.61537 9.67947V8.14101C7.61537 7.9994 7.50057 7.8846 7.35896 7.8846H3.22226C3.117 7.8846 3.05659 7.76477 3.11919 7.68015L7.51482 1.73847C7.58013 1.65019 7.61537 1.54328 7.61537 1.43348V0.320497C7.61537 0.178886 7.50057 0.0640869 7.35896 0.0640869Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.718 0C10.1602 0 8.89746 1.26279 8.89746 2.82051V7.17949C8.89746 8.73721 10.1602 10 11.718 10H13.6411C15.1988 10 16.4616 8.73721 16.4616 7.17949V2.82051C16.4616 1.26279 15.1988 0 13.6411 0H11.718ZM11.718 2.05128C11.2931 2.05128 10.9487 2.39568 10.9487 2.82051V7.17949C10.9487 7.60432 11.2931 7.94872 11.718 7.94872H13.6411C14.0659 7.94872 14.4103 7.60432 14.4103 7.17949V5V2.82051C14.4103 2.39568 14.0659 2.05128 13.6411 2.05128H11.718Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M17.7437 0.436316V9.71132C17.7437 9.85293 17.8585 9.96773 18.0001 9.96773H19.5385C19.6801 9.96773 19.7949 9.85293 19.7949 9.71132V3.74801C19.7949 3.44829 19.969 3.17587 20.241 3.04996L22.1641 2.15964C22.6739 1.92363 23.2565 2.29592 23.2565 2.85769V9.71132C23.2565 9.85293 23.3713 9.96773 23.5129 9.96773H25.0513C25.193 9.96773 25.3078 9.85293 25.3078 9.71132V2.85595C25.3078 0.79631 23.1718 -0.568775 21.3027 0.296257L19.9742 0.911055C19.8685 0.959946 19.7432 0.931536 19.669 0.84187L19.2748 0.365697C19.1773 0.248019 19.0325 0.179905 18.8797 0.179905H18.0001C17.8585 0.179905 17.7437 0.294704 17.7437 0.436316Z" fill="var(--zonos-elements-gray-800)"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4104 0C27.8526 0 26.5898 1.26279 26.5898 2.82051V7.17949C26.5898 8.73721 27.8526 10 29.4104 10H31.3334C32.8912 10 34.1539 8.73721 34.1539 7.17949V2.82051C34.1539 1.26279 32.8912 0 31.3334 0H29.4104ZM29.4104 2.05128C28.9855 2.05128 28.6411 2.39568 28.6411 2.82051V7.17949C28.6411 7.60432 28.9855 7.94872 29.4104 7.94872H31.3334C31.7583 7.94872 32.1027 7.60432 32.1027 7.17949V2.82051C32.1027 2.39568 31.7583 2.05128 31.3334 2.05128H29.4104Z" fill="var(--zonos-elements-gray-800)"/>\n<path d="M38.2085 0.0640869H40.3889C41.8309 0.0640869 42.9999 1.23306 42.9999 2.67506C42.9999 2.79477 42.9108 2.89574 42.792 2.91059L41.1732 3.11293C41.054 3.12784 40.9486 3.03485 40.9486 2.91466C40.9486 2.47322 40.5908 2.11537 40.1493 2.11537H38.3397C37.8688 2.11537 37.4871 2.49712 37.4871 2.96803C37.4871 3.3685 37.7658 3.71501 38.1569 3.80087L40.7916 4.37922C42.0811 4.66229 42.9999 5.80462 42.9999 7.12486C42.9999 8.67735 41.7414 9.93588 40.1889 9.93588H38.0468C36.6048 9.93588 35.4358 8.76691 35.4358 7.32491C35.4358 7.2052 35.5249 7.10423 35.6437 7.08938L37.2625 6.88703C37.3817 6.87213 37.4871 6.96512 37.4871 7.08531C37.4871 7.52675 37.8449 7.8846 38.2864 7.8846H40.1176C40.5765 7.8846 40.9486 7.51252 40.9486 7.05354C40.9486 6.67478 40.6925 6.34394 40.3258 6.24901L37.5136 5.52093C36.2902 5.20422 35.4358 4.10042 35.4358 2.83676C35.4358 1.30545 36.6772 0.0640869 38.2085 0.0640869Z" fill="var(--zonos-elements-gray-700)"/>\n</svg>\n',size:42}))),s("div",{key:"a0d053e6745733cd61868c109628a1835f4fe3ed",class:"dot"}),s("a",{key:"fd467e88aa2ed10b707f88ed0d1a5af80af35539",href:"https://zonos.com/docs/legal/zonos-privacy-policy",target:"_blank"},s("zonos-text",{key:"35db684368ff8abc05c2c7fab22500270b0b7e21",textColor:t},v("Privacy policy"))))))}get el(){return i(this)}static get watchers(){return{mobile:["handleMobileChange"],tablet:["handleTabletChange"]}}};T.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{position:absolute;bottom:0;left:32px;right:32px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2}:host .zonos--invoice-footer{gap:16px;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px;padding-left:0;-ms-flex-align:center;align-items:center;width:100%}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:16px}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-align:center;align-items:center}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper .zonos--invoice-footer-logo a{line-height:0}:host .zonos--invoice-footer .zonos--invoice-footer-icon-wrapper a{text-decoration:none}:host .zonos--invoice-footer zonos-button button.outline{outline:1px solid var(--zonos-elements-gray-800)}:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px;position:relative}@media (max-width: 400px){:host .zonos--invoice-footer .zonos--invoice-locale-wrapper{gap:4px}}:host .zonos--invoice-footer .zonos--invoice-language-dialog{position:absolute;bottom:36px;left:var(--language-dialog-left);background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);width:360px;max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:bottom left;transform-origin:bottom left;opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar{width:10px}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--invoice-footer .zonos--invoice-language-dialog::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--invoice-footer .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .dot{display:-ms-inline-flexbox;display:inline-flex;background:var(--zonos-elements-gray-400);width:6px;height:6px;border-radius:50%}:host(.mobile),:host(.tablet){background-color:var(--zonos-elements-gray-0);width:100%;position:-webkit-sticky;position:sticky;bottom:0}:host(.tablet) .zonos--invoice-footer{width:100%;max-width:800px;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex}:host(.mobile){-ms-flex-order:3;order:3}:host(.mobile) .zonos--invoice-locale-wrapper{display:none}:host(.mobile) .zonos--invoice-footer{-ms-flex-pack:center;justify-content:center}";const W=class{constructor(s){o(this,s),this.collapseClicked=e(this,"collapseClicked",7),this.mobile=!0,this.landedCostId="",this.isMobile=!1,this.collapseState=this.collapsed}handleCollapseChangeFromProp(o){this.collapseState=o}handleCollapseChange(o){this.collapseClicked.emit(o)}handleWindowResize(){this.isMobile=I(this.mobile)}componentWillLoad(){this.handleWindowResize()}render(){return s(n,{class:U(["zonos--invoice-order-details zonos--elements",this.isMobile&&"mobile"])},s("div",{class:"zonos--wrapper"},s("button",{class:"zonos--order-details-header",onClick:()=>{this.collapseState=!this.collapseState},type:"button"},s("div",{class:"zonos--order-details-header-text"},s("zonos-text",{type:"boldSubheader"},v("Pay [organizationName]",{organizationName:w.organizationName})),(()=>s("zonos-icon",this.collapseState?{"aria-label":"Collapse expanded section",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"}:{"aria-label":"Expand collapsed section",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"}))()),s("zonos-text",{type:"boldSubheader"},B({amount:D.amountTotalDue||0,isForeign:!0}))),s("div",{class:"zonos--order-details-wrapper"},s("zonos-collapse",{collapsed:this.collapseState},s("div",{class:"zonos--invoice-order-details-content"},s("zonos-invoice-cart-items",{isMobile:this.isMobile}),s("zonos-invoice-subtotal",{isMobile:this.isMobile}))))))}static get assetsDirs(){return["assets"]}static get watchers(){return{collapsed:["handleCollapseChangeFromProp"],collapseState:["handleCollapseChange"]}}};W.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{height:100%}:host *{-ms-scroll-chaining:none;overscroll-behavior:contain}:host *::-webkit-scrollbar{width:10px}:host *::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host *::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host *::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex}:host .zonos--wrapper{overflow:auto;background-color:var(--zonos-elements-gray-50);border-radius:16px;height:100%;min-height:56px}:host .zonos--order-details-header-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:8px}:host .zonos--order-details-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--zonos-elements-gray-50);border:none;display:-ms-flexbox;display:flex;padding:16px 16px 0 16px;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .zonos--order-details-header:focus-visible{outline:none}:host .zonos--order-details-wrapper{position:relative;padding:0 16px 16px 16px}:host .zonos--invoice-order-details-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:16px}:host .zonos--invoice-order-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16px}:host .zonos--invoice-order-info .zonos--invoice-order-details-row>*{-ms-flex:1 1 150px;flex:1 1 150px}:host .zonos--invoice-order-info .zonos--invoice-order-details-column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px}:host .zonos--invoice-order-info .zonos--invoice-order-shipping-info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:0}";const N=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.paypalSessionFailed=e(this,"paypalSessionFailed",7),this.paypalSessionDone=e(this,"paypalSessionDone",7),this.storeUnsubscribeList=[],this.continueLoading=!1,this.showErrorBanner=!1,this.hasStripePaymentError=!1,this.stagingOrderCreateErrorMessage="",this.internalContinueLoading=this.continueLoading,this.handleValidate=()=>{var o;return!!(null===(o=a.stripePaymentEventData)||void 0===o?void 0:o.complete)},this.continueClickHandler=async({currencyCode:o})=>{var e,s;if(!this.handleValidate())return null===(e=a.stripeBillingAddressElement)||void 0===e||e.getValue(),this.showErrorBanner=!0,null===(s=a.stripeElements)||void 0===s||s.submit(),void setTimeout((()=>{var o;null===(o=this.ele.querySelector("zonos-banner"))||void 0===o||o.scrollIntoView({behavior:"smooth"})}),10);a.checkoutSettlementCurrency=o,b("zonos-checkout-payment-info"),this.continueClicked.emit()},this.copyCardToClipboard=async o=>{try{await navigator.clipboard.writeText(o)}catch(e){const s=document.createElement("textarea");s.style.position="fixed",s.style.left="-1000px",s.style.top="-1000px",s.style.width="1px",s.style.height="1px",s.value=o,s.id="zonos-copy-card-number",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}window.Zonos.showNotification({message:v("Card number copied to clipboard"),timeout:4e3,type:"success"})},this.placeTestOrder=async()=>{this.internalContinueLoading=!0;const{errors:o}=await $();if(o.length)return this.stagingOrderCreateErrorMessage=o[0]||"Failed to create staging order. Please try again.",void(this.internalContinueLoading=!1);this.internalContinueLoading=!1,m()}}continueLoadingWatcher(){this.internalContinueLoading=this.continueLoading}stripePaymentErrorWatcher(){this.hasStripePaymentError&&setTimeout((()=>{var o;null===(o=this.ele.querySelector("zonos-banner"))||void 0===o||o.scrollIntoView({behavior:"smooth"})}),50)}componentWillLoad(){this.storeUnsubscribeList=[f("currency",(()=>{y({currency:p.currency})}))],y({currency:p.currency})}disconnectedCallback(){this.storeUnsubscribeList.forEach((o=>o()))}render(){var o;if(this.hasStripePaymentError=a.hasPaymentError,!a.stripeElements)return null;if(!a.clientSecret)return null;this.showErrorBanner&&(this.showErrorBanner=!this.handleValidate());const e=L(),i=p.isStagingMode||S(),r="external_paypal"===(null===(o=a.stripePaymentEventData)||void 0===o?void 0:o.value.type);return s(n,{class:"zonos--checkout-payment zonos--elements"},s("div",{class:"zonos--group"},s("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},v("Payment method")),(()=>{if(i){const o=w.appearance.theme;return s(t,null,this.stagingOrderCreateErrorMessage&&s("zonos-banner",{class:"zonos--error-banner",intent:"error"},this.stagingOrderCreateErrorMessage),s("zonos-empty-state-payment",{emptyStateText:v("No payment method needed for staging"),theme:o}),s("div",{class:"zonos--group-btn"},s("zonos-button",{backgroundColor:this.submitBtnColor,loading:this.internalContinueLoading,onClick:()=>{this.placeTestOrder()},size:"lg",variant:this.submitBtnType},v("Place test order"))))}return a.isFetchingSession||D.isFetchingPayorInfo?null:s(t,null,this.showErrorBanner&&s("zonos-banner",{class:"zonos--error-banner",intent:"error"},v("Missing required fields. Make sure all fields are completed.")),this.hasStripePaymentError&&s("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},a.customErrorMessage||v("We couldn't complete your payment. Please verify the payment details and try again.")),g.paypalErrorMessage&&s("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},g.paypalErrorMessage),s("zonos-payment",null),s("div",{class:"zonos--group-btn"},!r&&s(t,null,s("zonos-button",{backgroundColor:this.submitBtnColor,bold:!0,isDisabled:this.continueLoading&&"USD"===a.checkoutSettlementCurrency,loading:this.continueLoading&&"USD"!==a.checkoutSettlementCurrency,onClick:async()=>{p.checkoutSession?await this.continueClickHandler({currencyCode:p.checkoutSession.subtotals.presentmentCurrencyCode}):H("Checkout session is not found")},size:"lg",variant:this.submitBtnType},v("Pay [orderTotal]",{orderTotal:B({amount:D.amountTotalDue||0,isForeign:!0})})),a.shouldRenderPayInUsdButton&&s("zonos-button",{class:"zonos--pay-in-base-currency-btn",isDisabled:this.continueLoading&&"USD"!==a.checkoutSettlementCurrency,loading:this.continueLoading&&"USD"===a.checkoutSettlementCurrency,onClick:async()=>{await this.continueClickHandler({currencyCode:"USD"})},size:"lg",variant:"subtle"},v("Click to pay in USD"))),s("zonos-paypal-payment",{onPaypalSessionDone:({detail:{orderId:o}})=>{this.paypalSessionDone.emit(o)},onPaypalSessionFail:()=>this.paypalSessionFailed.emit(),style:{display:r?"block":"none"}})),e&&s("zonos-card",{backgroundColor:"gray-100",borderRadius:12,class:"zonos--test-cards"},s("zonos-v-stack",{spacing:16},s("div",null,s("zonos-text",{type:"semiBoldLabel"},v("Test cards")),s("zonos-text",{textColor:"gray-700"},v("Click to copy the card number. Use any future expiration date and three number CVC."))),s("zonos-button",{icon:s("zonos-icon",{content:'<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M15.342 10.21a.75.75 0 0 0-1.184-.92l-2.978 3.829-1.4-1.4a.75.75 0 1 0-1.06 1.061l1.8 1.8a1 1 0 0 0 1.496-.093l3.326-4.277Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>'}),justifyContent:"flex-start",onClick:()=>this.copyCardToClipboard("4242424242424242")},v("Success")," (****4242)"),s("zonos-button",{icon:s("zonos-icon",{content:'<svg color="var(--zonos-elements-gray-1000)" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="var(--zonos-elements-gray-1000)" d="M14.475 10.586a.75.75 0 1 0-1.06-1.06L12 10.938l-1.414-1.414a.75.75 0 0 0-1.06 1.06L10.938 12l-1.414 1.414a.75.75 0 1 0 1.06 1.06L12 13.062l1.414 1.414a.75.75 0 0 0 1.06-1.06L13.062 12l1.414-1.414Z"/><path fill="var(--zonos-elements-gray-1000)" fill-rule="evenodd" d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-6.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0Z" clip-rule="evenodd"/></svg>'}),justifyContent:"flex-start",onClick:()=>this.copyCardToClipboard("4000000000000002")},v("Failure")," (****0002)")),s("zonos-notification",null)))})()))}get ele(){return i(this)}static get watchers(){return{continueLoading:["continueLoadingWatcher"],hasStripePaymentError:["stripePaymentErrorWatcher"]}}};N.style=".sc-zonos-invoice-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-payment-h *.sc-zonos-invoice-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-payment-h img.sc-zonos-invoice-payment{max-width:100%}.sc-zonos-invoice-payment-h dl.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h dd.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h1.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h2.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h3.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h4.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h5.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h h6.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h hr.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h figure.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h p.sc-zonos-invoice-payment,.sc-zonos-invoice-payment-h pre.sc-zonos-invoice-payment{margin:0}.sc-zonos-invoice-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1}.sc-zonos-invoice-payment-h .zonos--title.sc-zonos-invoice-payment{margin-bottom:24px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment{margin-bottom:20px;overflow:auto;padding:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1;flex:1;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar{width:10px}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-payment-h .zonos--group.sc-zonos-invoice-payment::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-payment-h .zonos--payment-error-banner.sc-zonos-invoice-payment{margin-bottom:8px}.sc-zonos-invoice-payment-h .zonos--error-banner.sc-zonos-invoice-payment{margin-bottom:16px}.sc-zonos-invoice-payment-h zonos-button.sc-zonos-invoice-payment{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-invoice-payment-h .zonos--pay-in-base-currency-btn.sc-zonos-invoice-payment{-webkit-box-shadow:none;box-shadow:none}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;gap:12px;bottom:-5px;padding-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0))}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-text.sc-zonos-invoice-payment{text-align:center}.sc-zonos-invoice-payment-h .zonos--group-btn.sc-zonos-invoice-payment zonos-button.sc-zonos-invoice-payment{width:100%}.sc-zonos-invoice-payment-h .zonos--test-cards.sc-zonos-invoice-payment{margin-top:auto;padding-top:16px}";const O=class{constructor(e){o(this,e),this.mobile=!1,this.tablet=!1,this.collapsed=!1,this.isMobile=!1,this.isTablet=!1,this.isLoading=!0}handleWindowResize(){this.isMobile=Z(this.mobile),this.isTablet=_(this.tablet)}componentWillLoad(){this.handleWindowResize(),setTimeout((()=>{this.isLoading=!1}),1e3)}render(){const o=this.isMobile?"gray-1000":"gray-800";return s(n,{key:"60da23c47f39a94478f1eb83e003b788aab3b98c",class:U(["zonos--invoice-review zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"])},s("div",{key:"70bbb1973ec1c7197da666ba30be6dc6a20bd386",class:"zonos--title"},s("zonos-text",{key:"35ffffa411ccde7c702b5d5ac3f11d7a8d62916f",textColor:o,type:"semiBoldLabel"},v("Pay [organizationName]",{organizationName:w.organizationName}))),s("div",{key:"c965e47314d1c3178b1dd2e54e835c0b91966a81",class:"zonos--total-pay"},F({content:s("zonos-text",{type:"secondaryPageHeader"},B({amount:D.amountTotalDue||0,isForeign:!0})),isLoading:D.isFetchingPayorInfo,skeletonHeight:"36px",skeletonWidth:"150px"})))}static get assetsDirs(){return["assets"]}};O.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{position:-webkit-sticky;position:sticky;top:0;background-color:var(--zonos-elements-gray-0);z-index:1}:host .zonos--total-pay{margin:8px 0 24px;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;gap:48px}:host .zonos--total-pay zonos-text{-ms-flex-negative:0;flex-shrink:0}:host .zonos--total-pay::after{content:"";position:relative;height:1px;width:100%;background:var(--zonos-elements-gray-200)}:host(.mobile),:host(.tablet){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;padding:4px 0;background-color:transparent;position:relative}:host(.mobile) .zonos--total-pay,:host(.tablet) .zonos--total-pay{margin:0}';export{R as zonos_invoice_finish,T as zonos_invoice_footer,W as zonos_invoice_order_details,N as zonos_invoice_payment,O as zonos_invoice_review}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __spreadArray=this&&this.__spreadArray||function(t,o,s){if(s||arguments.length===2)for(var e=0,n=o.length,a;e<n;e++){if(a||!(e in o)){if(!a)a=Array.prototype.slice.call(o,0,e);a[e]=o[e]}}return t.concat(a||Array.prototype.slice.call(o))};System.register(["./p-989d3af9.system.js","./p-
|
|
1
|
+
var __spreadArray=this&&this.__spreadArray||function(t,o,s){if(s||arguments.length===2)for(var e=0,n=o.length,a;e<n;e++){if(a||!(e in o)){if(!a)a=Array.prototype.slice.call(o,0,e);a[e]=o[e]}}return t.concat(a||Array.prototype.slice.call(o))};System.register(["./p-989d3af9.system.js","./p-a8b1c81e.system.js","./p-b2ae8eb7.system.js","./p-d45285aa.system.js","./p-23e7c655.system.js","./p-1aa93d1e.system.js","./p-3b598f1d.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-909e2bc3.system.js","./p-23d497e3.system.js"],(function(t){"use strict";var o,s,e,n,a,i,r,h,c;return{setters:[function(t){o=t.r;s=t.d;e=t.h;n=t.H},function(t){a=t.e},function(t){i=t.c},function(t){r=t.f},function(t){h=t.c},function(t){c=t.s},function(){},function(){},function(){},function(){},function(){}],execute:function(){var f=":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 .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column{padding:8px;padding-left:0;font-size:var(--zonos-elements-font-size-base)}:host .zonos--cart-table .zonos--column:first-child{width:48px}:host .zonos--cart-table td{vertical-align:middle}:host .zonos--cart-item-price zonos-text{white-space:nowrap}:host img{min-width:40px;margin-top:6px;-webkit-box-shadow:0 0 0 1px rgba(110, 110, 120, 0.1), 0 1px 2px 0 rgba(10, 10, 11, 0.06), 0 1px 3px 0 rgba(10, 10, 11, 0.1);box-shadow:0 0 0 1px rgba(110, 110, 120, 0.1), 0 1px 2px 0 rgba(10, 10, 11, 0.06), 0 1px 3px 0 rgba(10, 10, 11, 0.1);border-radius:10px}";var l=f;var m=t("zonos_collect_cart_items",function(){function t(t){o(this,t);this.errorImages=[]}t.prototype.render=function(){var t=this;var o=s("./assets/empty-item.jpeg");var r=a.items.filter((function(t){return!t.isRestricted}));return e(n,{key:"2f5507537492851b67a5204ab68ce2f938899f23",class:"zonos--collect-cart-items zonos--elements"},e("table",{key:"e648cda9d4c111ecde60291f420178e4e4230b50",class:"zonos--cart-table"},e("tbody",{key:"b266291e61d0df5c0ea3ae8240a3bfb6147edbb4"},r.map((function(s){var n=s.imageUrl;var a=i(s.name);return e("tr",{class:"zonos--collect-cart-item"},e("td",{class:"zonos--column zonos--cart-item-image"},n&&!t.errorImages.includes(n)?e("img",{alt:s.name,onError:function(){t.errorImages=__spreadArray(__spreadArray([],t.errorImages,true),[n],false)},src:s.imageUrl,style:{"min-width":"40px"},width:40}):e("img",{alt:s.name,src:o,width:40})),e("td",{class:"zonos--column zonos--cart-item-name"},e("div",null,a.map((function(t){return e("zonos-text",{type:"semiBoldLabel"},t)})))))})))))};Object.defineProperty(t,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return t}());m.style=l;var d=":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-direction:row;flex-direction:row;gap:var(--spacing, 24px)}";var p=d;var u=t("zonos_h_stack",function(){function t(t){o(this,t);this.spacing=24}t.prototype.render=function(){return e(n,{key:"8c80b04f02ebafcc0529bbc8a30fb71dae591a81",style:{"--spacing":"".concat(this.spacing,"px"),"--zonos--font-family":r()}},e("slot",{key:"9840c220581a016349627a61efdf9a4dc3f68bc9"}))};return t}());u.style=p;var b=":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:inline-block;background:var(--zonos-elements-gray-200);border-radius:var(--zonos-elements-radius-12);width:var(--zonos--skeleton-width);height:var(--zonos--skeleton-height);min-height:var(--zonos--skeleton-height);max-width:100%}";var y=b;var g=t("zonos_skeleton",function(){function t(t){o(this,t);this.skeletonWidth="100%";this.skeletonHeight="14px"}t.prototype.render=function(){return e(n,{key:"dc65462865ede6e9cb5a02f5c4f6bf43c550d0c7",class:h(["zonos--elements zonos--skeleton"]),style:c({"--zonos--skeleton-height":this.skeletonHeight,"--zonos--skeleton-width":this.skeletonWidth})})};return t}());g.style=y}}}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=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(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-d45285aa.system.js","./p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=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(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-d45285aa.system.js","./p-a8b1c81e.system.js","./p-3b598f1d.system.js","./p-01174496.system.js","./p-909e2bc3.system.js","./p-d938f42f.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c,s,l,d,f,v,p,w,y;return{setters:[function(n){r=n.z;e=n.c},function(n){t=n.t;o=n.A;i=n.c;a=n.e;u=n.v;c=n.r;s=n.j},function(n){l=n.t;d=n.s},function(n){f=n.h;v=n.l;p=n.j},function(n){w=n.t},function(n){y=n.l}],execute:function(){var h=this;
|
|
2
2
|
/*!
|
|
3
3
|
* paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
|
|
4
4
|
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as o}from"./p-dadd3f97.js";import{o as r,d as n}from"./p-59bc0ca9.js";const u=({amount:u,isForeign:i})=>{var t,a;const d=(null===(t=o.exchangeRate)||void 0===t?void 0:t.rate)||1,c=i?u:r(u),s=o.currency;if((null===(a=o.items[0])||void 0===a?void 0:a.currencyCode)===s)return n({amount:c,currency:s});const v=o.displayBaseCurrency,e=(()=>{var r,n;return o.displayBaseCurrency&&(null===(r=o.exchangeRate)||void 0===r?void 0:r.sourceCurrencyCode)?null===(n=o.exchangeRate)||void 0===n?void 0:n.sourceCurrencyCode:o.currency})();return n(i?{amount:v?c/d:c,currency:e}:{amount:v?c:c*d,currency:e})};export{u as r}
|