@zonos/elements 1.3.282 → 1.3.283
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-dc31b242.js → cart-a1c00090.js} +1 -1
- package/dist/cjs/{collect-463ab3d7.js → collect-e61eafca.js} +2 -2
- package/dist/cjs/{getMissingRequiredShippingFields-7cd21100.js → getMissingRequiredShippingFields-a6c4f625.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-d14b9d71.js → hasInclusivePrice-e7b57e02.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-8c995041.js → invoice-ead45797.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-491121ad.js → localization-783849c8.js} +2 -0
- package/dist/cjs/{paypal-2a4c374c.js → paypal-e1548f40.js} +2 -2
- package/dist/cjs/{placeTestOrder-a940a2e9.js → placeTestOrder-d99b1fe2.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-ab39875a.js → renderCheckoutCurrency-c942fcba.js} +2 -2
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +94 -53
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +12 -5
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +7 -7
- 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-elements.cjs.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/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +11 -4
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +17 -5
- package/dist/collection/components/store/hello/localization.js +2 -0
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +52 -48
- package/dist/collection/components/utils/checkout/getAddressCountryOptions.js +23 -0
- package/dist/esm/{cart-5282f6c1.js → cart-93c36159.js} +1 -1
- package/dist/esm/{collect-fdbab973.js → collect-42d4757a.js} +2 -2
- package/dist/esm/{getMissingRequiredShippingFields-bdeecbff.js → getMissingRequiredShippingFields-ebdccdcf.js} +1 -1
- package/dist/esm/{hasInclusivePrice-161e203f.js → hasInclusivePrice-4c12548f.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-cf6ad79e.js → invoice-71471339.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-0953a048.js → localization-754e7e8b.js} +2 -0
- package/dist/esm/{paypal-7c82eac4.js → paypal-b1410e02.js} +2 -2
- package/dist/esm/{placeTestOrder-6a746207.js → placeTestOrder-4267cafd.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-44f897a1.js → renderCheckoutCurrency-9a81e41c.js} +2 -2
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +94 -53
- package/dist/esm/zonos-address-display_2.entry.js +12 -5
- package/dist/esm/zonos-address_4.entry.js +2 -2
- package/dist/esm/zonos-airwallex-payment.entry.js +3 -3
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +7 -7
- 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-elements.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/zonos-policy-consent_2.entry.js +3 -3
- package/dist/esm-es5/{cart-5282f6c1.js → cart-93c36159.js} +1 -1
- package/dist/esm-es5/{collect-fdbab973.js → collect-42d4757a.js} +1 -1
- package/dist/esm-es5/{getMissingRequiredShippingFields-bdeecbff.js → getMissingRequiredShippingFields-ebdccdcf.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-161e203f.js → hasInclusivePrice-4c12548f.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-cf6ad79e.js → invoice-71471339.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{localization-0953a048.js → localization-754e7e8b.js} +1 -1
- package/dist/esm-es5/{paypal-7c82eac4.js → paypal-b1410e02.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-6a746207.js → placeTestOrder-4267cafd.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-44f897a1.js → renderCheckoutCurrency-9a81e41c.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +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-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.d.ts +1 -0
- package/dist/types/components/store/hello/localization.d.ts +7 -0
- package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +9 -13
- package/dist/types/components/utils/checkout/getAddressCountryOptions.d.ts +29 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-dfd83cff.entry.js → p-007ff76a.entry.js} +1 -1
- package/dist/zonos-elements/{p-1cf5e2ce.system.entry.js → p-065f3f66.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-543b25f9.entry.js → p-07c21940.entry.js} +1 -1
- package/dist/zonos-elements/{p-fb8dc23f.system.js → p-0d183f19.system.js} +1 -1
- package/dist/zonos-elements/{p-aa37f436.system.entry.js → p-1180a97c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5953208b.js → p-19bbf4b3.js} +1 -1
- package/dist/zonos-elements/{p-d06486ba.system.entry.js → p-1af510ea.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-646e6b47.system.entry.js → p-1cff471a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1d31b966.system.js → p-22f7120a.system.js} +1 -1
- package/dist/zonos-elements/{p-71fc8a22.js → p-2837bfd2.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-f1aa60fd.system.entry.js → p-29ca1415.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2aebcfa8.system.entry.js +1 -0
- package/dist/zonos-elements/p-33dd7dab.entry.js +1 -0
- package/dist/zonos-elements/{p-68631285.system.entry.js → p-342b062d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c8bc4ede.js → p-38881097.js} +1 -1
- package/dist/zonos-elements/{p-e6e3a303.entry.js → p-39399f67.entry.js} +1 -1
- package/dist/zonos-elements/{p-6f874ed9.entry.js → p-3d902845.entry.js} +1 -1
- package/dist/zonos-elements/{p-76e36d6d.entry.js → p-3dcb3794.entry.js} +1 -1
- package/dist/zonos-elements/p-4a5fa892.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5d6b018c.system.entry.js → p-4a73906a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-323279b8.entry.js → p-4b9c7803.entry.js} +1 -1
- package/dist/zonos-elements/{p-c12ca8fe.system.entry.js → p-4dba0e9b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ca9231a0.system.entry.js → p-58da55e6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-59824ac6.entry.js +1 -0
- package/dist/zonos-elements/{p-c8df5eee.system.entry.js → p-59e4e0b6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cd3f7fd7.system.js → p-5fceef56.system.js} +1 -1
- package/dist/zonos-elements/{p-e57f862d.system.js → p-602de72d.system.js} +1 -1
- package/dist/zonos-elements/{p-a4eddf6c.system.js → p-6325ee77.system.js} +1 -1
- package/dist/zonos-elements/{p-c5bfe522.system.js → p-67251274.system.js} +1 -1
- package/dist/zonos-elements/{p-4417475f.entry.js → p-69871ab6.entry.js} +1 -1
- package/dist/zonos-elements/{p-1cf76dd3.entry.js → p-6be4c473.entry.js} +1 -1
- package/dist/zonos-elements/{p-0287f9cd.system.js → p-72280783.system.js} +1 -1
- package/dist/zonos-elements/{p-c121b2b8.entry.js → p-73d1a554.entry.js} +1 -1
- package/dist/zonos-elements/{p-c9e44c77.system.entry.js → p-76a75da9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-76cdf517.js +1 -0
- package/dist/zonos-elements/p-8eaf1316.js +1 -0
- package/dist/zonos-elements/{p-56e9a29e.entry.js → p-944282af.entry.js} +1 -1
- package/dist/zonos-elements/{p-aa1f3060.system.entry.js → p-97f15546.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-10584546.entry.js → p-9ceb3d1c.entry.js} +1 -1
- package/dist/zonos-elements/{p-7c70e0c7.js → p-a2fe995b.js} +1 -1
- package/dist/zonos-elements/{p-b91a8f31.system.entry.js → p-aa7589de.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3642dd99.entry.js → p-b0482924.entry.js} +1 -1
- package/dist/zonos-elements/{p-28ee0860.system.js → p-b567448d.system.js} +1 -1
- package/dist/zonos-elements/{p-23eee868.entry.js → p-b7a03b08.entry.js} +1 -1
- package/dist/zonos-elements/{p-e101b0de.system.entry.js → p-c43130a7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2394b186.system.js → p-c515bc23.system.js} +1 -1
- package/dist/zonos-elements/{p-30cfc9f4.entry.js → p-c8a48cce.entry.js} +1 -1
- package/dist/zonos-elements/{p-d2cb99ee.system.entry.js → p-cc35d5f8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ab61ef19.system.js → p-cd5638b2.system.js} +2 -2
- package/dist/zonos-elements/p-d68425ad.js +1 -0
- package/dist/zonos-elements/{p-0fb4e032.entry.js → p-d74eda59.entry.js} +1 -1
- package/dist/zonos-elements/{p-95042e71.entry.js → p-d93f4837.entry.js} +1 -1
- package/dist/zonos-elements/{p-d0767f88.entry.js → p-dcf8ab79.entry.js} +1 -1
- package/dist/zonos-elements/{p-f1298203.system.entry.js → p-e2057ab0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1977f4b5.js → p-e2b8936a.js} +1 -1
- package/dist/zonos-elements/{p-8fb15a6b.system.entry.js → p-e8159288.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-59518657.entry.js → p-e8bb4f3b.entry.js} +1 -1
- package/dist/zonos-elements/{p-fdd7ec44.system.entry.js → p-e99654c1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7ab15d20.js → p-f9f3155b.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-193fc2da.entry.js +0 -1
- package/dist/zonos-elements/p-3c62acbd.js +0 -1
- package/dist/zonos-elements/p-5987dea1.js +0 -1
- package/dist/zonos-elements/p-63b462dd.system.entry.js +0 -1
- package/dist/zonos-elements/p-8418aa07.entry.js +0 -1
- package/dist/zonos-elements/p-987b5d8f.js +0 -1
- package/dist/zonos-elements/p-ddd0e703.system.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as e,F as s,a as t,g as n}from"./p-ce75b047.js";import{$ as r,E as a,a0 as i,a1 as l,a2 as c,S as d,a3 as m,a4 as p,I as z}from"./p-5953208b.js";import{l as h,t as g}from"./p-71fc8a22.js";import{z as f,f as x}from"./p-9a417eeb.js";import{r as u}from"./p-5987dea1.js";import{g as y}from"./p-f1aea919.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-34d6eb83.js";import"./p-bcf5cffb.js";const v="POLICIES",b=class{constructor(e){o(this,e)}render(){const o=r();if(!o.length)return null;const n=Intl.ListFormat,i=(n?new n(h.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(o.map((o=>o.name))):o.flatMap(((o,e)=>0===e?[{type:"element",value:o.name}]:[{type:"literal",value:", "},{type:"element",value:o.name}]))).map((s=>{if("literal"===s.type)return s.value;const t=o.find((o=>o.name===s.value));return t?e("a",{href:t.url,onClick:o=>{o.preventDefault(),o.stopPropagation(),window.open(t.url,"_blank","noopener,noreferrer")},rel:"noopener noreferrer",target:"_blank"},s.value):s.value})),l=f.organizationName,c=l?g("I agree to [merchantName]'s [policies]",{merchantName:l,policies:v}):g("I agree to the [policies]",{policies:v}),[d="",m=""]=c.split(v),p=a.showError,z="zonos--policy-consent-error";return e(t,{class:"zonos--policy-consent-host"},e("div",{class:"zonos--policy-consent"+(p?" zonos--policy-consent--error":"")},e("label",{class:"zonos--policy-consent-label"},e("input",{"aria-describedby":p?z:void 0,"aria-invalid":p?"true":"false",checked:a.accepted,class:"zonos--policy-consent-checkbox",disabled:a.locked,onChange:o=>{const e=o.target.checked;a.accepted=e,e?(a.acceptedAt||(a.acceptedAt=(new Date).toISOString()),a.showError=!1):a.acceptedAt=null},type:"checkbox"}),e("span",{class:"zonos--policy-consent-text"},d,e(s,null,i),m))),p&&e("div",{class:"zonos--policy-consent-error",id:z,role:"alert"},g("You must accept the policies to place this order")))}};b.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:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}";const k='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n',w="full",j="custom",C=class{constructor(e){o(this,e),this.enabled=!0,this.customAmountInput="",this.handleUseStoreCreditChange=o=>{i(o),o&&l(!0),c()},this.handleAmountModeChange=o=>{const e=o===w;l(e),e||(this.customAmountInput=""),c()},this.handleCustomAmountChange=o=>{this.customAmountInput=o,d.error=null},this.handleApplyCustomAmount=()=>{const o=parseFloat(this.customAmountInput);!isNaN(o)&&o>0?m(o):m(null),d.error||c()}}async componentWillLoad(){await p()}render(){if(!this.enabled)return null;const{colorPrimary:o}=f.appearance,n=y({}),r=d.availableBalance,a=null!==r&&r>0,i=d.isEnabled,l=d.useFullBalance,c=d.error,m=z(),p=u({amount:null!=r?r:0,isForeign:!0});return e(t,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":n,"--zonos--font-family":x(),"--zonos--primary-color":o}},e("div",{class:"zonos--store-credit-container"},e("div",{class:"zonos--store-credit-header"},e("div",{class:"zonos--store-credit-title-row"},e("div",{class:"zonos--store-credit-title-left"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},e("zonos-icon",{content:k,iconColor:"gray-500",size:22})),e("zonos-text",{type:"semiBoldLabel"},g("Store credit"))),a&&e("div",{class:"zonos--store-credit-balance-badge"},e("zonos-text",{textColor:"gray-600",type:"caption"},p)))),e(s,null,a?e("div",{class:"zonos--store-credit-content"},e("div",{class:"zonos--store-credit-checkbox"},e("zonos-checkbox",{isChecked:i,label:g("Use store credit"),onCheckboxSelected:o=>this.handleUseStoreCreditChange(o.detail),size:16})),i&&e("div",{class:"zonos--store-credit-options"},e("div",{class:"zonos--store-credit-toggle-row"},e("zonos-toggle",{onToggleChanged:o=>this.handleAmountModeChange(o.detail),options:[{label:g("Apply full balance"),value:w},{label:g("Enter amount"),value:j}],value:l?w:j})),!l&&e("div",{class:"zonos--store-credit-custom-amount"},e("div",{class:"zonos--store-credit-custom-amount-row"},e("zonos-input",{inputLabel:g("Enter amount"),inputValue:this.customAmountInput,isError:!!c,onInputChange:o=>this.handleCustomAmountChange(o.detail)}),e("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},g("Apply")))),c&&e("div",{class:"zonos--store-credit-error"},e("zonos-text",{textColor:"red-600",type:"caption"},c)),e("div",{class:"zonos--store-credit-summary"},e("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},g("Amount to apply: [amount]",{amount:u({amount:m,isForeign:!0})}))))):e("div",{class:"zonos--store-credit-empty"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},e("zonos-icon",{content:k,iconColor:"gray-500",size:28})),e("zonos-text",{textColor:"gray-600",type:"caption"},g("No store credit available"))))))}get el(){return n(this)}};C.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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';export{b as zonos_policy_consent,C as zonos_store_credit}
|
|
1
|
+
import{r as o,h as e,F as s,a as t,g as n}from"./p-ce75b047.js";import{$ as r,E as a,a0 as i,a1 as l,a2 as c,S as d,a3 as m,a4 as p,I as z}from"./p-19bbf4b3.js";import{l as h,t as g}from"./p-2837bfd2.js";import{z as f,f as x}from"./p-9a417eeb.js";import{r as u}from"./p-d68425ad.js";import{g as y}from"./p-f1aea919.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-34d6eb83.js";import"./p-bcf5cffb.js";const v="POLICIES",b=class{constructor(e){o(this,e)}render(){const o=r();if(!o.length)return null;const n=Intl.ListFormat,i=(n?new n(h.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(o.map((o=>o.name))):o.flatMap(((o,e)=>0===e?[{type:"element",value:o.name}]:[{type:"literal",value:", "},{type:"element",value:o.name}]))).map((s=>{if("literal"===s.type)return s.value;const t=o.find((o=>o.name===s.value));return t?e("a",{href:t.url,onClick:o=>{o.preventDefault(),o.stopPropagation(),window.open(t.url,"_blank","noopener,noreferrer")},rel:"noopener noreferrer",target:"_blank"},s.value):s.value})),l=f.organizationName,c=l?g("I agree to [merchantName]'s [policies]",{merchantName:l,policies:v}):g("I agree to the [policies]",{policies:v}),[d="",m=""]=c.split(v),p=a.showError,z="zonos--policy-consent-error";return e(t,{class:"zonos--policy-consent-host"},e("div",{class:"zonos--policy-consent"+(p?" zonos--policy-consent--error":"")},e("label",{class:"zonos--policy-consent-label"},e("input",{"aria-describedby":p?z:void 0,"aria-invalid":p?"true":"false",checked:a.accepted,class:"zonos--policy-consent-checkbox",disabled:a.locked,onChange:o=>{const e=o.target.checked;a.accepted=e,e?(a.acceptedAt||(a.acceptedAt=(new Date).toISOString()),a.showError=!1):a.acceptedAt=null},type:"checkbox"}),e("span",{class:"zonos--policy-consent-text"},d,e(s,null,i),m))),p&&e("div",{class:"zonos--policy-consent-error",id:z,role:"alert"},g("You must accept the policies to place this order")))}};b.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:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}";const k='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n',w="full",j="custom",C=class{constructor(e){o(this,e),this.enabled=!0,this.customAmountInput="",this.handleUseStoreCreditChange=o=>{i(o),o&&l(!0),c()},this.handleAmountModeChange=o=>{const e=o===w;l(e),e||(this.customAmountInput=""),c()},this.handleCustomAmountChange=o=>{this.customAmountInput=o,d.error=null},this.handleApplyCustomAmount=()=>{const o=parseFloat(this.customAmountInput);!isNaN(o)&&o>0?m(o):m(null),d.error||c()}}async componentWillLoad(){await p()}render(){if(!this.enabled)return null;const{colorPrimary:o}=f.appearance,n=y({}),r=d.availableBalance,a=null!==r&&r>0,i=d.isEnabled,l=d.useFullBalance,c=d.error,m=z(),p=u({amount:null!=r?r:0,isForeign:!0});return e(t,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":n,"--zonos--font-family":x(),"--zonos--primary-color":o}},e("div",{class:"zonos--store-credit-container"},e("div",{class:"zonos--store-credit-header"},e("div",{class:"zonos--store-credit-title-row"},e("div",{class:"zonos--store-credit-title-left"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},e("zonos-icon",{content:k,iconColor:"gray-500",size:22})),e("zonos-text",{type:"semiBoldLabel"},g("Store credit"))),a&&e("div",{class:"zonos--store-credit-balance-badge"},e("zonos-text",{textColor:"gray-600",type:"caption"},p)))),e(s,null,a?e("div",{class:"zonos--store-credit-content"},e("div",{class:"zonos--store-credit-checkbox"},e("zonos-checkbox",{isChecked:i,label:g("Use store credit"),onCheckboxSelected:o=>this.handleUseStoreCreditChange(o.detail),size:16})),i&&e("div",{class:"zonos--store-credit-options"},e("div",{class:"zonos--store-credit-toggle-row"},e("zonos-toggle",{onToggleChanged:o=>this.handleAmountModeChange(o.detail),options:[{label:g("Apply full balance"),value:w},{label:g("Enter amount"),value:j}],value:l?w:j})),!l&&e("div",{class:"zonos--store-credit-custom-amount"},e("div",{class:"zonos--store-credit-custom-amount-row"},e("zonos-input",{inputLabel:g("Enter amount"),inputValue:this.customAmountInput,isError:!!c,onInputChange:o=>this.handleCustomAmountChange(o.detail)}),e("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},g("Apply")))),c&&e("div",{class:"zonos--store-credit-error"},e("zonos-text",{textColor:"red-600",type:"caption"},c)),e("div",{class:"zonos--store-credit-summary"},e("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},g("Amount to apply: [amount]",{amount:u({amount:m,isForeign:!0})}))))):e("div",{class:"zonos--store-credit-empty"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},e("zonos-icon",{content:k,iconColor:"gray-500",size:28})),e("zonos-text",{textColor:"gray-600",type:"caption"},g("No store credit available"))))))}get el(){return n(this)}};C.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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';export{b as zonos_policy_consent,C as zonos_store_credit}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-47a1d469.system.js","./p-1d31b966.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-30e9a6d7.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.l;a=e.j;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2,{errors:n,json:o}]}}))}))};var A=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),O=A.onChange,C=A.reset,k=A.state;e("S",k);var I=e("T",(function(){C()}));var T=function(e){d("Store credit balance from session","info",e);k.availableBalance=e};var P=e("a4",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;T(i);return[2]}}))}))}));var E=e("y",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);k.error=n;return[2,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});k.isApplying=true;k.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}]}k.appliedAmount=a.amountApplied;k.remainingBalance=a.remainingBalance;k.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}];case 4:return[2]}}))}))}));var N=e("a0",(function(e){k.isEnabled=e;k.error=null;if(!e){k.amountToApply=null}}));var j=e("a3",(function(e){if(e===null){k.amountToApply=null;k.error=null;return}if(e<=0){k.error="Amount must be greater than zero";return}if(k.availableBalance!==null&&e>k.availableBalance){k.error="Amount exceeds available balance";return}var r=Ze.total+(Ze.storeCredit||0);if(e>r){k.error="Amount exceeds order total";return}k.error=null;k.amountToApply=e}));var D=e("a1",(function(e){k.useFullBalance=e;k.error=null;if(e&&k.availableBalance!==null){var r=Ze.total+(Ze.storeCredit||0);var n=Math.min(k.availableBalance,r);k.amountToApply=n}else if(!e){k.amountToApply=null}}));var L=function(){if(!k.isEnabled||k.amountToApply===null){return{mode:"NONE"}}if(k.useFullBalance){return{mode:"FULL"}}return{amount:k.amountToApply,mode:"PARTIAL"}};var x=e("I",(function(){if(!k.isEnabled||k.availableBalance===null){return 0}if(k.useFullBalance){return Math.min(k.availableBalance,Ze.total+(Ze.storeCredit||0))}return k.amountToApply||0}));var R=e("z",(function(){return k.amountToApply!==null&&k.amountToApply>0&&Ze.storeCredit>0&&Ze.total<=0}));var U=e("B",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);k.error=i;return[2,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;k.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}];case 4:return[2]}}))}))}));var z=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];var B={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var F=r({accepted:false,acceptedAt:null,locked:false,showError:false}),J=F.reset,M=F.state;e({p:J,E:M});var q=e("$",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return z.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(B[n]),url:a});return r}),[])}));var W=e("w",(function(){return q().length>0}));var Y=e("U",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var H=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};var K=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=ce.stripeLinkEventData;var s=ce.stripeAddressEventData;var u=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}var d=H({currentAddress:s,translatedAddress:ce.translatedAddress.address});var l=Y({name:d.name}),c=l.firstName,v=l.lastName;var f=H({currentAddress:u,translatedAddress:ce.translatedAddress.address});var p=Y({name:f.name}),m=p.firstName,h=p.lastName;var w=a()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:m,lastName:h,phone:f.phone},cartCurrencyCode:(r=Ze.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||i.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Ze.promoCode?[{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var G=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var r=ce.stripeLinkEventData;var n=ce.stripeAddressEventData;var o=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}var i=H({currentAddress:n,translatedAddress:ce.translatedAddress.address});var a=Y({name:i.name}),s=a.firstName,u=a.lastName;var l=H({currentAddress:o,translatedAddress:ce.translatedAddress.address});var c=Y({name:l.name}),v=c.firstName,f=c.lastName;var p=Ze.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Ze.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:r===null||r===void 0?void 0:r.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Ze.items,landedCostAdjustments:m,shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=G();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:f["vercel"]},{promoCode:Ze.promoCode})];case 1:s=v.sent();if(!s||!((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var X=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,V(t)];case 1:o=d.sent();return[2,o];case 2:return[4,c("/api/zonos-elements/calculate-landed-cost",{body:G(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){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 Z=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,c("/api/zonos-elements/cart-calculate-landed-cost",{body:K(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.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")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var $=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3,2];return[4,X(e)];case 1:n=a.sent();return[2,n];case 2:return[4,Z({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var ee=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,a,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&!window.Zonos.zonosConversionTest){return[2]}d=i.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}});return[2]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:a}),organizationId:v};return[4,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var re=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}return Object.keys(t).length?t:undefined};var ne=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;var l=Y({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=Y({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:re({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),billingAddress:!i?re({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};var te=e("_",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));var oe=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(i){switch(i.label){case 0:return[4,S()];case 1:r=i.sent(),n=r.errors,t=r.json;if(n.length||!t){v("Failed to retrieve checkout session info before confirming payment ",n);void h({endpoint:"validateCheckoutSession",errors:n.map((function(e){return e.message})),metadata:{allLogs:l}});return[2,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2,{errorMessage:o('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 ie=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ae=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var se={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var ue=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",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:{}}}})),de=ue.onChange,le=ue.reset,ce=ue.state;e({H:de,b:ce});var ve=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},ie({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},ae({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:m,customerSessionClientSecret:ce.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:i.selectedLocale}};var fe=e("q",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var pe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var me=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var he=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=ce.clientSecret;if(!ce.stripe){d("Skip. Stripe is not initialized");return[2]}o=ve({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(ce.stripeElementsOptions);if(!ce.stripeElements||!ce.stripeElementsForBillingAddress){ce.stripeElementsForBillingAddress=(r=ce.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");ce.stripeElements=(n=ce.stripe)===null||n===void 0?void 0:n.elements(o);ce.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){ce.stripeElements.update(o);ce.stripeElementsForBillingAddress.update(o);ce.stripeElementsOptions=o;void ce.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var we=e("F",(function(){sessionStorage.removeItem("zonos--client-secret");le();ce.stripe=window.Zonos.stripe}));var ye=function(){var e,r,n,t;var o=JSON.stringify((e=ce.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!ce.stripeShippingSameAsBilling&&JSON.stringify((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ge=function(){var e,r,n,t,o,i,a,s;var u=(e=Ze.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Ze.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;if(!u||!d){return false}if(ce.partyShippingId!==u||ce.partyBillingId!==d){return true}var l=JSON.stringify((n=ce.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=ce.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!ce.stripeShippingSameAsBilling&&JSON.stringify((a=ce.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=ce.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=ce.taxIdUsedWhenAsyncAddressUpdate!==ce.taxId;var p=ce.companyNameUsedWhenAsyncAddressUpdate!==ce.companyName;return l||c||v||f||p};var be=e("K",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=Y({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var _e=e("X",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=ce.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!ce.stripeShippingSameAsBilling&&!((r=ce.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!ce.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Ze.landedCostData){return[2,{partiesCreated:false}]}i=(n=Ze.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=ge();if(!a){return[2,{partiesCreated:false}]}s=be({address:ce.stripeAddressEventData.value.address,firstName:ce.stripeAddressEventData.value.firstName,lastName:ce.stripeAddressEventData.value.lastName,name:ce.stripeAddressEventData.value.name,phone:ce.stripeAddressEventData.value.phone});u=ce.stripeShippingSameAsBilling?s:be({address:ce.stripeBillingAddressEventData.value.address,firstName:ce.stripeBillingAddressEventData.value.firstName,lastName:ce.stripeBillingAddressEventData.value.lastName,name:ce.stripeBillingAddressEventData.value.name,phone:ce.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:ce.companyName,email:((o=ce.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:ce.shortAddressCode,taxId:ce.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2,{partiesCreated:false}]}ce.companyNameUsedWhenAsyncAddressUpdate=ce.companyName;ce.stripeAddressUsedWhenAsyncAddressUpdate=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenAsyncAddressUpdate=ce.stripeBillingAddressEventData;ce.taxIdUsedWhenAsyncAddressUpdate=ce.taxId;ce.partyBillingId=m.billToPartyId;ce.partyShippingId=m.shipToPartyId;Ze.partiesData=Ze.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2,{partiesCreated:true}]}}))}))}));var Se=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Ae=function(){var e,r;var n=JSON.stringify((e=ce.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=ce.stripeAddressEventData&&JSON.stringify(Se(ce.stripeAddressEventData.value))!==JSON.stringify(ce.stripeAddressUsedWhenFetchingLC);var o=!ce.stripeShippingSameAsBilling&&ce.stripeBillingAddressEventData&&JSON.stringify(Se(ce.stripeBillingAddressEventData.value))!==JSON.stringify(ce.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};var Oe=function(){var e;var r=Ze.landedCostData&&((e=Ze.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Ze.subtotal;var n=Ae();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});return!Ze.landedCostData&&!ce.isFetchingLandedCost||n||r};var Ce=e("W",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Ze.addressFormRenderType==="stripe"){return a||s}return s}));var ke=function(){var e,r,n,t;var o=!!((e=ce.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=ce.stripeShippingSameAsBilling?i:!!((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ce(s);if(i&&a&&o){return true}if(!u||!ce.stripeAddressEventData){return i&&a&&o}var d=ce.stripeAddressEventData.value.address.line1.length>0;var l=ce.stripeAddressEventData.value.firstName&&ce.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&ce.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&ce.stripeAddressEventData.value.address.postal_code.length>=3;var f=ce.stripeAddressEventData.value.phone&&ce.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var Ie=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;ce.fetchingLandedCostAbortController=r;pr();return[4,$(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;Ze.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Ze.shippingData=te((d===null||d===void 0?void 0:d.filter(Boolean))||[]);rr(a);ce.fetchingLandedCostAbortController=null;Ze.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];Ze.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void ee({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Ze.promoCodeApplied&&!Ze.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Ze.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Ze.promoCode)}return[2]}}))}))};var Te=e("u",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=ke();if(!u){return[2,{isRequestNotReady:true}]}if(s){(r=ce.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();ce.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){ce.isFetchingLandedCost=false;setTimeout((function(){ce.isFetchingLandedCost=true}),300)}else{ce.isFetchingLandedCost=true}if(ce.stripeAddressEventData){ce.stripeAddressUsedWhenFetchingLC={countryCode:ce.stripeAddressEventData.value.address.country,postalCode:ce.stripeAddressEventData.value.address.postal_code,state:ce.stripeAddressEventData.value.address.state}}if(ce.stripeBillingAddressEventData){ce.stripeBillingAddressUsedWhenFetchingLC={countryCode:ce.stripeBillingAddressEventData.value.address.country,postalCode:ce.stripeBillingAddressEventData.value.address.postal_code,state:ce.stripeBillingAddressEventData.value.address.state}}if(ce.stripeLinkEventData){ce.stripeLinkUsedWhenFetchingLC=Object.assign({},ce.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);pr();return[4,Ie()];case 2:w.sent();d=(n=Ze.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Ze.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){ir({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:f=w.sent();Ze.landedCostData=[];Ze.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3,6];if(!(i<1))return[3,5];return[4,Te(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=ce.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3,7];case 7:ce.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,Te({applyingPromocode:true})];case 1:o.sent();if(Ze.step==="payment"){wr()}return[4,_e()];case 2:o.sent();n=(e=Ze.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2]}return[4,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2]}}))}))}));var Ee=e("Q",(function(){Ze.promoCode="";sessionStorage.removeItem("zonos--promo-code");Ze.promoCodeError=false;Ze.promoCodeApplied=false}));var Ne=e("P",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Ze.step==="payment"){wr()}Ee();return[4,Pe()];case 1:e.sent();return[2]}}))}))}));var je=e("R",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;switch(e){case"succeeded":{r=[o("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."),"",o("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(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("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.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));var De=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3,2];return[4,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!u.available||u.status===204){return[2,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){ce.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4,t({items:Ze.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ze.items}});throw l;case 6:return[2]}}))}))}));var Le=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2]}return[4,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var xe=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=je(f),n=r.isError,t=r.messages;return[2,{error:n,messages:t}]}i=c||ce.clientSecret;if(!ce.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[o("Something went wrong.")]}]}if(!i.includes("_secret_")){return[2,{error:true,messages:[o("Something went wrong.")]}]}return[4,ce.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=je(s),d=u.isError,l=u.messages;return[2,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("C",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=ce.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=ce.stripeElements;s=ce.stripe;u=ce.clientSecret;ce.customErrorMessage=null;if(!((n=Ze.selectedLandedCost)===null||n===void 0?void 0:n.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,oe()];case 1:l=h.sent();if(!l.valid){ce.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void ee({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var Ue=function(){if(!M.accepted){return null}var e=q();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:M.acceptedAt||(new Date).toISOString(),locale:i.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};var ze=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(se).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var Be=e("n",(function(){var e;var r=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Ze.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:i.selectedLocale}],paymentProcessor:ze(),presentmentCountryCode:i.selectedCountryCode,skipPaymentIntent:ce.skipPaymentIntent,varianceTestInput:n};return o}));var Fe=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}return[4,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}sr(i.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var Je=e("j",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,a,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!i.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}ce.isFetchingSession=true;n=Be();d("Checkout session body","info",n);return[4,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,a=t.json;ce.isFetchingSession=false;if(o.length||!a){s=(e=o.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.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2,false]}u=a.checkoutSessionCreate;sr(u);ir({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Ze.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var Me=e("x",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){v("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:ce.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==ce.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var qe=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,a;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:ce.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:i.selectedLocale}],presentmentCountryCode:m,shipToPartyId:ce.partyShippingId,skipPaymentIntent:ce.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:a}]}return[2,{errors:[],json:a}]}}))}))};var We=e("J",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=Ue();if(!e){return[2,{errors:[]}]}if(!t.checkoutSessionId){return[2,{errors:[]}]}return[4,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2,{errors:[]}]}}))}))}));var Ye=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};var He=e("V",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=ne({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:ce.stripeAddressEventData,stripeBillingAddressEventData:ce.stripeBillingAddressEventData,stripeShippingSameAsBilling:ce.stripeShippingSameAsBilling});if(!i){ce.translatedAddress={address:{},billingAddress:{}};return[2]}a=ye();if(!a){return[2]}return[4,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));ce.translatedAddress={address:{},billingAddress:{}};return[2]}ce.stripeAddressUsedWhenValidatingAddress=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenValidatingAddress=ce.stripeBillingAddressEventData;l=(r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;ce.translatedAddress={address:l?Ye({currentAddress:Object.assign(Object.assign({},l),{name:(t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!ce.stripeShippingSameAsBilling?Ye({currentAddress:Object.assign(Object.assign({},f),{name:(o=ce.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2]}}))}))}));de("clientSecret",(function(e){if(e&&ce.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var Ke=e("N",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),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",storeCredit:0,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}})),Ve=Ge.onChange,Xe=Ge.reset,Ze=Ge.state;e({G:Ve,d:Ze});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};var $e=e("Y",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var er=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};var rr=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Ze.items.find((function(r){return er({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Ze.restrictedItems=r;Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return er({item1:r,item2:e})}))})}));return{cartItems:Ze.items,restrictedItems:r}};var nr=null;var tr=e("f",(function(){t.checkoutSessionId=null;if(nr){clearTimeout(nr);nr=null}I();Xe()}));var or=e("o",(function(e){var r=e.messages,n=e.title;tr();we();Ze.step="error";Ze.error={messages:r,title:n}}));var ir=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;Ze.exchangeRate=t.exchangeRate;Ze.adjustmentTotal=t.adjustments;Ze.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Ze.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Ze.subtotal=t.items;Ze.total=t.total;Ze.currency=t.presentmentCurrencyCode;Ze.dutiesTaxesFeesEstimate=r||null};var ar=e("M",(function(){var e=Ze.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var sr=e("r",(function(e){var r,n,o,i,a,c,v;ce.clientSecret=e.clientSecret;ce.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;ce.customerProfile=e.customerProfile;Ze.checkoutSession=e;T((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var f=s(e.varianceTestResults||[]);u(f);var p=((a=(i=(o=Ze.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||((v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Ze.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,a,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Ze.selectedLandedCost){n=Ze.selectedLandedCost.subtotals;ir({dutiesTaxesFeesEstimate:m,method:Ze.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,qe({adjustmentsAmount:c,billToPartyId:ce.partyBillingId,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:i.selectedCountryCode,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];v("Error occurs when updating checkout session.");if(!y)return[3,3];d("Initiating checkout session on failure","info");return[4,Je()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){ir({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Ze.exchangeRate)}sr(u.checkoutSessionUpdate);return[2,true]}}))}))};var dr=e("Z",(function(e,r){var t,o,i,a;if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}if(Ke({deliveryType:r,landedCost:e,shipToCountry:(a=ce.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("L",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,A,O,C,k,I,T,P;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Ze.selectedShippingOption=j;h=$e(Ze.selectedShippingOption);if(h){w=h.maxTransit,y=h.minTransit,g=h.unit;Ze.selectedShippingOptionTransitTime="".concat(y,"-").concat(w," ").concat(g)}else{Ze.selectedShippingOptionTransitTime=""}b=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===N}));Ze.selectedLandedCost=b||null;if(!b){return[2,false]}_=((o=b.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;A=_*S;if(A){d("DAP quote, using estimate: ".concat(A),"info")}Ze.landedCostMethod=dr(b.landedCost,(i=j.shippingProfile)===null||i===void 0?void 0:i.serviceLevel.deliveryType);Ze.shipping=b.subtotals.shipping;O=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Ze.isSelectedShippingAboveDeminimis=C;Ze.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];I=b.subtotals;ir({dutiesTaxesFeesEstimate:A,method:Ze.landedCostMethod,subtotals:I});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate);k=true;return[3,3];case 1:return[4,ur({adjustmentsAmount:Ze.adjustmentTotal,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:A,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:T=(c=Ze.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;P=((v=ce.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";ce.shouldRenderPayInUsdButton=T==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=Ze.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(P));return[2,k]}}))}))}));var cr=e("m",(function(e){var r=e.isPreview,n=e.sessionTimeout;if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Ze.checkoutTimeoutInterval=setTimeout((function(){Ze.checkoutSessionTimeoutShow=true}),o)}));var vr=e("h",(function(){if(Ze.checkoutTimeoutInterval){clearTimeout(Ze.checkoutTimeoutInterval);Ze.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Ze.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var a=e.adjustments,s=e.cartItems,u=e.landedCostId,d=e.shouldInitSessionOnFailure,l=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:Ze.adjustments=a;Ze.items=fr(s);n=(r=s.find(Boolean))===null||r===void 0?void 0:r.currencyCode;o=s.reduce((function(e,r){return e+r.amount*r.quantity}),0);i=a.reduce((function(e,r){return e+r.amount}),0);if(!n||!o){return[2]}Ze.currency=n;ce.isFetchingSession=true;return[4,ur({adjustmentsAmount:i,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:u,shipToPartyId:ce.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();ce.isFetchingSession=false;return[2]}}))}))}));var hr=function(){Ze.selectedShippingOption=null;Ze.isSelectedShippingAboveDeminimis=false;Ze.isSelectedShippingGuarantee=false;Ze.selectedShippingOptionTransitTime="";Ze.dutiesTaxesFees=0;Ze.dutiesTaxesFeesEstimate=0;Ze.shipping=0;Ze.total=Ze.subtotal};var wr=function(){if(Ze.step==="shipping"){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="payment"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="finish"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false})})}};var yr=e("v",(function(){if(Ze.step==="customer-info"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:true})})}else if(Ze.step==="shipping"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:true})})}else if(Ze.step==="payment"){Ze.step="finish"}}));var gr=e("g",(function(){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,a,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2]}n=Ze.selectedLandedCost;o=Ze.currency||((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";a=Ze.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4,qe({adjustmentsAmount:a,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:i.selectedCountryCode,storeCreditApplication:L()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2]}ir({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2]}}))}))};var _r=e("a2",(function(){if(nr){clearTimeout(nr)}nr=setTimeout((function(){nr=null;void br()}),300)}))}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-47a1d469.system.js","./p-22f7120a.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-30e9a6d7.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.l;a=e.j;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2,{errors:n,json:o}]}}))}))};var A=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),O=A.onChange,C=A.reset,k=A.state;e("S",k);var I=e("T",(function(){C()}));var T=function(e){d("Store credit balance from session","info",e);k.availableBalance=e};var P=e("a4",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;T(i);return[2]}}))}))}));var E=e("y",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);k.error=n;return[2,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});k.isApplying=true;k.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}]}k.appliedAmount=a.amountApplied;k.remainingBalance=a.remainingBalance;k.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}];case 4:return[2]}}))}))}));var N=e("a0",(function(e){k.isEnabled=e;k.error=null;if(!e){k.amountToApply=null}}));var j=e("a3",(function(e){if(e===null){k.amountToApply=null;k.error=null;return}if(e<=0){k.error="Amount must be greater than zero";return}if(k.availableBalance!==null&&e>k.availableBalance){k.error="Amount exceeds available balance";return}var r=Ze.total+(Ze.storeCredit||0);if(e>r){k.error="Amount exceeds order total";return}k.error=null;k.amountToApply=e}));var D=e("a1",(function(e){k.useFullBalance=e;k.error=null;if(e&&k.availableBalance!==null){var r=Ze.total+(Ze.storeCredit||0);var n=Math.min(k.availableBalance,r);k.amountToApply=n}else if(!e){k.amountToApply=null}}));var L=function(){if(!k.isEnabled||k.amountToApply===null){return{mode:"NONE"}}if(k.useFullBalance){return{mode:"FULL"}}return{amount:k.amountToApply,mode:"PARTIAL"}};var x=e("I",(function(){if(!k.isEnabled||k.availableBalance===null){return 0}if(k.useFullBalance){return Math.min(k.availableBalance,Ze.total+(Ze.storeCredit||0))}return k.amountToApply||0}));var R=e("z",(function(){return k.amountToApply!==null&&k.amountToApply>0&&Ze.storeCredit>0&&Ze.total<=0}));var U=e("B",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);k.error=i;return[2,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;k.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}];case 4:return[2]}}))}))}));var z=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];var B={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var F=r({accepted:false,acceptedAt:null,locked:false,showError:false}),J=F.reset,M=F.state;e({p:J,E:M});var q=e("$",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return z.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(B[n]),url:a});return r}),[])}));var W=e("w",(function(){return q().length>0}));var Y=e("U",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var H=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};var K=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=ce.stripeLinkEventData;var s=ce.stripeAddressEventData;var u=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}var d=H({currentAddress:s,translatedAddress:ce.translatedAddress.address});var l=Y({name:d.name}),c=l.firstName,v=l.lastName;var f=H({currentAddress:u,translatedAddress:ce.translatedAddress.address});var p=Y({name:f.name}),m=p.firstName,h=p.lastName;var w=a()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:m,lastName:h,phone:f.phone},cartCurrencyCode:(r=Ze.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||i.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Ze.promoCode?[{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var G=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var r=ce.stripeLinkEventData;var n=ce.stripeAddressEventData;var o=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}var i=H({currentAddress:n,translatedAddress:ce.translatedAddress.address});var a=Y({name:i.name}),s=a.firstName,u=a.lastName;var l=H({currentAddress:o,translatedAddress:ce.translatedAddress.address});var c=Y({name:l.name}),v=c.firstName,f=c.lastName;var p=Ze.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Ze.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:r===null||r===void 0?void 0:r.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Ze.items,landedCostAdjustments:m,shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=G();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:f["vercel"]},{promoCode:Ze.promoCode})];case 1:s=v.sent();if(!s||!((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var X=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,V(t)];case 1:o=d.sent();return[2,o];case 2:return[4,c("/api/zonos-elements/calculate-landed-cost",{body:G(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){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 Z=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,c("/api/zonos-elements/cart-calculate-landed-cost",{body:K(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.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")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var $=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3,2];return[4,X(e)];case 1:n=a.sent();return[2,n];case 2:return[4,Z({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var ee=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,a,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&!window.Zonos.zonosConversionTest){return[2]}d=i.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}});return[2]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:a}),organizationId:v};return[4,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var re=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}return Object.keys(t).length?t:undefined};var ne=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;var l=Y({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=Y({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:re({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),billingAddress:!i?re({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};var te=e("_",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));var oe=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(i){switch(i.label){case 0:return[4,S()];case 1:r=i.sent(),n=r.errors,t=r.json;if(n.length||!t){v("Failed to retrieve checkout session info before confirming payment ",n);void h({endpoint:"validateCheckoutSession",errors:n.map((function(e){return e.message})),metadata:{allLogs:l}});return[2,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2,{errorMessage:o('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 ie=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ae=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var se={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var ue=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",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:{}}}})),de=ue.onChange,le=ue.reset,ce=ue.state;e({H:de,b:ce});var ve=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},ie({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},ae({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:m,customerSessionClientSecret:ce.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:i.selectedLocale}};var fe=e("q",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var pe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var me=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var he=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=ce.clientSecret;if(!ce.stripe){d("Skip. Stripe is not initialized");return[2]}o=ve({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(ce.stripeElementsOptions);if(!ce.stripeElements||!ce.stripeElementsForBillingAddress){ce.stripeElementsForBillingAddress=(r=ce.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");ce.stripeElements=(n=ce.stripe)===null||n===void 0?void 0:n.elements(o);ce.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){ce.stripeElements.update(o);ce.stripeElementsForBillingAddress.update(o);ce.stripeElementsOptions=o;void ce.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var we=e("F",(function(){sessionStorage.removeItem("zonos--client-secret");le();ce.stripe=window.Zonos.stripe}));var ye=function(){var e,r,n,t;var o=JSON.stringify((e=ce.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!ce.stripeShippingSameAsBilling&&JSON.stringify((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ge=function(){var e,r,n,t,o,i,a,s;var u=(e=Ze.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Ze.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;if(!u||!d){return false}if(ce.partyShippingId!==u||ce.partyBillingId!==d){return true}var l=JSON.stringify((n=ce.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=ce.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!ce.stripeShippingSameAsBilling&&JSON.stringify((a=ce.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=ce.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=ce.taxIdUsedWhenAsyncAddressUpdate!==ce.taxId;var p=ce.companyNameUsedWhenAsyncAddressUpdate!==ce.companyName;return l||c||v||f||p};var be=e("K",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=Y({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var _e=e("X",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=ce.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!ce.stripeShippingSameAsBilling&&!((r=ce.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!ce.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Ze.landedCostData){return[2,{partiesCreated:false}]}i=(n=Ze.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=ge();if(!a){return[2,{partiesCreated:false}]}s=be({address:ce.stripeAddressEventData.value.address,firstName:ce.stripeAddressEventData.value.firstName,lastName:ce.stripeAddressEventData.value.lastName,name:ce.stripeAddressEventData.value.name,phone:ce.stripeAddressEventData.value.phone});u=ce.stripeShippingSameAsBilling?s:be({address:ce.stripeBillingAddressEventData.value.address,firstName:ce.stripeBillingAddressEventData.value.firstName,lastName:ce.stripeBillingAddressEventData.value.lastName,name:ce.stripeBillingAddressEventData.value.name,phone:ce.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:ce.companyName,email:((o=ce.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:ce.shortAddressCode,taxId:ce.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2,{partiesCreated:false}]}ce.companyNameUsedWhenAsyncAddressUpdate=ce.companyName;ce.stripeAddressUsedWhenAsyncAddressUpdate=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenAsyncAddressUpdate=ce.stripeBillingAddressEventData;ce.taxIdUsedWhenAsyncAddressUpdate=ce.taxId;ce.partyBillingId=m.billToPartyId;ce.partyShippingId=m.shipToPartyId;Ze.partiesData=Ze.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2,{partiesCreated:true}]}}))}))}));var Se=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Ae=function(){var e,r;var n=JSON.stringify((e=ce.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=ce.stripeAddressEventData&&JSON.stringify(Se(ce.stripeAddressEventData.value))!==JSON.stringify(ce.stripeAddressUsedWhenFetchingLC);var o=!ce.stripeShippingSameAsBilling&&ce.stripeBillingAddressEventData&&JSON.stringify(Se(ce.stripeBillingAddressEventData.value))!==JSON.stringify(ce.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};var Oe=function(){var e;var r=Ze.landedCostData&&((e=Ze.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Ze.subtotal;var n=Ae();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});return!Ze.landedCostData&&!ce.isFetchingLandedCost||n||r};var Ce=e("W",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Ze.addressFormRenderType==="stripe"){return a||s}return s}));var ke=function(){var e,r,n,t;var o=!!((e=ce.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=ce.stripeShippingSameAsBilling?i:!!((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ce(s);if(i&&a&&o){return true}if(!u||!ce.stripeAddressEventData){return i&&a&&o}var d=ce.stripeAddressEventData.value.address.line1.length>0;var l=ce.stripeAddressEventData.value.firstName&&ce.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&ce.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&ce.stripeAddressEventData.value.address.postal_code.length>=3;var f=ce.stripeAddressEventData.value.phone&&ce.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var Ie=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;ce.fetchingLandedCostAbortController=r;pr();return[4,$(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;Ze.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Ze.shippingData=te((d===null||d===void 0?void 0:d.filter(Boolean))||[]);rr(a);ce.fetchingLandedCostAbortController=null;Ze.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];Ze.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void ee({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Ze.promoCodeApplied&&!Ze.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Ze.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Ze.promoCode)}return[2]}}))}))};var Te=e("u",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=ke();if(!u){return[2,{isRequestNotReady:true}]}if(s){(r=ce.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();ce.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){ce.isFetchingLandedCost=false;setTimeout((function(){ce.isFetchingLandedCost=true}),300)}else{ce.isFetchingLandedCost=true}if(ce.stripeAddressEventData){ce.stripeAddressUsedWhenFetchingLC={countryCode:ce.stripeAddressEventData.value.address.country,postalCode:ce.stripeAddressEventData.value.address.postal_code,state:ce.stripeAddressEventData.value.address.state}}if(ce.stripeBillingAddressEventData){ce.stripeBillingAddressUsedWhenFetchingLC={countryCode:ce.stripeBillingAddressEventData.value.address.country,postalCode:ce.stripeBillingAddressEventData.value.address.postal_code,state:ce.stripeBillingAddressEventData.value.address.state}}if(ce.stripeLinkEventData){ce.stripeLinkUsedWhenFetchingLC=Object.assign({},ce.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);pr();return[4,Ie()];case 2:w.sent();d=(n=Ze.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Ze.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){ir({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:f=w.sent();Ze.landedCostData=[];Ze.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3,6];if(!(i<1))return[3,5];return[4,Te(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=ce.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3,7];case 7:ce.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,Te({applyingPromocode:true})];case 1:o.sent();if(Ze.step==="payment"){wr()}return[4,_e()];case 2:o.sent();n=(e=Ze.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2]}return[4,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2]}}))}))}));var Ee=e("Q",(function(){Ze.promoCode="";sessionStorage.removeItem("zonos--promo-code");Ze.promoCodeError=false;Ze.promoCodeApplied=false}));var Ne=e("P",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Ze.step==="payment"){wr()}Ee();return[4,Pe()];case 1:e.sent();return[2]}}))}))}));var je=e("R",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;switch(e){case"succeeded":{r=[o("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."),"",o("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(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("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.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));var De=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3,2];return[4,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!u.available||u.status===204){return[2,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){ce.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4,t({items:Ze.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ze.items}});throw l;case 6:return[2]}}))}))}));var Le=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2]}return[4,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var xe=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=je(f),n=r.isError,t=r.messages;return[2,{error:n,messages:t}]}i=c||ce.clientSecret;if(!ce.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[o("Something went wrong.")]}]}if(!i.includes("_secret_")){return[2,{error:true,messages:[o("Something went wrong.")]}]}return[4,ce.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=je(s),d=u.isError,l=u.messages;return[2,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("C",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=ce.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=ce.stripeElements;s=ce.stripe;u=ce.clientSecret;ce.customErrorMessage=null;if(!((n=Ze.selectedLandedCost)===null||n===void 0?void 0:n.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,oe()];case 1:l=h.sent();if(!l.valid){ce.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void ee({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var Ue=function(){if(!M.accepted){return null}var e=q();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:M.acceptedAt||(new Date).toISOString(),locale:i.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};var ze=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(se).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var Be=e("n",(function(){var e;var r=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Ze.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:i.selectedLocale}],paymentProcessor:ze(),presentmentCountryCode:i.selectedCountryCode,skipPaymentIntent:ce.skipPaymentIntent,varianceTestInput:n};return o}));var Fe=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}return[4,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}sr(i.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var Je=e("j",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,a,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!i.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}ce.isFetchingSession=true;n=Be();d("Checkout session body","info",n);return[4,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,a=t.json;ce.isFetchingSession=false;if(o.length||!a){s=(e=o.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.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2,false]}u=a.checkoutSessionCreate;sr(u);ir({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Ze.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var Me=e("x",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){v("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:ce.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==ce.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var qe=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,a;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:ce.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:i.selectedLocale}],presentmentCountryCode:m,shipToPartyId:ce.partyShippingId,skipPaymentIntent:ce.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:a}]}return[2,{errors:[],json:a}]}}))}))};var We=e("J",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=Ue();if(!e){return[2,{errors:[]}]}if(!t.checkoutSessionId){return[2,{errors:[]}]}return[4,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2,{errors:[]}]}}))}))}));var Ye=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};var He=e("V",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=ne({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:ce.stripeAddressEventData,stripeBillingAddressEventData:ce.stripeBillingAddressEventData,stripeShippingSameAsBilling:ce.stripeShippingSameAsBilling});if(!i){ce.translatedAddress={address:{},billingAddress:{}};return[2]}a=ye();if(!a){return[2]}return[4,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));ce.translatedAddress={address:{},billingAddress:{}};return[2]}ce.stripeAddressUsedWhenValidatingAddress=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenValidatingAddress=ce.stripeBillingAddressEventData;l=(r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;ce.translatedAddress={address:l?Ye({currentAddress:Object.assign(Object.assign({},l),{name:(t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!ce.stripeShippingSameAsBilling?Ye({currentAddress:Object.assign(Object.assign({},f),{name:(o=ce.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2]}}))}))}));de("clientSecret",(function(e){if(e&&ce.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var Ke=e("N",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),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",storeCredit:0,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}})),Ve=Ge.onChange,Xe=Ge.reset,Ze=Ge.state;e({G:Ve,d:Ze});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};var $e=e("Y",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var er=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};var rr=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Ze.items.find((function(r){return er({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Ze.restrictedItems=r;Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return er({item1:r,item2:e})}))})}));return{cartItems:Ze.items,restrictedItems:r}};var nr=null;var tr=e("f",(function(){t.checkoutSessionId=null;if(nr){clearTimeout(nr);nr=null}I();Xe()}));var or=e("o",(function(e){var r=e.messages,n=e.title;tr();we();Ze.step="error";Ze.error={messages:r,title:n}}));var ir=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;Ze.exchangeRate=t.exchangeRate;Ze.adjustmentTotal=t.adjustments;Ze.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Ze.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Ze.subtotal=t.items;Ze.total=t.total;Ze.currency=t.presentmentCurrencyCode;Ze.dutiesTaxesFeesEstimate=r||null};var ar=e("M",(function(){var e=Ze.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var sr=e("r",(function(e){var r,n,o,i,a,c,v;ce.clientSecret=e.clientSecret;ce.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;ce.customerProfile=e.customerProfile;Ze.checkoutSession=e;T((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var f=s(e.varianceTestResults||[]);u(f);var p=((a=(i=(o=Ze.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||((v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Ze.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,a,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Ze.selectedLandedCost){n=Ze.selectedLandedCost.subtotals;ir({dutiesTaxesFeesEstimate:m,method:Ze.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,qe({adjustmentsAmount:c,billToPartyId:ce.partyBillingId,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:i.selectedCountryCode,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];v("Error occurs when updating checkout session.");if(!y)return[3,3];d("Initiating checkout session on failure","info");return[4,Je()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){ir({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Ze.exchangeRate)}sr(u.checkoutSessionUpdate);return[2,true]}}))}))};var dr=e("Z",(function(e,r){var t,o,i,a;if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}if(Ke({deliveryType:r,landedCost:e,shipToCountry:(a=ce.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("L",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,A,O,C,k,I,T,P;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Ze.selectedShippingOption=j;h=$e(Ze.selectedShippingOption);if(h){w=h.maxTransit,y=h.minTransit,g=h.unit;Ze.selectedShippingOptionTransitTime="".concat(y,"-").concat(w," ").concat(g)}else{Ze.selectedShippingOptionTransitTime=""}b=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===N}));Ze.selectedLandedCost=b||null;if(!b){return[2,false]}_=((o=b.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;A=_*S;if(A){d("DAP quote, using estimate: ".concat(A),"info")}Ze.landedCostMethod=dr(b.landedCost,(i=j.shippingProfile)===null||i===void 0?void 0:i.serviceLevel.deliveryType);Ze.shipping=b.subtotals.shipping;O=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Ze.isSelectedShippingAboveDeminimis=C;Ze.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];I=b.subtotals;ir({dutiesTaxesFeesEstimate:A,method:Ze.landedCostMethod,subtotals:I});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate);k=true;return[3,3];case 1:return[4,ur({adjustmentsAmount:Ze.adjustmentTotal,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:A,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:T=(c=Ze.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;P=((v=ce.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";ce.shouldRenderPayInUsdButton=T==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=Ze.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(P));return[2,k]}}))}))}));var cr=e("m",(function(e){var r=e.isPreview,n=e.sessionTimeout;if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Ze.checkoutTimeoutInterval=setTimeout((function(){Ze.checkoutSessionTimeoutShow=true}),o)}));var vr=e("h",(function(){if(Ze.checkoutTimeoutInterval){clearTimeout(Ze.checkoutTimeoutInterval);Ze.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Ze.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var a=e.adjustments,s=e.cartItems,u=e.landedCostId,d=e.shouldInitSessionOnFailure,l=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:Ze.adjustments=a;Ze.items=fr(s);n=(r=s.find(Boolean))===null||r===void 0?void 0:r.currencyCode;o=s.reduce((function(e,r){return e+r.amount*r.quantity}),0);i=a.reduce((function(e,r){return e+r.amount}),0);if(!n||!o){return[2]}Ze.currency=n;ce.isFetchingSession=true;return[4,ur({adjustmentsAmount:i,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:u,shipToPartyId:ce.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();ce.isFetchingSession=false;return[2]}}))}))}));var hr=function(){Ze.selectedShippingOption=null;Ze.isSelectedShippingAboveDeminimis=false;Ze.isSelectedShippingGuarantee=false;Ze.selectedShippingOptionTransitTime="";Ze.dutiesTaxesFees=0;Ze.dutiesTaxesFeesEstimate=0;Ze.shipping=0;Ze.total=Ze.subtotal};var wr=function(){if(Ze.step==="shipping"){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="payment"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="finish"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false})})}};var yr=e("v",(function(){if(Ze.step==="customer-info"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:true})})}else if(Ze.step==="shipping"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:true})})}else if(Ze.step==="payment"){Ze.step="finish"}}));var gr=e("g",(function(){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,a,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2]}n=Ze.selectedLandedCost;o=Ze.currency||((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";a=Ze.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4,qe({adjustmentsAmount:a,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:i.selectedCountryCode,storeCreditApplication:L()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2]}ir({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2]}}))}))};var _r=e("a2",(function(){if(nr){clearTimeout(nr)}nr=setTimeout((function(){nr=null;void br()}),300)}))}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,e,n,t){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,r){function i(o){try{l(t.next(o))}catch(o){r(o)}}function a(o){try{l(t["throw"](o))}catch(o){r(o)}}function l(o){o.done?n(o.value):s(o.value).then(i,a)}l((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},t,s,r,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(o){return function(e){return l([o,e])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(n=0)),n)try{if(t=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=e.call(o,n)}catch(o){a=[6,o];s=0}finally{t=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-fb8dc23f.system.js","./p-1d31b966.system.js","./p-47a1d469.system.js","./p-0287f9cd.system.js","./p-30e9a6d7.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-989cb22b.system.js"],(function(o){"use strict";var e,n,t,s,r,i,a,l,c,d,u,f,m,p,h,v,z,y,g,x;return{setters:[function(o){e=o.r;n=o.h;t=o.F;s=o.a;r=o.g},function(o){i=o.$;a=o.E;l=o.a0;c=o.a1;d=o.a2;u=o.S;f=o.a3;m=o.a4;p=o.I},function(o){h=o.l;v=o.t},function(o){z=o.z;y=o.f},function(o){g=o.r},function(o){x=o.g},function(){},function(){},function(){},function(){}],execute:function(){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:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}";var w=b;var k="POLICIES";var j=o("zonos_policy_consent",function(){function o(o){e(this,o)}o.prototype.render=function(){var o=i();if(!o.length){return null}var e=Intl.ListFormat;var r=e?new e(h.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(o.map((function(o){return o.name}))):o.flatMap((function(o,e){return e===0?[{type:"element",value:o.name}]:[{type:"literal",value:", "},{type:"element",value:o.name}]}));var l=r.map((function(e){if(e.type==="literal"){return e.value}var t=o.find((function(o){return o.name===e.value}));if(!t){return e.value}return n("a",{href:t.url,onClick:function(o){o.preventDefault();o.stopPropagation();window.open(t.url,"_blank","noopener,noreferrer")},rel:"noopener noreferrer",target:"_blank"},e.value)}));var c=z.organizationName;var d=c?v("I agree to [merchantName]'s [policies]",{merchantName:c,policies:k}):v("I agree to the [policies]",{policies:k});var u=d.split(k),f=u[0],m=f===void 0?"":f,p=u[1],y=p===void 0?"":p;var g=a.showError;var x="zonos--policy-consent-error";return n(s,{class:"zonos--policy-consent-host"},n("div",{class:"zonos--policy-consent".concat(g?" zonos--policy-consent--error":"")},n("label",{class:"zonos--policy-consent-label"},n("input",{"aria-describedby":g?x:undefined,"aria-invalid":g?"true":"false",checked:a.accepted,class:"zonos--policy-consent-checkbox",disabled:a.locked,onChange:function(o){var e=o.target.checked;a.accepted=e;if(e){if(!a.acceptedAt){a.acceptedAt=(new Date).toISOString()}a.showError=false}else{a.acceptedAt=null}},type:"checkbox"}),n("span",{class:"zonos--policy-consent-text"},m,n(t,null,l),y))),g&&n("div",{class:"zonos--policy-consent-error",id:x,role:"alert"},v("You must accept the policies to place this order")))};return o}());j.style=w;var C='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n';var I=':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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';var _=I;var S="full";var E="custom";var N=o("zonos_store_credit",function(){function o(o){var n=this;e(this,o);this.enabled=true;this.customAmountInput="";this.handleUseStoreCreditChange=function(o){l(o);if(o){c(true)}void d()};this.handleAmountModeChange=function(o){var e=o===S;c(e);if(!e){n.customAmountInput=""}void d()};this.handleCustomAmountChange=function(o){n.customAmountInput=o;u.error=null};this.handleApplyCustomAmount=function(){var o=parseFloat(n.customAmountInput);if(!isNaN(o)&&o>0){f(o)}else{f(null)}if(!u.error){void d()}}}o.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,m()];case 1:o.sent();return[2]}}))}))};o.prototype.render=function(){var o=this;if(!this.enabled){return null}var e=z.appearance.colorPrimary;var r=x({});var i=u.availableBalance;var a=i!==null&&i>0;var l=u.isEnabled;var c=u.useFullBalance;var d=u.error;var f=p();var m=g({amount:i!==null&&i!==void 0?i:0,isForeign:true});return n(s,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":r,"--zonos--font-family":y(),"--zonos--primary-color":e}},n("div",{class:"zonos--store-credit-container"},n("div",{class:"zonos--store-credit-header"},n("div",{class:"zonos--store-credit-title-row"},n("div",{class:"zonos--store-credit-title-left"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:22})),n("zonos-text",{type:"semiBoldLabel"},v("Store credit"))),a&&n("div",{class:"zonos--store-credit-balance-badge"},n("zonos-text",{textColor:"gray-600",type:"caption"},m)))),n(t,null,a?n("div",{class:"zonos--store-credit-content"},n("div",{class:"zonos--store-credit-checkbox"},n("zonos-checkbox",{isChecked:l,label:v("Use store credit"),onCheckboxSelected:function(e){return o.handleUseStoreCreditChange(e.detail)},size:16})),l&&n("div",{class:"zonos--store-credit-options"},n("div",{class:"zonos--store-credit-toggle-row"},n("zonos-toggle",{onToggleChanged:function(e){return o.handleAmountModeChange(e.detail)},options:[{label:v("Apply full balance"),value:S},{label:v("Enter amount"),value:E}],value:c?S:E})),!c&&n("div",{class:"zonos--store-credit-custom-amount"},n("div",{class:"zonos--store-credit-custom-amount-row"},n("zonos-input",{inputLabel:v("Enter amount"),inputValue:this.customAmountInput,isError:!!d,onInputChange:function(e){return o.handleCustomAmountChange(e.detail)}}),n("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},v("Apply")))),d&&n("div",{class:"zonos--store-credit-error"},n("zonos-text",{textColor:"red-600",type:"caption"},d)),n("div",{class:"zonos--store-credit-summary"},n("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},v("Amount to apply: [amount]",{amount:g({amount:f,isForeign:true})}))))):n("div",{class:"zonos--store-credit-empty"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:28})),n("zonos-text",{textColor:"gray-600",type:"caption"},v("No store credit available"))))))};Object.defineProperty(o.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return o}());N.style=_}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,n,t){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,r){function i(o){try{l(t.next(o))}catch(o){r(o)}}function a(o){try{l(t["throw"](o))}catch(o){r(o)}}function l(o){o.done?n(o.value):s(o.value).then(i,a)}l((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},t,s,r,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(o){return function(e){return l([o,e])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(n=0)),n)try{if(t=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=e.call(o,n)}catch(o){a=[6,o];s=0}finally{t=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-0d183f19.system.js","./p-22f7120a.system.js","./p-47a1d469.system.js","./p-72280783.system.js","./p-30e9a6d7.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-989cb22b.system.js"],(function(o){"use strict";var e,n,t,s,r,i,a,l,c,d,u,f,m,p,h,v,z,y,g,x;return{setters:[function(o){e=o.r;n=o.h;t=o.F;s=o.a;r=o.g},function(o){i=o.$;a=o.E;l=o.a0;c=o.a1;d=o.a2;u=o.S;f=o.a3;m=o.a4;p=o.I},function(o){h=o.l;v=o.t},function(o){z=o.z;y=o.f},function(o){g=o.r},function(o){x=o.g},function(){},function(){},function(){},function(){}],execute:function(){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:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}";var w=b;var k="POLICIES";var j=o("zonos_policy_consent",function(){function o(o){e(this,o)}o.prototype.render=function(){var o=i();if(!o.length){return null}var e=Intl.ListFormat;var r=e?new e(h.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(o.map((function(o){return o.name}))):o.flatMap((function(o,e){return e===0?[{type:"element",value:o.name}]:[{type:"literal",value:", "},{type:"element",value:o.name}]}));var l=r.map((function(e){if(e.type==="literal"){return e.value}var t=o.find((function(o){return o.name===e.value}));if(!t){return e.value}return n("a",{href:t.url,onClick:function(o){o.preventDefault();o.stopPropagation();window.open(t.url,"_blank","noopener,noreferrer")},rel:"noopener noreferrer",target:"_blank"},e.value)}));var c=z.organizationName;var d=c?v("I agree to [merchantName]'s [policies]",{merchantName:c,policies:k}):v("I agree to the [policies]",{policies:k});var u=d.split(k),f=u[0],m=f===void 0?"":f,p=u[1],y=p===void 0?"":p;var g=a.showError;var x="zonos--policy-consent-error";return n(s,{class:"zonos--policy-consent-host"},n("div",{class:"zonos--policy-consent".concat(g?" zonos--policy-consent--error":"")},n("label",{class:"zonos--policy-consent-label"},n("input",{"aria-describedby":g?x:undefined,"aria-invalid":g?"true":"false",checked:a.accepted,class:"zonos--policy-consent-checkbox",disabled:a.locked,onChange:function(o){var e=o.target.checked;a.accepted=e;if(e){if(!a.acceptedAt){a.acceptedAt=(new Date).toISOString()}a.showError=false}else{a.acceptedAt=null}},type:"checkbox"}),n("span",{class:"zonos--policy-consent-text"},m,n(t,null,l),y))),g&&n("div",{class:"zonos--policy-consent-error",id:x,role:"alert"},v("You must accept the policies to place this order")))};return o}());j.style=w;var C='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n';var I=':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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';var _=I;var S="full";var E="custom";var N=o("zonos_store_credit",function(){function o(o){var n=this;e(this,o);this.enabled=true;this.customAmountInput="";this.handleUseStoreCreditChange=function(o){l(o);if(o){c(true)}void d()};this.handleAmountModeChange=function(o){var e=o===S;c(e);if(!e){n.customAmountInput=""}void d()};this.handleCustomAmountChange=function(o){n.customAmountInput=o;u.error=null};this.handleApplyCustomAmount=function(){var o=parseFloat(n.customAmountInput);if(!isNaN(o)&&o>0){f(o)}else{f(null)}if(!u.error){void d()}}}o.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,m()];case 1:o.sent();return[2]}}))}))};o.prototype.render=function(){var o=this;if(!this.enabled){return null}var e=z.appearance.colorPrimary;var r=x({});var i=u.availableBalance;var a=i!==null&&i>0;var l=u.isEnabled;var c=u.useFullBalance;var d=u.error;var f=p();var m=g({amount:i!==null&&i!==void 0?i:0,isForeign:true});return n(s,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":r,"--zonos--font-family":y(),"--zonos--primary-color":e}},n("div",{class:"zonos--store-credit-container"},n("div",{class:"zonos--store-credit-header"},n("div",{class:"zonos--store-credit-title-row"},n("div",{class:"zonos--store-credit-title-left"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:22})),n("zonos-text",{type:"semiBoldLabel"},v("Store credit"))),a&&n("div",{class:"zonos--store-credit-balance-badge"},n("zonos-text",{textColor:"gray-600",type:"caption"},m)))),n(t,null,a?n("div",{class:"zonos--store-credit-content"},n("div",{class:"zonos--store-credit-checkbox"},n("zonos-checkbox",{isChecked:l,label:v("Use store credit"),onCheckboxSelected:function(e){return o.handleUseStoreCreditChange(e.detail)},size:16})),l&&n("div",{class:"zonos--store-credit-options"},n("div",{class:"zonos--store-credit-toggle-row"},n("zonos-toggle",{onToggleChanged:function(e){return o.handleAmountModeChange(e.detail)},options:[{label:v("Apply full balance"),value:S},{label:v("Enter amount"),value:E}],value:c?S:E})),!c&&n("div",{class:"zonos--store-credit-custom-amount"},n("div",{class:"zonos--store-credit-custom-amount-row"},n("zonos-input",{inputLabel:v("Enter amount"),inputValue:this.customAmountInput,isError:!!d,onInputChange:function(e){return o.handleCustomAmountChange(e.detail)}}),n("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},v("Apply")))),d&&n("div",{class:"zonos--store-credit-error"},n("zonos-text",{textColor:"red-600",type:"caption"},d)),n("div",{class:"zonos--store-credit-summary"},n("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},v("Amount to apply: [amount]",{amount:g({amount:f,isForeign:true})}))))):n("div",{class:"zonos--store-credit-empty"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:28})),n("zonos-text",{textColor:"gray-600",type:"caption"},v("No store credit available"))))))};Object.defineProperty(o.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return o}());N.style=_}}}));
|