@zonos/elements 1.3.226 → 1.3.228
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-af017ac3.js → cart-ad82a680.js} +2 -2
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-21030292.js → localization-31e3dfe3.js} +1 -1
- package/dist/cjs/{paypal-2b22f0f5.js → paypal-88b5e878.js} +3 -3
- package/dist/cjs/{placeTestOrder-9cde1ca4.js → placeTestOrder-6aefbf9c.js} +2 -2
- package/dist/cjs/{renderFallback-9300dbaf.js → renderFallback-87c908ad.js} +2 -2
- package/dist/cjs/{translationStore-ce2c700d.js → translationStore-b8b25e9d.js} +240 -0
- package/dist/cjs/zonos-address_11.cjs.entry.js +3 -3
- package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-cart-items_13.cjs.entry.js} +23 -5
- package/dist/cjs/zonos-checkout.cjs.entry.js +26 -15
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
- package/dist/cjs/zonos-collect.cjs.entry.js +5 -5
- package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +25 -13
- package/dist/collection/components/store/translationStore/strings.arabic.js +12 -0
- package/dist/collection/components/store/translationStore/strings.base.js +12 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +12 -0
- package/dist/collection/components/store/translationStore/strings.french.js +12 -0
- package/dist/collection/components/store/translationStore/strings.german.js +12 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +12 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +12 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +12 -0
- package/dist/collection/types/generated/graphql.internal.types.js +29 -0
- package/dist/esm/{cart-11b87221.js → cart-c74f9aaa.js} +3 -3
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-9320a65d.js → localization-106476cb.js} +1 -1
- package/dist/esm/{paypal-338a4350.js → paypal-bf3a2bdd.js} +3 -3
- package/dist/esm/{placeTestOrder-d28f33c2.js → placeTestOrder-891295e8.js} +2 -2
- package/dist/esm/{renderFallback-28ef3364.js → renderFallback-ce0e238a.js} +2 -2
- package/dist/esm/{translationStore-7eebaa41.js → translationStore-766b7521.js} +240 -0
- package/dist/esm/zonos-address_11.entry.js +3 -3
- package/dist/esm/{zonos-cart-items_12.entry.js → zonos-cart-items_13.entry.js} +23 -6
- package/dist/esm/zonos-checkout.entry.js +27 -16
- package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
- package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
- package/dist/esm/zonos-collect.entry.js +5 -5
- package/dist/esm/zonos-confirm-dialog_2.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +3 -3
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +4 -4
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm-es5/{cart-11b87221.js → cart-c74f9aaa.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{localization-9320a65d.js → localization-106476cb.js} +1 -1
- package/dist/esm-es5/{paypal-338a4350.js → paypal-bf3a2bdd.js} +1 -1
- package/dist/esm-es5/placeTestOrder-891295e8.js +1 -0
- package/dist/esm-es5/{renderFallback-28ef3364.js → renderFallback-ce0e238a.js} +1 -1
- package/dist/esm-es5/translationStore-766b7521.js +1 -0
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/{zonos-cart-items_12.entry.js → zonos-cart-items_13.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-confirm-dialog_2.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-empty-state-payment_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +10 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +5 -4
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +12 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +71 -0
- package/dist/types/types/generated/graphql.internal.types.ts +79 -0
- package/dist/types/types/utils/ZonosSettings.d.ts +4 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-19305aa8.entry.js → p-053a042e.entry.js} +1 -1
- package/dist/zonos-elements/{p-4ce3489a.entry.js → p-10894d36.entry.js} +1 -1
- package/dist/zonos-elements/p-1865e33b.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1c5ba523.js → p-1d15662c.js} +1 -1
- package/dist/zonos-elements/{p-0260fd13.js → p-203c7fda.js} +1 -1
- package/dist/zonos-elements/{p-e00e5d64.system.entry.js → p-21b251f0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2657f099.system.entry.js → p-225a61c4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4004c838.system.entry.js → p-236e0144.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9e03a145.system.entry.js → p-23f6a2fb.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfc0fc85.system.entry.js → p-288f5a5b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1ef793d0.entry.js → p-2b84039a.entry.js} +1 -1
- package/dist/zonos-elements/{p-04c1dc63.system.entry.js → p-2db90c99.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f5e68547.system.js → p-33bd80d2.system.js} +1 -1
- package/dist/zonos-elements/p-35c247d9.entry.js +1 -0
- package/dist/zonos-elements/{p-ba334962.system.entry.js → p-3d2925c5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ae3e4f2b.entry.js → p-462f8857.entry.js} +1 -1
- package/dist/zonos-elements/{p-1868a283.entry.js → p-5608ac9d.entry.js} +1 -1
- package/dist/zonos-elements/{p-0b6a3a09.system.entry.js → p-57ee34aa.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d531b524.system.js → p-595668d7.system.js} +1 -1
- package/dist/zonos-elements/{p-67787bd4.entry.js → p-62803534.entry.js} +1 -1
- package/dist/zonos-elements/p-6497ce22.entry.js +1 -0
- package/dist/zonos-elements/{p-6092af05.entry.js → p-65db3219.entry.js} +1 -1
- package/dist/zonos-elements/{p-7cee0e68.system.entry.js → p-6c8e4f01.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1b9cc0e2.system.entry.js → p-6f1024de.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0a92e3fd.entry.js → p-76f924b3.entry.js} +1 -1
- package/dist/zonos-elements/{p-375994d1.system.entry.js → p-7a97e1cf.system.entry.js} +1 -1
- package/dist/zonos-elements/p-81b357f7.system.js +1 -1
- package/dist/zonos-elements/{p-4dfe97ad.js → p-964a4d85.js} +2 -2
- package/dist/zonos-elements/{p-2616ba72.entry.js → p-9972941a.entry.js} +1 -1
- package/dist/zonos-elements/{p-bcf11c99.system.entry.js → p-ad7be556.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cb0e6468.entry.js → p-b0a75761.entry.js} +1 -1
- package/dist/zonos-elements/p-b4fe3604.system.js +1 -0
- package/dist/zonos-elements/p-b8293509.js +1 -0
- package/dist/zonos-elements/{p-873b6185.system.entry.js → p-bd373de0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7eb8e2d4.js → p-c3c3cd98.js} +1 -1
- package/dist/zonos-elements/{p-0ec82d78.system.js → p-c89e9d56.system.js} +1 -1
- package/dist/zonos-elements/{p-725605f6.system.js → p-cdaf52f4.system.js} +1 -1
- package/dist/zonos-elements/{p-b5b3f908.system.js → p-cef1e888.system.js} +1 -1
- package/dist/zonos-elements/{p-e60b988c.entry.js → p-cf56b990.entry.js} +1 -1
- package/dist/zonos-elements/{p-112c6453.system.js → p-de984173.system.js} +1 -1
- package/dist/zonos-elements/p-eea0d8af.js +1 -0
- package/dist/zonos-elements/{p-252fa1da.entry.js → p-f4085c23.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/zonos-link.cjs.entry.js +0 -24
- package/dist/esm/zonos-link.entry.js +0 -20
- package/dist/esm-es5/placeTestOrder-d28f33c2.js +0 -1
- package/dist/esm-es5/translationStore-7eebaa41.js +0 -1
- package/dist/esm-es5/zonos-link.entry.js +0 -1
- package/dist/zonos-elements/p-02667a58.entry.js +0 -1
- package/dist/zonos-elements/p-0d82e1fd.entry.js +0 -1
- package/dist/zonos-elements/p-182da73f.system.js +0 -1
- package/dist/zonos-elements/p-5c43ecdf.system.entry.js +0 -1
- package/dist/zonos-elements/p-820ad058.js +0 -1
- package/dist/zonos-elements/p-a800965d.system.entry.js +0 -1
- package/dist/zonos-elements/p-cc599cd9.entry.js +0 -1
- package/dist/zonos-elements/p-d42b5113.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as e,h as s,H as t,a as i}from"./p-b30c2ad9.js";import{t as n}from"./p-
|
|
1
|
+
import{r as o,c as e,h as s,H as t,a as i}from"./p-b30c2ad9.js";import{t as n}from"./p-eea0d8af.js";import{g as a,f as r,z as l}from"./p-7af39c98.js";import{c}from"./p-b4b7f705.js";import{g as d}from"./p-0ffd710e.js";import"./p-0a377722.js";const h=class{constructor(s){o(this,s),this.confirmClicked=e(this,"confirmClicked",7),this.cancelClicked=e(this,"cancelClicked",7),this.dialogTitle=n("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=o=>{o.target!==o.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(o){"Escape"===o.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var o,e;null===(e=null===(o=this.el.shadowRoot)||void 0===o?void 0:o.querySelector(".zonos--backdrop"))||void 0===e||e.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return s("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return s("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return s("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const o=d(),e=a(l.appearance.theme);return s(t,{key:"c9eabf497f7e23ae201e6310e5ecb9f0d7068294",class:c([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":e,style:{"--zonos--border-radius":o,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":r()}},s("div",{key:"a9a525bfe764bf93e8725d9a00c069455de72ed6",class:"zonos--backdrop",tabIndex:-1}),s("div",{key:"072ab68e501618b640ffce6c6e8e96096966e09d",class:c(["zonos--confirm-layout",this.dialogIntent]),onClick:o=>this.clickOutsideDialogHandler(o)},s("div",{key:"3ab415f1cbc2bc36af01d67b279e732480de8685",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},s("div",{key:"a1d99558318371c0e5ee95a9578a6de31a6fc27a",class:"wrapper"},s("div",{key:"3fd7fbc90c430a3e1496e5b0347947c1929aa6ed",class:"icon-wrapper"},this.renderIcon()),s("div",{key:"5584080e0f0a5a756b0cc2ac761e0e18c864afcd",class:"content"},s("div",{key:"4a2070c137636193d05ded090fea26f05aada887",class:"title"},s("zonos-text",{key:"ab4c773f4af1271f5615a28f6a6193460330f16b",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&s("div",{key:"05a445dc37e754c99ea6727ae2bf861d42d5c2c4",class:"subtitle"},s("zonos-text",{key:"a7563f9fd3b405653487542e1b7a1f6aeab01893",textColor:"gray-800"},this.dialogSubtitle))),s("div",{key:"812e9e43fdb6d10ed62da8138e344b0243ca5c34",class:"footer"},"confirm"===this.dialogType&&s("zonos-button",{key:"07d7dc9d1a4bca9cb1ee420a4fed82e9fc513bd9",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||n("Cancel")),s("zonos-button",{key:"b607a5244dc39869b6d40cd361d9dee4686858a7",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return i(this)}};h.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 .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const f=class{constructor(e){o(this,e),this.open=!1,this.size=40}render(){return s(t,{key:"1eb7313add29219032d8301abaf55ace726a3309",class:c(["zonos--elements",this.open&&"zonos--open"])},s("div",{key:"df9960e78817a9a98006fed7e87c5441f220f496",class:"zonos--loading-overlay"},s("zonos-spinner",{key:"32795fe2c626add5d2f53032ea9b5b8d528bef38",size:this.size,spinnerColor:this.spinnerColor})))}};f.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{h as zonos_confirm_dialog,f as zonos_loading_overlay}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-5fc34563.system.js","./p-cdaf52f4.system.js","./p-c89e9d56.system.js","./p-cef1e888.system.js","./p-b4fe3604.system.js","./p-89c5164b.system.js","./p-69451a50.system.js","./p-01174496.system.js","./p-23c46dfa.system.js","./p-40a4c8a2.system.js","./p-d938f42f.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-433d76b4.system.js","./p-24e26a2c.system.js","./p-1aa93d1e.system.js","./p-2770ba48.system.js","./p-57413c34.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,h,f,v,m,p,g,z,w,k,y,b,_,C,x,S,T,A,O,I,E,N,P,j,L,D,U,R,B,F,Z,H,M,K,V,G,W,Y,q,J,Q,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,he,fe,ve,me,pe,ge;return{setters:[function(e){o=e.r;t=e.h;n=e.F;r=e.H},function(e){i=e.s;s=e.a;c=e.b;a=e.c;u=e.i;d=e.d;l=e.e;h=e.f;f=e.g;v=e.h;m=e.j;p=e.k;g=e.l;z=e.m;w=e.t;k=e.n;y=e.o;b=e.p;_=e.q;C=e.r;x=e.u;S=e.v;T=e.w;A=e.x;O=e.y;I=e.z},function(e){E=e.p;N=e.s;P=e.a;j=e.b},function(e){L=e.f;D=e.l;U=e.a;R=e.g;B=e.s;F=e.V;Z=e.b;H=e.c;M=e.d},function(e){K=e.t},function(e){V=e.z;G=e.g;W=e.m},function(e){Y=e.b},function(e){q=e.h;J=e.l;Q=e.s;X=e.b;$=e.g;ee=e.j;oe=e.a;te=e.i},function(e){ne=e.u},function(e){re=e._;ie=e.c;se=e.a;ce=e.d;ae=e.g},function(e){ue=e.l;de=e.g;le=e.b},function(e){he=e.c},function(e){fe=e.c},function(e){ve=e.g},function(e){me=e.i},function(e){pe=e.s},function(e){ge=e.R},function(){}],execute:function(){var ze=this;var we=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,q("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var ke=function(e){return __awaiter(ze,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:if(i.length===0){return[2,null]}return[4,q("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2,null]}r=L(n);return[2,r]}}))}))};var ye=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,h=e.customerZip,f=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var p=new URLSearchParams;p.set("tempCartUUID",o);if(a){p.set("customerFirstName",a)}if(u){p.set("customerLastName",u)}if(c){p.set("customerEmail",c)}if(d){p.set("customerPhone",d)}if(h){p.set("customerZip",h)}if(i){p.set("customerCity",i)}if(l){p.set("customerState",l)}if(s){p.set("zCountry",s)}if(n){p.set("customerAddress1",n)}if(r){p.set("customerAddress2",r)}if(v){p.set("zonosTestMode","1")}if(t){p.set("zonosCheckoutSessionId",t)}if(m){p.set("zonosVariantTest","1")}return"".concat(f,"?").concat(p.toString())};var be=function(e){if(e===void 0){e=true}if(!D.localizationLoaded){return true}if(D.isDisabledCountry){if(e){ue("Checkout: disabled country")}return true}return false};var _e=function(e){if(e===void 0){e=true}if(!D.localizationLoaded){return false}if(!D.isShippableCountry){if(e){ue("Checkout: not shippable country")}return false}return true};var Ce=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(ze,void 0,void 0,(function(){var e,r,a,u,d;var l=this;return __generator(this,(function(h){e=document.querySelector(o);r=i();if(!e&&r){a=document.createElement("button");a.style.display="none";a.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(a);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}u=document.querySelector('select[name="shippingAddress.countryCode"]');d=document.querySelector("#checkout-shipping-continue");if(!u||!d){return[2]}n.disconnect();d.addEventListener("click",(function(e){return __awaiter(l,void 0,void 0,(function(){var o,t,n,r,i,a,d;return __generator(this,(function(l){n=u.value;if(!n){return[2]}U(n);if(!_e(false)){s();return[2]}r=document.querySelector("form");if(!r){return[2]}i=new FormData(r);a=document.querySelector("input#addressLine1Input");d={address1:(o=i.get("shippingAddress.address1"))!==null&&o!==void 0?o:a&&a.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:(t=i.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(d).some((function(e){return e===undefined||e===null}))){J("One or more shipping address field is missing",Object.entries(d));void Q({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(d))],metadata:{storeId:V.storeId}});return[2]}c({address1:d.address1,address2:d.address2,city:d.city,countryCode:d.countryCode,firstName:d.firstName,lastName:d.lastName,phone:d.phone,postalCode:d.postalCode,state:d.stateOrProvince});e.preventDefault();e.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var xe=function(){var e=new URLSearchParams(window.location.search);ue("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=R(e)||D.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var h=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:h,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var Se=0;var Te=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}ue("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,q("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);Se++;if(Se>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var Ae=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=de().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:le},X()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};void q("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Oe=function(e){return __awaiter(ze,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:le},X()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};void q("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Ie=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var Ee=function(e){var o;var t=(o=B.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Ne=function(e){return V.enabledVariantTestKeys.includes(e)};var Pe=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+F,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var je=function(e){return __awaiter(ze,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=$();return[4,q("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];ue("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,je({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var Le=function(e){return __awaiter(ze,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=re(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){J("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,je({cartId:e,retries:5})];case 1:r=i.sent();ue("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){J("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var De='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var Ue=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h{z-index:2147483647;position:fixed}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}";var Re=Ue;var Be=90*60*1e3;var Fe=6*60*60*1e3;var Ze=e("zonos_checkout",function(){function e(e){var t=this;o(this,e);this.storeUnsubscribeList=[];this.isRedirectAfterOrder=false;this.preview=false;this.hiddenMode=false;this.mobile=false;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.isOverlayLoading=false;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.shouldShowFedexShippingConsentDialog=false;this.clientSecret=a.clientSecret;this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||V.appearance.theme;return[4,u({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:E()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,c,u,l;var h=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=h===null||h===void 0?void 0:h.matches("#".concat(ie));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!o){ue("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}ue("Payment intent exist, checking stripe payment intent status");if(!r){ue("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,d({clientSecret:r})];case 1:s=e.sent(),c=s.error,u=s.status;l=new URLSearchParams(window.location.search).get("redirect_status");if(l){if(!c){ue("Payment intent is succeeded or in a good state to move forward, show success screen")}else{ue("Payment intent failed, show status from error")}this.open=true;B.checkoutSessionId=i;a.clientSecret=r;void this.setToFinishStep(u);return[2,{shouldAllowOrder:false}]}if(!t){ue("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}ue("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.initializeTestKeys=function(){B.enabledVariantTestKeys=Ie(B.enabledVariantTestKeys||[]);var e=V.enabledVariantTestKeys.map((function(e){var o;var t=(o=B.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+F,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));Z(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){if(typeof V.checkoutSettings.createCartId!=="function"){return false}var e=V.enabledVariantTestKeys.includes("hosted_vs_native");if(!e){return false}return true};this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2]}ue("[TEST] - Registering hosted vs native test");o=Ee("hosted_vs_native");if(o){ue("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2]}return[4,ke({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();if(!t){ue("[TEST] - Failed to get selection for hosted vs native test");return[2]}n=Pe({baseTestObj:B.enabledVariantTestKeys||[],mergeTestObj:t});Z(n);return[2]}}))}))};this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2,{redirected:false}]}t=Ee("hosted_vs_native");ue("[TEST] - hosted_vs_native: ".concat(t));if(typeof V.checkoutSettings.createCartId!=="function"){ue("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2,{redirected:false}]}if(t!=="hosted"){ue("[TEST] - Hosted vs native test is enabled for native, skipping");return[2,{redirected:false}]}if(!((e=V.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){ue("[TEST] - Hosted checkout URL is not provided");return[2,{redirected:false}]}ue('"createCartId" is provided, start building cart');return[4,V.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=xe();c=ye(Object.assign(Object.assign({cartId:r,checkoutSessionId:B.checkoutSessionId||undefined,hostedCheckoutUrl:V.genericSettings.hostedCheckoutUrl,isTestMode:$(),isVariantTest:true},s),i));ue("[TEST] - Redirecting to: ".concat(c));window.open(c,"_blank");return[2,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=l.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.handleHostedOpenWindowCallback=function(e){var o;var t=(o=V.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;if(!origin){return}var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.includes(o)}));if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":B.checkoutSessionId=e.data.checkoutSessionId;break}};this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){B.checkoutSessionId=t}var n=B.enabledVariantTestKeys||[];if(window.Zonos.isLegacyCheckout){var r=Ee("hosted_vs_native");if(!r){n.push({expiresAt:Date.now()+F,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});Z(n)}else{Z(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void h({adjustments:l.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;N("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){f()}l.step="customer-info";v();m();(t=(o=V.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c,i,s,s,a,u,i,d;return __generator(this,(function(f){switch(f.label){case 0:if(!(typeof V.checkoutSettings.createCartId==="function"))return[3,4];ue('"createCartId" is provided, start building cart');return[4,V.checkoutSettings.createCartId()];case 1:e=f.sent();o=void 0;if(typeof e==="object"){ue("object detected, use cartId and prefill address from createCartId","info",e);o=e.cartId;this.useShippingDataFromCreateCartId(e.shippingData);l.customerAuthenticationToken=e.customerAuthenticationToken||null}else{o=e}window.Zonos.cartId=o;return[4,Le(o)];case 2:t=f.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){J("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=Y(n),i=r.adjustments,s=r.cartItems;return[4,h({adjustments:i,cartItems:s})];case 3:f.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];ue("tempCartUUID is provided, start building cart");c=Y(window.Zonos.cartData),i=c.adjustments,s=c.cartItems;return[4,h({adjustments:i,cartItems:s})];case 5:f.sent();return[3,9];case 6:if(!(V.checkoutSettings.buildCartDetail&&D.selectedCountryCode))return[3,9];ue("build cart detail");return[4,V.checkoutSettings.buildCartDetail({countryCode:D.selectedCountryCode,currencyCode:D.targetCurrency})];case 7:s=f.sent();a=s.filter((function(e){return e.amount>=0}));u=s.filter((function(e){return e.amount<0}));ue("cartItems","info",{cartItems:s});i=u.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,h({adjustments:i,cartItems:a})];case 8:f.sent();f.label=9;case 9:if(!!B.checkoutSessionId)return[3,11];return[4,p()];case 10:d=f.sent();ue("stripeStoreInitCheckoutSession: ".concat(d));if(!d){return[2,false]}f.label=11;case 11:if(!l.isStagingMode){void g()}return[4,this.applyStripeTheme()];case 12:f.sent();this.isRedirectAfterOrder=V.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!l.externalConfirmationPageURL;return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=ee(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;ue("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Fe;if(o>t){ue("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;ue("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!B.checkoutSessionId){return}void ne({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:B.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!B.checkoutSessionId){return}void ne({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:B.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!B.checkoutSessionId){return}void ne({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:B.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||V.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=V.checkoutSettings.placeOrderButtonSelector;var t=V.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;ue("attach checkout ".concat(o));ue("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData){return}var n=[o,t,"#".concat(ce),"#".concat(ie),"#".concat(se)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}ue("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,c,u,d,h,f,v,m,p,g,b,_,C;return __generator(this,(function(x){switch(x.label){case 0:i=performance.now();s=t&&n.matches(t);c=n.matches("#".concat(se));u=n.matches("#".concat(ce))||n.matches("#".concat(ie));if(!window.Zonos.isLegacyCheckout&&(!_e()||be())&&!s&&!c&&!u){return[2]}o.preventDefault();o.stopPropagation();ue("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=x.sent().shouldAllowOrder;if(!d){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void Te()}),2e3)}if(!Ne("hosted_vs_native"))return[3,4];this.isOverlayLoading=true;return[4,this.registerTestHostedVsNative()];case 2:x.sent();return[4,this.handleHostedVsNative()];case 3:h=x.sent().redirected;this.isOverlayLoading=false;if(h){return[2]}x.label=4;case 4:a.isFetchingSession=true;this.open=true;x.label=5;case 5:x.trys.push([5,8,,9]);return[4,this.buildCartAndInit()];case 6:f=x.sent();if(!f){throw new Error("Error building cart")}(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:B.checkoutSessionId,type:"zonos-checkout-session-update"},"*");z({isPreview:this.preview,sessionTimeout:Be});N("zonos-checkout-start");v=B.checkoutSessionId;void w({checkoutSessionId:v,eventName:"checkout_open"});return[4,we()];case 7:m=x.sent().enabled;l.shouldHideDiscountInput=!m;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void Ae()}else{p=performance.now();g=p-i;void Oe({loadTime:g})}this.recordCheckoutInfo();b=!!ae();if(b){this.markTheSessionAsAbandonedCart()}return[3,9];case 8:_=x.sent();if(_ instanceof Error){C=_.message;if(C==="Cart is expired."){this.isCartExpired=true}}a.isFetchingSession=false;J(_);if(this.isCartExpired){a.isFetchingSession=true;return[2]}void Q({endpoint:"Error creating Checkout",errors:[_ instanceof Error?_.toString():"Unknown error"],metadata:{allLogs:le,cartId:window.Zonos.cartId,checkoutSessionBody:k(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||V.onlineStoreSettings.url}});y({messages:[K("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:K("Error creating Checkout")});return[3,9];case 9:return[2]}}))}))}),{capture:true,passive:false});if(!V.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(ce))){n.dispatchEvent(fe("click"));s();n.remove()}if(n.matches("#".concat(ie))){n.dispatchEvent(fe("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}ue("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var h=new URLSearchParams(window.location.search);var f=r||R(h)||D.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:f,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);ue("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=R(e)||D.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerFirstName");var u=o("customerLastName");var d=o("customerPhone");var l=o("customerZip");var h=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:a,customerLastName:u,customerName:c,customerPhone:d,customerState:h,customerZip:l})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!s||!c||!t){ue("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&D.shippingZoneCountries&&!(t in D.shippingZoneCountries)){ue('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];ue("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){l.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){a.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;l.isStagingMode=oe();if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}Ce({domesticRedirectedBtnSelector:ce,onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){a.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){ue("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}ue("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){l.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){b(e);return[2]}))}))};e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(se));if(e){e.dispatchEvent(fe("click"))}return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;var u=this;return __generator(this,(function(d){switch(d.label){case 0:N("zonos-checkout-customer-info");r=B.checkoutSessionId;void w({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,_()];case 1:i=d.sent().isRequestNotReady;if(i&&l.addressFormRenderType==="stripe"){void Q({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=a.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=a.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(l.step!=="customer-info"){clearInterval(e);return}if(!a.isFetchingLandedCost){if(l.landedCostData){void j({currency:l.currency});C()}u.submitLoading=false;if(e){clearInterval(e)}}};s();c=setInterval((function(){s(c)}),20);setTimeout((function(){clearInterval(c)}),1e4);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){C();return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=a.checkoutSettlementCurrency==="USD";if(e&&a.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;P.paypalErrorMessage=null;a.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;return[4,x()];case 1:o=i.sent();if(!o){a.hasPaymentError=true;a.customErrorMessage=K("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:a.checkoutSettlementCurrency});this.submitLoading=false;return[2]}i.label=2;case 2:i.trys.push([2,4,,5]);t=l;return[4,S()];case 3:t.inventoryCheckErrorMessage=i.sent();return[3,5];case 4:n=i.sent();l.inventoryCheckErrorMessage=K("Unable to check inventory. Please try again.");return[3,5];case 5:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i.label=6;case 6:i.trys.push([6,8,,9]);return[4,T()];case 7:i.sent();C();m();return[3,9];case 8:r=i.sent();J(r);N("zonos-checkout-payment-fail");a.hasPaymentError=true;if(a.shouldInventoryRefund){void A();a.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:O();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||V.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=te(this.mobile);void this.applyStripeTheme();ue("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=te(this.mobile);void this.applyStripeTheme();ue("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=G(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){O()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){ue("No customer profile","info");this.defaultCustomerProfileAddress=[];return}ue("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=a.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=a.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){ue("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){window.Zonos.openHelloDialog(false);if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=te(this.mobile);this.isIframed=window.self!==window.top;ue("iframed: ".concat(this.isIframed));if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}this.handleAppearanceSettingsOverrideChange();this.storeUnsubscribeList=[H("selectedLocale",(function(){void e.applyStripeTheme()})),I("selectedShippingOption",(function(){var o,t,n;var r=l.selectedShippingOption;if(((t=(o=r===null||r===void 0?void 0:r.shippingProfile)===null||o===void 0?void 0:o.serviceLevel.code)===null||t===void 0?void 0:t.toLowerCase().startsWith("fedex."))&&((n=a.stripeAddressEventData)===null||n===void 0?void 0:n.value.address.country)==="CA"){e.shouldShowFedexShippingConsentDialog=true}}))];this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);ue("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){O();f();this.storeUnsubscribeList.forEach((function(e){return e()}));window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,c;this.customerProfile=a.customerProfile;this.clientSecret=a.clientSecret;if(a.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret}var u=l.step!=="finish"&&l.step!=="error"&&!a.stripeElements||a.isFetchingSession;var d=W(V.appearance,this.appearanceSettingsOverride||null),h=d.colorPrimary,f=d.colorSecondary,v=d.logoUrl,m=d.style;var p=V.appearance.zonosAttribution==="ENABLED";var g=V.appearance.theme;var z=h&&me(h)?"DARK":"LIGHT";var w=this.isMobile?g:z;var k=!this.isMobile?f:undefined;var y=D.customMessages;var b=(o=y.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var _=this.getCurrentLocalePageEnum();var C=y.filter((function(e){return e.pageName===_}));var x=this.getBaseCurrencySettlementInfo();var S=function(){var o=e.preview?"".concat(v,"?timestamp=").concat(Date.now()):v;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(V.organizationName," logo"),src:o}))};var T=$();var A=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||oe();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},S(),T&&t("zonos-badge",{badgeColor:"orange",size:"small"},K("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},K("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),t("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),C.map((function(e){return t("zonos-custom-message",{icon:De,message:e.message})})))};var O=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:K("Your checkout session has expired. Please reload the page to continue."),restStateTitle:K("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},K("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":ve({overrideBorderStyle:m})}},l.step!=="finish"&&l.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":w,style:pe({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&A(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:k}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:k}),l.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:k})),t("div",{class:"zonos--right","data-theme":g},e.isMobile&&A(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:ge}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:k}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:De,message:b})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:De,message:b}))))),(l.step==="finish"||l.step==="error")&&t("div",{class:"zonos--done","data-theme":g},t("div",{class:"zonos--header"},S(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:ge}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:g})),t("zonos-checkout-finish",{borderRadius:m,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":g,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return t(r,{class:he(["zonos--checkout zonos--elements",l.step==="payment"&&"zonos--processing-payment",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?O():t("zonos-dialog",{borderStyle:m,"data-theme":g,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},O()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:K("Don't close"),dialogConfirmBtnText:K("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:K("Would you like to close checkout and return to the site?"),dialogTitle:K("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:K("Return to merchant site"),dialogConfirmBtnText:K("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?K("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):K("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null)}),dialogTitle:K("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:K("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:t(n,null,K("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),t("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},K("View GAA Form."))),dialogTitle:K("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:function(){return e.shouldShowFedexShippingConsentDialog=false}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:K("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:K("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),x&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:K("Cancel"),dialogConfirmBtnText:K("Pay [orderTotal]",{orderTotal:M({amount:x.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:K("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:K("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:K("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:K("You are being sent back to the shop to re-add items to your cart."),dialogTitle:K("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}());Ze.style=Re}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,c as t}from"./p-7af39c98.js";import{s as o,l as n,f as s,b as r}from"./p-7eb8e2d4.js";import{t as i}from"./p-d42b5113.js";import{f as a,h as d,g as l,a as c,s as u,l as m,j as p}from"./p-41dd1cb8.js";import{l as v,b as h}from"./p-0a377722.js";import{i as y}from"./p-e688e493.js";import{g}from"./p-0ffd710e.js";const w=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const s=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=s[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||s.slice(1).join(" ").trim()||""}},f=({currentAddress:e,translatedAddress:t})=>{var o,n,s,r,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(s=t.line2)||void 0===s?void 0:s[u||""])||u||"",name:(null===(r=t.name)||void 0===r?void 0:r[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},b=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),s=P.stripeLinkEventData,r=P.stripeAddressEventData,i=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(!r||!i)throw new Error("Missing stripe address data");const a=f({currentAddress:r,translatedAddress:P.translatedAddress.address}),{firstName:d,lastName:l}=w({name:a.name}),c=f({currentAddress:i,translatedAddress:P.translatedAddress.address}),{firstName:u,lastName:m}=w({name:c.name});return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:u,lastName:m,phone:c.phone},cartCurrencyCode:null===(t=ne.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==s?void 0:s.value.email,firstName:d,lastName:l,phone:a.phone},isTest:!!n,landedCostAdjustments:ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:P.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}},S=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=P.stripeLinkEventData,n=P.stripeAddressEventData,s=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(v({stripeAddressData:n,stripeBillingAddressData:s},"info"),!n||!s)throw new Error("Missing stripe address data");const r=f({currentAddress:n,translatedAddress:P.translatedAddress.address}),{firstName:i,lastName:a}=w({name:r.name}),d=f({currentAddress:s,translatedAddress:P.translatedAddress.address}),{firstName:l,lastName:c}=w({name:d.name}),u=ne.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),m=ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"},...u]:u;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:c,phone:d.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:r.phone},isTest:e,items:ne.items,landedCostAdjustments:m,shipToTaxId:P.taxId,shippingAddress:{addressLine1:r.line1,addressLine2:r.line2,city:r.city,country:r.country,postalCode:r.postal_code,state:r.state}}};const C=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,s,r;const i=S(),l=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:a.vercel});if(!l||!(null===(t=l.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=l.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(s=null===(n=null==l?void 0:l.errors)||void 0===n?void 0:n[0])||void 0===s?void 0:s.message)||"Unknown error"}`);const{errors:c,json:u}=await d("/api/zonos-elements/validate-landed-cost",{body:l,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(r=c.find(Boolean))||void 0===r?void 0:r.message)||"Unknown error"}`);return l})(n);return e}const{errors:s,json:r}=await d("/api/zonos-elements/calculate-landed-cost",{body:S(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r){if("The user aborted a request."===(null===(o=s[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(s.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!r)throw new Error("Failed to calculate landed cost");return r}return r})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n,s,r,i;const{errors:a,json:l}=await d("/api/zonos-elements/cart-calculate-landed-cost",{body:b(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!l){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(s=a[0])||void 0===s?void 0:s.message.includes("signal is aborted"))||(null===(r=a[0])||void 0===r?void 0:r.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return l})({abortController:t,cartId:o}),{cartWorkflow:s}=n,r=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},r),{itemCreateWorkflow:s.items})},O=async({checkoutSessionId:t,eventName:o,metadata:s})=>{var r,i;const a=Date.now(),m=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(r=window.Zonos)||void 0===r?void 0:r.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((l()||c()||p)&&!window.Zonos.zonosConversionTest)return;const v=n.selectedCountryCode,y=e.organizationId;if(!t)return void u({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:h,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:m}});y||u({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:h,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:m}});const g={checkoutSessionId:t,countryCode:v,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},s),{trackEventLogs:m}),organizationId:y};await d("/api/zonos-elements/track-conversion-event",{body:g,method:"POST"})},A=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},k=e=>e.sort(((e,t)=>e.amount-t.amount)),I=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await d(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(m("Failed to retrieve checkout session info before confirming payment ",t),u({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:h}}),{errorMessage:i("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(m("Landed cost is not found in the checkout session before confirming payment."),u({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:h}}),{errorMessage:i('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},N=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},j=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:g({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:g({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:T,reset:E,state:P}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),L=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},D=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},x=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return p(e)},R=async t=>{var o,s;const r=P.clientSecret;if(!P.stripe)return void v("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:s,overrideSecondaryColor:r,overrideTheme:i,paypalEnabled:a})=>{const d=s||e.appearance.colorPrimary,l=r||e.appearance.colorSecondary,c=d&&y(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},N({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},j({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:P.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:r,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(P.stripeElementsOptions);if(!P.stripeElements||!P.stripeElementsForBillingAddress)return P.stripeElementsForBillingAddress=null===(o=P.stripe)||void 0===o?void 0:o.elements(i),v("Stripe elements for billing address initialized"),P.stripeElements=null===(s=P.stripe)||void 0===s?void 0:s.elements(i),P.stripeElementsOptions=i,void v("Stripe elements initialized");a||(P.stripeElements.update(i),P.stripeElementsForBillingAddress.update(i),P.stripeElementsOptions=i,P.stripeElements.fetchUpdates()),v("Stripe elements updated")},_=()=>{sessionStorage.removeItem("zonos--client-secret"),E(),P.stripe=window.Zonos.stripe},z=({address:e,firstName:t,lastName:n,name:s,phone:r})=>{const{firstName:i,lastName:a}=w({firstName:t,lastName:n,name:s});return i&&a||u({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:s}}),r||u({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:r}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:r||"",postal_code:e.postal_code,state:e.state}},U=async()=>{var e,t,n,s;if(!(null===(e=P.stripeAddressEventData)||void 0===e?void 0:e.complete)||!P.stripeShippingSameAsBilling&&!(null===(t=P.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!P.stripeBillingAddressEventData)return{partiesCreated:!1};if(!ne.landedCostData)return{partiesCreated:!1};const r=null===(n=ne.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!r)return u({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,s,r;const i=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=P.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeAddressEventData)||void 0===n?void 0:n.value),d=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(s=P.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===s?void 0:s.value)!==JSON.stringify(null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value);return i||a||d||P.taxIdUsedWhenAsyncAddressUpdate!==P.taxId||P.companyNameUsedWhenAsyncAddressUpdate!==P.companyName})();if(!i)return{partiesCreated:!1};const a=z({address:P.stripeAddressEventData.value.address,firstName:P.stripeAddressEventData.value.firstName,lastName:P.stripeAddressEventData.value.lastName,name:P.stripeAddressEventData.value.name,phone:P.stripeAddressEventData.value.phone}),l=P.stripeShippingSameAsBilling?a:z({address:P.stripeBillingAddressEventData.value.address,firstName:P.stripeBillingAddressEventData.value.firstName,lastName:P.stripeBillingAddressEventData.value.lastName,name:P.stripeBillingAddressEventData.value.name,phone:P.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:v}=await d("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:l,companyName:P.companyName,email:(null===(s=P.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isTest:c,rootId:r,taxId:P.taxId},method:"POST"});return p.length||!v?(m("Error occurs when creating parties",JSON.stringify(p,null,2)),u({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:p,json:v}}),{partiesCreated:!1}):(P.companyNameUsedWhenAsyncAddressUpdate=P.companyName,P.stripeAddressUsedWhenAsyncAddressUpdate=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenAsyncAddressUpdate=P.stripeBillingAddressEventData,P.taxIdUsedWhenAsyncAddressUpdate=P.taxId,P.partyBillingId=v.billToPartyId,P.partyShippingId=v.shipToPartyId,{partiesCreated:!0})},B=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),F=async t=>{var n,s,r,i;const a=(null==t?void 0:t.retries)||0,d=!!(null==t?void 0:t.applyingPromocode),l=(()=>{var e;const t=ne.landedCostData&&(null===(e=ne.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==ne.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),n=P.stripeAddressEventData&&JSON.stringify(B(P.stripeAddressEventData.value))!==JSON.stringify(P.stripeAddressUsedWhenFetchingLC),s=!P.stripeShippingSameAsBilling&&P.stripeBillingAddressEventData&&JSON.stringify(B(P.stripeBillingAddressEventData.value))!==JSON.stringify(P.stripeBillingAddressUsedWhenFetchingLC);return o||n||s})();return v("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!ne.landedCostData&&!P.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,s;const r=!!(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.complete),a=P.stripeShippingSameAsBilling?i:!!(null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const s=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,r=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===ne.addressFormRenderType&&(r&&t in r?r[t]:null)||(s&&t in s?s[t]:null)})((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US");return!!(i&&a&&r)||(d&&P.stripeAddressEventData?r&&P.stripeAddressEventData.value.firstName&&P.stripeAddressEventData.value.lastName&&P.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&P.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&P.stripeAddressEventData.value.address.postal_code.length>=3)&&P.stripeAddressEventData.value.phone&&P.stripeAddressEventData.value.phone.length>0:i&&a&&r)})())return{isRequestNotReady:!0};if(l&&(null===(n=P.fetchingLandedCostAbortController)||void 0===n||n.abort(),P.fetchingLandedCostAbortController=null),!l&&!d)return{isRequestNotReady:!1};a?(P.isFetchingLandedCost=!1,setTimeout((()=>{P.isFetchingLandedCost=!0}),300)):P.isFetchingLandedCost=!0,P.stripeAddressEventData&&(P.stripeAddressUsedWhenFetchingLC={countryCode:P.stripeAddressEventData.value.address.country,postalCode:P.stripeAddressEventData.value.address.postal_code,state:P.stripeAddressEventData.value.address.state}),P.stripeBillingAddressEventData&&(P.stripeBillingAddressUsedWhenFetchingLC={countryCode:P.stripeBillingAddressEventData.value.address.country,postalCode:P.stripeBillingAddressEventData.value.address.postal_code,state:P.stripeBillingAddressEventData.value.address.state}),P.stripeLinkEventData&&(P.stripeLinkUsedWhenFetchingLC=Object.assign({},P.stripeLinkEventData));try{we(),await(async()=>{var e;const t=new AbortController;P.fetchingLandedCostAbortController=t,we();const{checkoutSessionWorkflow:n,errors:s,itemCreateWorkflow:r,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await C(t);ne.customQuotingError=(null===(e=null==s?void 0:s.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,ne.shippingData=k((null==d?void 0:d.filter(Boolean))||[]),ae(r),P.fetchingLandedCostAbortController=null,ne.partiesData=(null==a?void 0:a.filter(Boolean))||[],ne.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&O({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=ne.promoCodeApplied&&!ne.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));ne.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",ne.promoCode)})();const e=null===(s=ne.shippingData)||void 0===s?void 0:s.find(Boolean),t=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ce({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(ne.landedCostData=[],ne.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(a<1)return await F(Object.assign(Object.assign({},t),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=P.stripeAddressEventData)||void 0===i?void 0:i.value;u({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}m(e)}return P.isFetchingLandedCost=!1,{isRequestNotReady:!1}},J=async()=>{var e,t;await F({applyingPromocode:!0}),"payment"===ne.step&&be(),await U();const o=null===(e=ne.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=ne.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await he({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},M=()=>{ne.promoCode="",sessionStorage.removeItem("zonos--promo-code"),ne.promoCodeError=!1,ne.promoCodeApplied=!1},W=async()=>{"payment"===ne.step&&be(),M(),await J()},$=e=>{let t=[],o=!0;const n=window.Zonos.isCollect;switch(e){case"succeeded":t=[i("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",i("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],n&&(t=[i("Thank you for submitting your payment. We appreciate your prompt attention."),"",i("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.")]),o=!1;break;case"requires_capture":case"processing":t=[i("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[i("Payment failed. Please try another payment method.")],n&&(t=[i("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[i("Something went wrong.")]}return{isError:o,messages:t}},q=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await d("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(m("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(P.shouldInventoryRefund=!0,null):null:i("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:ne.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw u({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:ne.items}}),e}},Y=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await d("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},H=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=$(t);return{error:e,messages:o}}const o=e||P.clientSecret;if(!P.stripe||!o)return m("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[i("Something went wrong.")]};const{paymentIntent:n}=await P.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:r,messages:a}=$(s);return{error:r,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},K=async e=>{var t,n;const s=!!(null===(t=P.stripePaymentEventData)||void 0===t?void 0:t.complete),r=P.stripeElements,a=P.stripe,d=P.clientSecret;if(P.customErrorMessage=null,!(null===(n=ne.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await I();if(!l.valid)throw P.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(a&&r&&s&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),O({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:r,redirect:"if_required"});if(v("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(i("Payment failed. Please try another payment method."))}},G=()=>{var e;const t=ne.items.reduce(((e,t)=>e+t.amount*t.quantity),0),s=o.enabledVariantTestKeys||[];return{adjustmentsAmount:ne.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=ne.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:ne.customerAuthenticationToken||void 0,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:s}},V=async()=>{var e;if(!o.checkoutSessionId)return u({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:h,cartId:window.Zonos.cartId}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});const{errors:t,json:n}=await d("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return m("Error occurs when getting payment intent",JSON.stringify(t,null,2)),u({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});me(n.checkoutSessionPaymentIntentCreate)},Z=async()=>{var e,t;if(!n.targetCurrency)return m("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;P.isFetchingSession=!0;const o=G();v("Checkout session body","info",o);const{errors:s,json:r}=await d("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(P.isFetchingSession=!1,s.length||!r){const t=null===(e=s.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return m("Error occurred when creating checkout session",JSON.stringify(s,null,2)),!1}const i=r.checkoutSessionCreate;return me(i),ce({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),v("Exchange rate updated for cart items (checkout session create)","info",ne.exchangeRate),v("done-init-checkout-session"),!0},Q=async()=>{const t=o.checkoutSessionId;if(!t)return m("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return v('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await d("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:P.checkoutSettlementCurrency},method:"POST"}),s=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&s===P.checkoutSettlementCurrency?(v(`Updated checkout session to settlement currency "${s}".`),!0):(m("Failed to update checkout session base currency"),!1)},X=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:s,line2:r,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&s&&(o.line1={[e.line1]:s}),e.line2&&r&&(o.line2={[e.line2]:r}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},ee=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,s,r;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:s})=>{const r=!!(null==o?void 0:o.complete);if(!r||!(s?r:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=w({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=w({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:A({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:s?void 0:A({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:P.stripeAddressEventData,stripeBillingAddressEventData:P.stripeBillingAddressEventData,stripeShippingSameAsBilling:P.stripeShippingSameAsBilling});if(!i)return void(P.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const s=JSON.stringify(null===(e=P.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeAddressEventData)||void 0===t?void 0:t.value),r=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(o=P.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return s||r})();if(!a)return;const{errors:l,json:c}=await d("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(l.length||!c)return m("Error occurs when translating address to latin",JSON.stringify(l,null,2)),void(P.translatedAddress={address:{},billingAddress:{}});P.stripeAddressUsedWhenValidatingAddress=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenValidatingAddress=P.stripeBillingAddressEventData;const u=null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.value.address,p=null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;P.translatedAddress={address:u?X({currentAddress:Object.assign(Object.assign({},u),{name:null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:P.stripeShippingSameAsBilling?{}:X({currentAddress:Object.assign(Object.assign({},p),{name:null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.billingAddress||null})}};T("clientSecret",(e=>{e&&P.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:te,reset:oe,state:ne}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:c(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),se=e=>{switch(e){case"DAYS":return i("days");case"WEEKS":return i("weeks");default:return i("business days")}},re=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:se(o.type)}:null},ie=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),ae=e=>{v("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=ne.items.find((t=>ie({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return ne.restrictedItems=t,ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>ie({item1:t,item2:e})))}))),{cartItems:ne.items,restrictedItems:t}},de=()=>{o.checkoutSessionId=null,oe()},le=({messages:e,title:t})=>{de(),_(),ne.step="error",ne.error={messages:e,title:t}},ce=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{ne.exchangeRate=o.exchangeRate,ne.adjustmentTotal=o.adjustments,ne.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,ne.subtotal=o.items,ne.total=o.total,ne.currency=o.presentmentCurrencyCode,ne.dutiesTaxesFeesEstimate=e||null},ue=()=>!!ne.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),me=e=>{var t,n,i,a,d;P.clientSecret=e.clientSecret,P.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,P.customerProfile=e.customerProfile,ne.checkoutSession=e,e.id||u({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:h,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const l=s(e.varianceTestResults||[]);r(l);const c=(null===(i=null===(n=null===(t=ne.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===i?void 0:i.value)||(null===(d=null===(a=window.Zonos.cartData)||void 0===a?void 0:a.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===d?void 0:d.value)||null;c&&(v(`Found externalConfirmationPageURL: ${c}`),ne.externalConfirmationPageURL=c)},pe=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:r,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var u;if(l&&ne.selectedLandedCost&&(ce({dutiesTaxesFeesEstimate:r,method:ne.landedCostMethod,subtotals:ne.selectedLandedCost.subtotals}),v("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate)),!o.checkoutSessionId)return v("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:h}=await(async({adjustmentsAmount:e,cartId:t,currency:s,id:r,itemsAmount:i,landedCostId:a,presentmentCountryCode:l})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:p}=await d("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,customerAuthenticationToken:ne.customerAuthenticationToken||void 0,id:r,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:l,shipToPartyId:P.partyShippingId,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!p?(m("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:p}):{errors:[],json:p}})({adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!h){if(m("Error occurs when updating checkout session."),c){v("Initiating checkout session on failure","info");const e=await Z();return v(`stripeStoreInitCheckoutSession: ${e}`),!!e||(le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")}),!1)}return!1}return l||(ce({method:(null===(u=h.checkoutSessionUpdate.landedCost)||void 0===u?void 0:u.method)||"DDP",subtotals:h.checkoutSessionUpdate.subtotals}),v("Exchange rate updated for cart items (checkout session update)","info",ne.exchangeRate)),me(h.checkoutSessionUpdate),!0},ve=t=>{var o,n,s;return"DAP"===t.method&&(null===(n=null===(o=e.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US"))||"DAP"===t.method&&t.remittance.length&&"ZONOS"===t.landedCostGuaranteeCode?"DDP":t.method},he=async({applySubtotalsOnly:t,landedCostId:n,selectedShippingOption:s})=>{var r,i,a,d,l,c,u,m,p,h,y;v("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:s}),ne.selectedShippingOption=s;const g=re(ne.selectedShippingOption);if(g){const{maxTransit:e,minTransit:t,unit:o}=g;ne.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else ne.selectedShippingOptionTransitTime="";const w=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(ne.selectedLandedCost=w||null,!w)return!1;const f=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;f&&v(`DAP quote, using estimate: ${f}`,"info"),ne.landedCostMethod=ve(w.landedCost),ne.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));ne.isSelectedShippingAboveDeminimis=S,ne.isSelectedShippingGuarantee=b;let C=!1;t?(ce({dutiesTaxesFeesEstimate:f,method:ne.landedCostMethod,subtotals:w.subtotals}),v("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate),C=!0):C=await pe({adjustmentsAmount:ne.adjustmentTotal,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:f,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(u=ne.items.find(Boolean))||void 0===u?void 0:u.currencyCode,A=(null===(m=P.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return P.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=ne.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=e.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},ye=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;v(`==START CHECKOUT TIMEOUT - ${n}==`),ne.checkoutTimeoutInterval=setTimeout((()=>{ne.checkoutSessionTimeoutShow=!0}),n)},ge=()=>{ne.checkoutTimeoutInterval&&(clearTimeout(ne.checkoutTimeoutInterval),ne.checkoutTimeoutInterval=null)},we=()=>{ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),ne.restrictedItems=[]},fe=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:s=!0})=>{var r;ne.adjustments=e,ne.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(r=t.find(Boolean))||void 0===r?void 0:r.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(ne.currency=i,P.isFetchingSession=!0,await pe({adjustmentsAmount:d,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:P.partyShippingId,shouldInitSessionOnFailure:s,varianceTestInput:o.enabledVariantTestKeys||[]}),P.isFetchingSession=!1)},be=()=>{"shipping"===ne.step?(ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"payment"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"finish"===ne.step&&(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1})}))},Se=()=>{"customer-info"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!0})})):"shipping"===ne.step?(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!0})})):"payment"===ne.step&&(ne.step="finish")},Ce=()=>{ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})}),ne.selectedShippingOption=null,ne.isSelectedShippingAboveDeminimis=!1,ne.isSelectedShippingGuarantee=!1,ne.selectedShippingOptionTransitTime="",ne.dutiesTaxesFees=0,ne.dutiesTaxesFeesEstimate=0,ne.shipping=0,ne.total=ne.subtotal};export{T as A,z as B,he as C,ue as D,J as E,W as F,M as G,$ as H,ee as I,w as J,te as K,U as L,re as M,ve as N,k as O,L as a,D as b,P as c,H as d,ne as e,fe as f,de as g,Ce as h,R as i,ge as j,Z as k,V as l,ye as m,G as n,le as o,me as p,F as q,Se as r,x as s,O as t,Q as u,q as v,K as w,Y as x,_ as y,I as z}
|
|
1
|
+
import{z as e,c as t}from"./p-7af39c98.js";import{s as o,l as n,f as s,b as r}from"./p-c3c3cd98.js";import{t as i}from"./p-eea0d8af.js";import{f as a,h as d,g as l,a as c,s as u,l as m,j as p}from"./p-41dd1cb8.js";import{l as v,b as h}from"./p-0a377722.js";import{i as y}from"./p-e688e493.js";import{g}from"./p-0ffd710e.js";const w=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const s=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=s[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||s.slice(1).join(" ").trim()||""}},f=({currentAddress:e,translatedAddress:t})=>{var o,n,s,r,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(s=t.line2)||void 0===s?void 0:s[u||""])||u||"",name:(null===(r=t.name)||void 0===r?void 0:r[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},b=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),s=P.stripeLinkEventData,r=P.stripeAddressEventData,i=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(!r||!i)throw new Error("Missing stripe address data");const a=f({currentAddress:r,translatedAddress:P.translatedAddress.address}),{firstName:d,lastName:l}=w({name:a.name}),c=f({currentAddress:i,translatedAddress:P.translatedAddress.address}),{firstName:u,lastName:m}=w({name:c.name});return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:u,lastName:m,phone:c.phone},cartCurrencyCode:null===(t=ne.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==s?void 0:s.value.email,firstName:d,lastName:l,phone:a.phone},isTest:!!n,landedCostAdjustments:ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:P.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}},S=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=P.stripeLinkEventData,n=P.stripeAddressEventData,s=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(v({stripeAddressData:n,stripeBillingAddressData:s},"info"),!n||!s)throw new Error("Missing stripe address data");const r=f({currentAddress:n,translatedAddress:P.translatedAddress.address}),{firstName:i,lastName:a}=w({name:r.name}),d=f({currentAddress:s,translatedAddress:P.translatedAddress.address}),{firstName:l,lastName:c}=w({name:d.name}),u=ne.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),m=ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"},...u]:u;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:c,phone:d.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:r.phone},isTest:e,items:ne.items,landedCostAdjustments:m,shipToTaxId:P.taxId,shippingAddress:{addressLine1:r.line1,addressLine2:r.line2,city:r.city,country:r.country,postalCode:r.postal_code,state:r.state}}};const C=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,s,r;const i=S(),l=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:a.vercel});if(!l||!(null===(t=l.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=l.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(s=null===(n=null==l?void 0:l.errors)||void 0===n?void 0:n[0])||void 0===s?void 0:s.message)||"Unknown error"}`);const{errors:c,json:u}=await d("/api/zonos-elements/validate-landed-cost",{body:l,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(r=c.find(Boolean))||void 0===r?void 0:r.message)||"Unknown error"}`);return l})(n);return e}const{errors:s,json:r}=await d("/api/zonos-elements/calculate-landed-cost",{body:S(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r){if("The user aborted a request."===(null===(o=s[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(s.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!r)throw new Error("Failed to calculate landed cost");return r}return r})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n,s,r,i;const{errors:a,json:l}=await d("/api/zonos-elements/cart-calculate-landed-cost",{body:b(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!l){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(s=a[0])||void 0===s?void 0:s.message.includes("signal is aborted"))||(null===(r=a[0])||void 0===r?void 0:r.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return l})({abortController:t,cartId:o}),{cartWorkflow:s}=n,r=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},r),{itemCreateWorkflow:s.items})},O=async({checkoutSessionId:t,eventName:o,metadata:s})=>{var r,i;const a=Date.now(),m=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(r=window.Zonos)||void 0===r?void 0:r.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((l()||c()||p)&&!window.Zonos.zonosConversionTest)return;const v=n.selectedCountryCode,y=e.organizationId;if(!t)return void u({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:h,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:m}});y||u({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:h,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:m}});const g={checkoutSessionId:t,countryCode:v,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},s),{trackEventLogs:m}),organizationId:y};await d("/api/zonos-elements/track-conversion-event",{body:g,method:"POST"})},A=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},k=e=>e.sort(((e,t)=>e.amount-t.amount)),I=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await d(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(m("Failed to retrieve checkout session info before confirming payment ",t),u({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:h}}),{errorMessage:i("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(m("Landed cost is not found in the checkout session before confirming payment."),u({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:h}}),{errorMessage:i('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},N=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},j=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:g({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:g({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:T,reset:E,state:P}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),L=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},D=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},x=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return p(e)},R=async t=>{var o,s;const r=P.clientSecret;if(!P.stripe)return void v("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:s,overrideSecondaryColor:r,overrideTheme:i,paypalEnabled:a})=>{const d=s||e.appearance.colorPrimary,l=r||e.appearance.colorSecondary,c=d&&y(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},N({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},j({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:P.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:r,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(P.stripeElementsOptions);if(!P.stripeElements||!P.stripeElementsForBillingAddress)return P.stripeElementsForBillingAddress=null===(o=P.stripe)||void 0===o?void 0:o.elements(i),v("Stripe elements for billing address initialized"),P.stripeElements=null===(s=P.stripe)||void 0===s?void 0:s.elements(i),P.stripeElementsOptions=i,void v("Stripe elements initialized");a||(P.stripeElements.update(i),P.stripeElementsForBillingAddress.update(i),P.stripeElementsOptions=i,P.stripeElements.fetchUpdates()),v("Stripe elements updated")},_=()=>{sessionStorage.removeItem("zonos--client-secret"),E(),P.stripe=window.Zonos.stripe},z=({address:e,firstName:t,lastName:n,name:s,phone:r})=>{const{firstName:i,lastName:a}=w({firstName:t,lastName:n,name:s});return i&&a||u({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:s}}),r||u({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:r}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:r||"",postal_code:e.postal_code,state:e.state}},U=async()=>{var e,t,n,s;if(!(null===(e=P.stripeAddressEventData)||void 0===e?void 0:e.complete)||!P.stripeShippingSameAsBilling&&!(null===(t=P.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!P.stripeBillingAddressEventData)return{partiesCreated:!1};if(!ne.landedCostData)return{partiesCreated:!1};const r=null===(n=ne.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!r)return u({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,s,r;const i=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=P.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeAddressEventData)||void 0===n?void 0:n.value),d=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(s=P.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===s?void 0:s.value)!==JSON.stringify(null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value);return i||a||d||P.taxIdUsedWhenAsyncAddressUpdate!==P.taxId||P.companyNameUsedWhenAsyncAddressUpdate!==P.companyName})();if(!i)return{partiesCreated:!1};const a=z({address:P.stripeAddressEventData.value.address,firstName:P.stripeAddressEventData.value.firstName,lastName:P.stripeAddressEventData.value.lastName,name:P.stripeAddressEventData.value.name,phone:P.stripeAddressEventData.value.phone}),l=P.stripeShippingSameAsBilling?a:z({address:P.stripeBillingAddressEventData.value.address,firstName:P.stripeBillingAddressEventData.value.firstName,lastName:P.stripeBillingAddressEventData.value.lastName,name:P.stripeBillingAddressEventData.value.name,phone:P.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:p,json:v}=await d("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:l,companyName:P.companyName,email:(null===(s=P.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isTest:c,rootId:r,taxId:P.taxId},method:"POST"});return p.length||!v?(m("Error occurs when creating parties",JSON.stringify(p,null,2)),u({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:p,json:v}}),{partiesCreated:!1}):(P.companyNameUsedWhenAsyncAddressUpdate=P.companyName,P.stripeAddressUsedWhenAsyncAddressUpdate=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenAsyncAddressUpdate=P.stripeBillingAddressEventData,P.taxIdUsedWhenAsyncAddressUpdate=P.taxId,P.partyBillingId=v.billToPartyId,P.partyShippingId=v.shipToPartyId,{partiesCreated:!0})},B=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),F=async t=>{var n,s,r,i;const a=(null==t?void 0:t.retries)||0,d=!!(null==t?void 0:t.applyingPromocode),l=(()=>{var e;const t=ne.landedCostData&&(null===(e=ne.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==ne.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),n=P.stripeAddressEventData&&JSON.stringify(B(P.stripeAddressEventData.value))!==JSON.stringify(P.stripeAddressUsedWhenFetchingLC),s=!P.stripeShippingSameAsBilling&&P.stripeBillingAddressEventData&&JSON.stringify(B(P.stripeBillingAddressEventData.value))!==JSON.stringify(P.stripeBillingAddressUsedWhenFetchingLC);return o||n||s})();return v("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!ne.landedCostData&&!P.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,s;const r=!!(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.complete),a=P.stripeShippingSameAsBilling?i:!!(null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const s=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,r=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===ne.addressFormRenderType&&(r&&t in r?r[t]:null)||(s&&t in s?s[t]:null)})((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US");return!!(i&&a&&r)||(d&&P.stripeAddressEventData?r&&P.stripeAddressEventData.value.firstName&&P.stripeAddressEventData.value.lastName&&P.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&P.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&P.stripeAddressEventData.value.address.postal_code.length>=3)&&P.stripeAddressEventData.value.phone&&P.stripeAddressEventData.value.phone.length>0:i&&a&&r)})())return{isRequestNotReady:!0};if(l&&(null===(n=P.fetchingLandedCostAbortController)||void 0===n||n.abort(),P.fetchingLandedCostAbortController=null),!l&&!d)return{isRequestNotReady:!1};a?(P.isFetchingLandedCost=!1,setTimeout((()=>{P.isFetchingLandedCost=!0}),300)):P.isFetchingLandedCost=!0,P.stripeAddressEventData&&(P.stripeAddressUsedWhenFetchingLC={countryCode:P.stripeAddressEventData.value.address.country,postalCode:P.stripeAddressEventData.value.address.postal_code,state:P.stripeAddressEventData.value.address.state}),P.stripeBillingAddressEventData&&(P.stripeBillingAddressUsedWhenFetchingLC={countryCode:P.stripeBillingAddressEventData.value.address.country,postalCode:P.stripeBillingAddressEventData.value.address.postal_code,state:P.stripeBillingAddressEventData.value.address.state}),P.stripeLinkEventData&&(P.stripeLinkUsedWhenFetchingLC=Object.assign({},P.stripeLinkEventData));try{we(),await(async()=>{var e;const t=new AbortController;P.fetchingLandedCostAbortController=t,we();const{checkoutSessionWorkflow:n,errors:s,itemCreateWorkflow:r,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await C(t);ne.customQuotingError=(null===(e=null==s?void 0:s.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,ne.shippingData=k((null==d?void 0:d.filter(Boolean))||[]),ae(r),P.fetchingLandedCostAbortController=null,ne.partiesData=(null==a?void 0:a.filter(Boolean))||[],ne.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&O({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=ne.promoCodeApplied&&!ne.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));ne.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",ne.promoCode)})();const e=null===(s=ne.shippingData)||void 0===s?void 0:s.find(Boolean),t=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ce({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(ne.landedCostData=[],ne.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(a<1)return await F(Object.assign(Object.assign({},t),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=P.stripeAddressEventData)||void 0===i?void 0:i.value;u({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}m(e)}return P.isFetchingLandedCost=!1,{isRequestNotReady:!1}},J=async()=>{var e,t;await F({applyingPromocode:!0}),"payment"===ne.step&&be(),await U();const o=null===(e=ne.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=ne.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await he({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},M=()=>{ne.promoCode="",sessionStorage.removeItem("zonos--promo-code"),ne.promoCodeError=!1,ne.promoCodeApplied=!1},W=async()=>{"payment"===ne.step&&be(),M(),await J()},$=e=>{let t=[],o=!0;const n=window.Zonos.isCollect;switch(e){case"succeeded":t=[i("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",i("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],n&&(t=[i("Thank you for submitting your payment. We appreciate your prompt attention."),"",i("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.")]),o=!1;break;case"requires_capture":case"processing":t=[i("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[i("Payment failed. Please try another payment method.")],n&&(t=[i("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[i("Something went wrong.")]}return{isError:o,messages:t}},q=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await d("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(m("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(P.shouldInventoryRefund=!0,null):null:i("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:ne.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw u({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:ne.items}}),e}},Y=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await d("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},H=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=$(t);return{error:e,messages:o}}const o=e||P.clientSecret;if(!P.stripe||!o)return m("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[i("Something went wrong.")]};const{paymentIntent:n}=await P.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:r,messages:a}=$(s);return{error:r,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},K=async e=>{var t,n;const s=!!(null===(t=P.stripePaymentEventData)||void 0===t?void 0:t.complete),r=P.stripeElements,a=P.stripe,d=P.clientSecret;if(P.customErrorMessage=null,!(null===(n=ne.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await I();if(!l.valid)throw P.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(a&&r&&s&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),O({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:r,redirect:"if_required"});if(v("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(i("Payment failed. Please try another payment method."))}},G=()=>{var e;const t=ne.items.reduce(((e,t)=>e+t.amount*t.quantity),0),s=o.enabledVariantTestKeys||[];return{adjustmentsAmount:ne.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=ne.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:ne.customerAuthenticationToken||void 0,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:s}},V=async()=>{var e;if(!o.checkoutSessionId)return u({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:h,cartId:window.Zonos.cartId}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});const{errors:t,json:n}=await d("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return m("Error occurs when getting payment intent",JSON.stringify(t,null,2)),u({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:h,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});me(n.checkoutSessionPaymentIntentCreate)},Z=async()=>{var e,t;if(!n.targetCurrency)return m("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;P.isFetchingSession=!0;const o=G();v("Checkout session body","info",o);const{errors:s,json:r}=await d("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(P.isFetchingSession=!1,s.length||!r){const t=null===(e=s.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return m("Error occurred when creating checkout session",JSON.stringify(s,null,2)),!1}const i=r.checkoutSessionCreate;return me(i),ce({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),v("Exchange rate updated for cart items (checkout session create)","info",ne.exchangeRate),v("done-init-checkout-session"),!0},Q=async()=>{const t=o.checkoutSessionId;if(!t)return m("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return v('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await d("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:P.checkoutSettlementCurrency},method:"POST"}),s=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&s===P.checkoutSettlementCurrency?(v(`Updated checkout session to settlement currency "${s}".`),!0):(m("Failed to update checkout session base currency"),!1)},X=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:s,line2:r,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&s&&(o.line1={[e.line1]:s}),e.line2&&r&&(o.line2={[e.line2]:r}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},ee=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,s,r;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:s})=>{const r=!!(null==o?void 0:o.complete);if(!r||!(s?r:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=w({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=w({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:A({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:s?void 0:A({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:P.stripeAddressEventData,stripeBillingAddressEventData:P.stripeBillingAddressEventData,stripeShippingSameAsBilling:P.stripeShippingSameAsBilling});if(!i)return void(P.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const s=JSON.stringify(null===(e=P.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeAddressEventData)||void 0===t?void 0:t.value),r=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(o=P.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return s||r})();if(!a)return;const{errors:l,json:c}=await d("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(l.length||!c)return m("Error occurs when translating address to latin",JSON.stringify(l,null,2)),void(P.translatedAddress={address:{},billingAddress:{}});P.stripeAddressUsedWhenValidatingAddress=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenValidatingAddress=P.stripeBillingAddressEventData;const u=null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.value.address,p=null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;P.translatedAddress={address:u?X({currentAddress:Object.assign(Object.assign({},u),{name:null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:P.stripeShippingSameAsBilling?{}:X({currentAddress:Object.assign(Object.assign({},p),{name:null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.billingAddress||null})}};T("clientSecret",(e=>{e&&P.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:te,reset:oe,state:ne}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:c(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),se=e=>{switch(e){case"DAYS":return i("days");case"WEEKS":return i("weeks");default:return i("business days")}},re=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:se(o.type)}:null},ie=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),ae=e=>{v("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=ne.items.find((t=>ie({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return ne.restrictedItems=t,ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>ie({item1:t,item2:e})))}))),{cartItems:ne.items,restrictedItems:t}},de=()=>{o.checkoutSessionId=null,oe()},le=({messages:e,title:t})=>{de(),_(),ne.step="error",ne.error={messages:e,title:t}},ce=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{ne.exchangeRate=o.exchangeRate,ne.adjustmentTotal=o.adjustments,ne.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,ne.subtotal=o.items,ne.total=o.total,ne.currency=o.presentmentCurrencyCode,ne.dutiesTaxesFeesEstimate=e||null},ue=()=>!!ne.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),me=e=>{var t,n,i,a,d;P.clientSecret=e.clientSecret,P.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,P.customerProfile=e.customerProfile,ne.checkoutSession=e,e.id||u({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:h,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const l=s(e.varianceTestResults||[]);r(l);const c=(null===(i=null===(n=null===(t=ne.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===i?void 0:i.value)||(null===(d=null===(a=window.Zonos.cartData)||void 0===a?void 0:a.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===d?void 0:d.value)||null;c&&(v(`Found externalConfirmationPageURL: ${c}`),ne.externalConfirmationPageURL=c)},pe=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:r,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var u;if(l&&ne.selectedLandedCost&&(ce({dutiesTaxesFeesEstimate:r,method:ne.landedCostMethod,subtotals:ne.selectedLandedCost.subtotals}),v("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate)),!o.checkoutSessionId)return v("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:h}=await(async({adjustmentsAmount:e,cartId:t,currency:s,id:r,itemsAmount:i,landedCostId:a,presentmentCountryCode:l})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:p}=await d("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,customerAuthenticationToken:ne.customerAuthenticationToken||void 0,id:r,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:l,shipToPartyId:P.partyShippingId,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!p?(m("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:p}):{errors:[],json:p}})({adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!h){if(m("Error occurs when updating checkout session."),c){v("Initiating checkout session on failure","info");const e=await Z();return v(`stripeStoreInitCheckoutSession: ${e}`),!!e||(le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")}),!1)}return!1}return l||(ce({method:(null===(u=h.checkoutSessionUpdate.landedCost)||void 0===u?void 0:u.method)||"DDP",subtotals:h.checkoutSessionUpdate.subtotals}),v("Exchange rate updated for cart items (checkout session update)","info",ne.exchangeRate)),me(h.checkoutSessionUpdate),!0},ve=t=>{var o,n,s;return"DAP"===t.method&&(null===(n=null===(o=e.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US"))||"DAP"===t.method&&t.remittance.length&&"ZONOS"===t.landedCostGuaranteeCode?"DDP":t.method},he=async({applySubtotalsOnly:t,landedCostId:n,selectedShippingOption:s})=>{var r,i,a,d,l,c,u,m,p,h,y;v("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:s}),ne.selectedShippingOption=s;const g=re(ne.selectedShippingOption);if(g){const{maxTransit:e,minTransit:t,unit:o}=g;ne.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else ne.selectedShippingOptionTransitTime="";const w=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(ne.selectedLandedCost=w||null,!w)return!1;const f=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;f&&v(`DAP quote, using estimate: ${f}`,"info"),ne.landedCostMethod=ve(w.landedCost),ne.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));ne.isSelectedShippingAboveDeminimis=S,ne.isSelectedShippingGuarantee=b;let C=!1;t?(ce({dutiesTaxesFeesEstimate:f,method:ne.landedCostMethod,subtotals:w.subtotals}),v("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate),C=!0):C=await pe({adjustmentsAmount:ne.adjustmentTotal,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:f,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(u=ne.items.find(Boolean))||void 0===u?void 0:u.currencyCode,A=(null===(m=P.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return P.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=ne.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=e.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},ye=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;v(`==START CHECKOUT TIMEOUT - ${n}==`),ne.checkoutTimeoutInterval=setTimeout((()=>{ne.checkoutSessionTimeoutShow=!0}),n)},ge=()=>{ne.checkoutTimeoutInterval&&(clearTimeout(ne.checkoutTimeoutInterval),ne.checkoutTimeoutInterval=null)},we=()=>{ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),ne.restrictedItems=[]},fe=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:s=!0})=>{var r;ne.adjustments=e,ne.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(r=t.find(Boolean))||void 0===r?void 0:r.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(ne.currency=i,P.isFetchingSession=!0,await pe({adjustmentsAmount:d,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:P.partyShippingId,shouldInitSessionOnFailure:s,varianceTestInput:o.enabledVariantTestKeys||[]}),P.isFetchingSession=!1)},be=()=>{"shipping"===ne.step?(ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"payment"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"finish"===ne.step&&(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1})}))},Se=()=>{"customer-info"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!0})})):"shipping"===ne.step?(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!0})})):"payment"===ne.step&&(ne.step="finish")},Ce=()=>{ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})}),ne.selectedShippingOption=null,ne.isSelectedShippingAboveDeminimis=!1,ne.isSelectedShippingGuarantee=!1,ne.selectedShippingOptionTransitTime="",ne.dutiesTaxesFees=0,ne.dutiesTaxesFeesEstimate=0,ne.shipping=0,ne.total=ne.subtotal};export{I as A,T as B,z as C,he as D,ue as E,J as F,W as G,M as H,$ as I,ee as J,w as K,U as L,re as M,ve as N,k as O,L as a,D as b,P as c,H as d,ne as e,fe as f,de as g,Ce as h,R as i,ge as j,Z as k,V as l,ye as m,G as n,le as o,me as p,F as q,Se as r,x as s,O as t,Q as u,q as v,K as w,Y as x,_ as y,te as z}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,z as e}from"./p-7af39c98.js";import{c as n,
|
|
1
|
+
import{c as o,z as e}from"./p-7af39c98.js";import{c as n,C as d,e as t,D as i}from"./p-1d15662c.js";import{s as l}from"./p-c3c3cd98.js";import{h as a,s,l as r}from"./p-41dd1cb8.js";import{b as c}from"./p-0a377722.js";import{h as u}from"./p-b30c2ad9.js";const{state:p}=o((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}))),v=async({landedCostId:o,retries:n=5})=>{var d,i,l,r,c,u,m,C,I;p.isFetchingShippingInfo=!0;const g=await a("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:o},method:"POST"});if(g.errors.length)return n>0?(await new Promise((o=>setTimeout(o,1e3))),v({landedCostId:o,retries:n-1})):null;p.landedCostShortId=(null===(d=g.json)||void 0===d?void 0:d.landedCostShortId)||null,p.isFetchingShippingInfo=!1,p.shippingAddress=(null===(i=g.json)||void 0===i?void 0:i.shipping)||null;const h=null===(l=t.checkoutSession)||void 0===l?void 0:l.landedCost,w=null===(r=t.checkoutSession)||void 0===r?void 0:r.subtotals,L=((null===(c=null==h?void 0:h.amountSubtotals)||void 0===c?void 0:c.shipping)||0)+((null===(u=null==h?void 0:h.amountSubtotals)||void 0===u?void 0:u.items)||0);p.amountTotalPaid=L*((null===(m=null==w?void 0:w.exchangeRate)||void 0===m?void 0:m.rate)||1),p.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),p.originCompanyName=(null===(I=null===(C=g.json)||void 0===C?void 0:C.origin)||void 0===I?void 0:I.companyName)||null,0===p.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:o,organizationId:e.organizationId}})},m=async()=>{var o,e,i,u;if(!(null===(o=n.stripeBillingAddressEventData)||void 0===o?void 0:o.complete))return{partiesCreated:!1};const v=null===(i=null===(e=t.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===i?void 0:i.rootId;if(!v)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:l.checkoutSessionId}}),{partiesCreated:!1};if(!l.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:v}}),{partiesCreated:!1};const m=d({address:n.stripeBillingAddressEventData.value.address,firstName:n.stripeBillingAddressEventData.value.firstName,lastName:n.stripeBillingAddressEventData.value.lastName,name:n.stripeBillingAddressEventData.value.name,phone:n.stripeBillingAddressEventData.value.phone}),C="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:I,json:g}=await a("/api/zonos-elements/create-billing-party",{body:{billingAddress:m,checkoutSessionId:l.checkoutSessionId,companyName:n.companyName,email:(null===(u=n.stripeLinkEventData)||void 0===u?void 0:u.value.email)||"",isTest:C,rootId:v},method:"POST"});return I.length||!g?(r("Error occurs when creating billing party",JSON.stringify(I,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:l.checkoutSessionId,errors:I,json:g}}),{partiesCreated:!1}):(p.partyBillingId=g.billToPartyId,{partiesCreated:!0})},C=async o=>{const e=o.landedCost;return!!e&&(t.landedCostData=[Object.assign(Object.assign({},o),{landedCost:Object.assign({},e),landedCostId:e.id})],i({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))},I=o=>o||window.innerWidth<1024&&window.innerWidth>=768,g=o=>o||window.innerWidth<768,h=({content:o,isLoading:e,skeletonHeight:n,skeletonWidth:d})=>e?u("zonos-skeleton",{skeletonHeight:n,skeletonWidth:d}):o;export{I as a,v as b,C as c,m as d,p as e,g as i,h as r}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function i(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):i(e.value).then(r,a)}l((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(o){return l([e,o])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(t=0)),t)try{if(n=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;i=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1];s=a;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(a);break}if(s[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];i=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,i=o.length,s;n<i;n++){if(s||!(n in o)){if(!s)s=Array.prototype.slice.call(o,0,n);s[n]=o[n]}}return e.concat(s||Array.prototype.slice.call(o))};System.register(["./p-5fc34563.system.js","./p-b5b3f908.system.js","./p-182da73f.system.js","./p-89c5164b.system.js","./p-23e7c655.system.js","./p-2d6557ee.system.js","./p-bc7bf53e.system.js","./p-2b8345d8.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var o,t,n,i,s,r,a,l,d,c,h,u,f;return{setters:[function(e){o=e.r;t=e.c;n=e.h;i=e.F;s=e.H},function(e){r=e.l;a=e.d},function(e){l=e.t},function(e){d=e.z},function(e){c=e.c},function(e){h=e.f},function(e){u=e.g},function(e){f=e.e},function(){},function(){}],execute:function(){var m=function(e){var o=e.getBoundingClientRect();var t=o.top;var n=window.innerHeight-o.bottom;return t>=n};var g=function(e){var o=e.href,t=e.text;return'<zonos-link href="'.concat(o,'" target="_blank" rel="noopener noreferrer">').concat(t,"</zonos-link>")};var b='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n';var p='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.35028 11.5744C9.05738 11.2815 8.58251 11.2815 8.28962 11.5744C7.99672 11.8673 7.99672 12.3422 8.28962 12.635L11.2917 15.6372C11.6823 16.0277 12.3154 16.0277 12.7059 15.6372L15.708 12.6351C16.0009 12.3422 16.0009 11.8674 15.708 11.5745C15.4151 11.2816 14.9402 11.2816 14.6473 11.5745L12.7488 13.4729V4.68005C12.7488 4.26584 12.413 3.93005 11.9988 3.93005C11.5846 3.93005 11.2488 4.26584 11.2488 4.68005L11.2488 13.4729L9.35028 11.5744Z" fill="#4D505A"/>\n<path d="M20 14C20 13.5858 19.6642 13.25 19.25 13.25C18.8358 13.25 18.5 13.5858 18.5 14L18.5 17.25C18.5 17.9404 17.9404 18.5 17.25 18.5L6.75 18.5C6.05964 18.5 5.5 17.9404 5.5 17.25L5.5 14C5.5 13.5858 5.16421 13.25 4.75 13.25C4.33579 13.25 4 13.5858 4 14V17.25C4 18.7688 5.23122 20 6.75 20H17.25C18.7688 20 20 18.7688 20 17.25L20 14Z" fill="#4D505A"/>\n</svg>\n';var v='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.04505 6.64123C2.19006 8.49622 2.19006 11.5038 4.04505 13.3587L11.2929 20.6066C11.6834 20.9971 12.3166 20.9971 12.7071 20.6066L19.955 13.3587C21.8099 11.5038 21.8099 8.49622 19.955 6.64123L17.8336 4.51991C17.4431 4.12939 16.8099 4.12939 16.4194 4.51991L13.5241 7.41527C12.5864 6.86157 11.4136 6.86157 10.4759 7.41527L7.58059 4.51991C7.19006 4.12939 6.5569 4.12939 6.16637 4.51991L4.04505 6.64123ZM5.10571 12.2981C3.83651 11.0289 3.83651 8.9711 5.10571 7.70189L6.87348 5.93413L9.70191 8.76255C10.1056 9.16622 10.6991 9.12 11.0641 8.82749C11.6091 8.39083 12.3909 8.39082 12.9359 8.82749C13.301 9.12 13.8944 9.16622 14.2981 8.76255L17.1265 5.93413L18.8943 7.70189C20.1635 8.9711 20.1635 11.0289 18.8943 12.2981L12 19.1924L5.10571 12.2981Z"\n fill="#0F1015" />\n <path\n d="M10.0333 3.28075C9.63566 3.39679 9.40739 3.8132 9.52343 4.21083C9.63947 4.60846 10.0559 4.83673 10.4535 4.72069C11.4618 4.42644 12.5383 4.42644 13.5466 4.72069C13.9442 4.83673 14.3606 4.60846 14.4766 4.21083C14.5927 3.81321 14.3644 3.39679 13.9668 3.28075C12.6841 2.90642 11.316 2.90642 10.0333 3.28075Z"\n fill="#0F1015" />\n</svg>';var w='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var x='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n';var z='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var C=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--zonos-elements-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--zonos-elements-radius-12);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:2147483647}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:8px;top:8px;width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--zonos-elements-hover-color);border-radius:var(--zonos-elements-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:16px}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:12px}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}@media (max-height: 600px){:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{max-height:80vh}}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px) and (max-height: 600px){:host .zonos--hello-dialog{max-height:80vh}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";var y=C;var k=e("zonos_hello_dialog",function(){function e(e){var n=this;o(this,e);this.closeDialog=t(this,"closeDialog",7);this.isOpen=false;this.setIsOpen=function(){};this.restrictedItems=[];this.welcomeMessage="Welcome to our Demo App!";this.showCountrySelect=false;this.showLanguageSelect=false;this.clickOutsideDialogHandler=function(e){if(!e.composedPath().includes(n.dialogRef)&&n.isOpen){n.setIsOpen(false)}};this.getCurrentPageEnum=function(){switch(d.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}};this.setShowCountrySelect=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(o){this.showCountrySelect=e;return[2]}))}))};this.setShowLanguageSelect=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(o){this.showLanguageSelect=e;return[2]}))}))};this.hasTaxId=function(){var e;return(e=r.countryLandedCost)===null||e===void 0?void 0:e.hasTaxId};this.hasInclusivePrices=function(){var e;return((e=r.inclusivePricing)===null||e===void 0?void 0:e.status)==="ENABLED"};this.isNoThresholdCountry=function(e){if(!e||!n.hasTaxId()){return false}var o=__spreadArray(["AU","NZ","GB","NO","SG"],f,true);return o.includes(e)};this.getDutyMessage=function(){var e=r.countryLandedCost;if(!(e===null||e===void 0?void 0:e.allowLowValueOrders)&&(e===null||e===void 0?void 0:e.countryCode)==="GB"){return l("Duties will apply to all orders.")}var o=(e===null||e===void 0?void 0:e.dutyDeminimus)?a({amount:e.dutyDeminimus}):null;return o?l("Spend up to [threshold] duty free.",{threshold:o}):l("Duties will apply to all orders.")};this.getTaxMessage=function(){var e=r.countryLandedCost;if(!(e===null||e===void 0?void 0:e.allowLowValueOrders)&&(e===null||e===void 0?void 0:e.countryCode)==="GB"){return l("Taxes will apply to all orders.")}var o=(e===null||e===void 0?void 0:e.vatTaxDeminimus)?a({amount:e.vatTaxDeminimus}):null;return o&&!n.isNoThresholdCountry(e===null||e===void 0?void 0:e.countryCode)?l("Spend up to [threshold] tax free.",{threshold:o}):l("Taxes will apply to all orders.")};this.getEuDutyTaxMessage=function(e){return["".concat(l("Due to the IOSS tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/european-ioss",text:l("Learn more.")}))]};this.getUkDutyTaxMessage=function(e){if(e.allowLowValueOrders){return["".concat(l("Due to the UK tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/european-ioss",text:l("Learn more.")}))]}var o=e.dutyDeminimus;return[l("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:a({amount:o})})]};this.getAustraliaDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return[]}return["".concat(l("Due to the Australia tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:l("Learn more.")}))]};this.getNewZealandDutyTaxMessge=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the New Zealand tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/guides/country-guides/new-zealand/new-zealand-import-taxes",text:l("Learn more.")}))]};this.getNorwayDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the VOEC tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/guides/country-guides/norway-voec-scheme",text:l("Learn more.")}))]};this.getSingaporeDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the Singapore tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/singapore-gst-settings",text:l("Learn more.")}))]};this.getInclusivePriceMessage=function(){var e=r.inclusivePricing;if((e===null||e===void 0?void 0:e.status)!=="ENABLED"){return null}if(e.duty.status==="INCLUDED"&&e.tax.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"&&e.tax.status==="INCLUDED"){return l("Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions.")}if(e.tax.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"){return l("Product prices already include duties. No additional duties will be added at checkout, with rare exceptions.")}if(e.tax.status==="INCLUDED"){return l("Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions.")}if(e.fee.status==="INCLUDED"){return l("Product prices already include fees. No additional fees will be added at checkout, with rare exceptions.")}return null};this.getAdditionalDutyTaxMessage=function(){if(!r.countryLandedCost){return null}if(!n.hasTaxId()){return null}switch(r.countryLandedCost.countryCode){case"GB":return n.getUkDutyTaxMessage(r.countryLandedCost);case"AU":return n.getAustraliaDutyTaxMessage(r.countryLandedCost);case"NZ":return n.getNewZealandDutyTaxMessge(r.countryLandedCost);case"NO":return n.getNorwayDutyTaxMessage(r.countryLandedCost);case"SG":return n.getSingaporeDutyTaxMessage(r.countryLandedCost);default:if(f.includes(r.countryLandedCost.countryCode)){return n.getEuDutyTaxMessage(r.countryLandedCost)}return null}}}e.prototype.globalClickHandler=function(e){this.clickOutsideDialogHandler(e)};e.prototype.isOpenHandler=function(e){if(!e){void this.setShowCountrySelect(false);void this.setShowLanguageSelect(false)}};e.prototype.render=function(){var e=this;var o;var t=r.selectedCountryCode;var a=this.hasInclusivePrices();var f=this.getInclusivePriceMessage();var g=this.getDutyMessage();var C=this.getTaxMessage();var y=this.getAdditionalDutyTaxMessage();var k=this.animateFromLeftOverride||this.dialogRef&&u(this.dialogRef);var L=this.dialogRef&&m(this.dialogRef);var D=r.customMessages;var N=l("Welcome to [storeName]",{storeName:d.organizationName});var H=((o=D.find((function(e){return e.pageName==="hello_default"})))===null||o===void 0?void 0:o.message)||l("Know about duties and taxes before you buy. Shop with confidence!");var V=h(H);var _=this.getCurrentPageEnum();var Z=D.filter((function(e){return e.pageName===_}));return n(s,{key:"178654e9b701bb68a4d47495897445cf87806c37",class:"zonos--elements"},n("div",{key:"eb0f3ced0226513df3911e0664aff10d523fdac7",class:c(["zonos--hello-dialog",k&&"zonos--hello-dialog-animate-from-left",L&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),inert:!this.isOpen,ref:function(o){return o&&(e.dialogRef=o)}},!this.showCountrySelect&&!this.showLanguageSelect&&n("div",{key:"f185f2d707a3b9628896a7e15f2a0ad20da112ec"},n("div",{key:"80c53ad6728b221bedbfaec2ec77fee96029e12b",class:"zonos--hello-dialog-content"},n("zonos-button",{key:"31b71832bee5e4515dbf060746f022d9c91502af",class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:z}),noBackground:true,onClick:function(){return e.setIsOpen(false)}}),n("zonos-v-stack",{key:"5f11c3b0355ba0c85cf134522b6e21fd28dfe16c",spacing:24},n("zonos-country-flag",{key:"6d6dcad7e3700f67c4261995d867aacb42715404",class:"zonos--hello-country-flag",countryCode:t}),n("zonos-v-stack",{key:"7a325a9b94e58dc5f8dba5baba9a00f835466ee2",class:"zonos--hello-dialog-header",spacing:4},n("zonos-text",{key:"24e2407475b740b50ca07fe9278363fdefc27d01",type:"boldSubheader"},N),n("zonos-text",{key:"6b38dee6ec6fcf39e02c5225155e2af69c367a39",innerHTML:V,textColor:"gray-800"})),n("zonos-v-stack",{key:"567d126d05f236fa0aab764d78b1692ebfe82f8b",spacing:8},this.restrictedItems.map((function(e){var o;return e&&n("zonos-banner",{bannerTitle:e.name,intent:"error"},(o=e.itemRestrictions)===null||o===void 0?void 0:o.map((function(e){return n("zonos-text",{textColor:"red-800"},e===null||e===void 0?void 0:e.note)})))})),n("zonos-card",{key:"e96943bc58d47531f748217858939ddf2a586441",spacing:"12px"},n("zonos-v-stack",{key:"3e1850a86542ad66c224e4b81f1c5442e7716f6d",spacing:12},a?n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Duty de minimis",content:v}),n("zonos-text",null,f)):n(i,null,g&&n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Duty de minimis icon",content:p}),n("zonos-text",{"aria-label":"Duty de minimis message"},g)),C&&n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Tax de minimis icon",content:x}),n("zonos-text",{"aria-label":"Tax de minimis message"},C))),y===null||y===void 0?void 0:y.map((function(e){return n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Additional information for buying goods from selected country icon",content:b}),n("zonos-text",{"aria-label":"Additional information for buying goods from selected country message",innerHTML:e}))})))),Z.map((function(e){return n("zonos-custom-message",{icon:w,message:e.message})}))))),n("zonos-hello-dialog-footer",{key:"33e41b69e4a5b00623f3e412609e7162cb560c38",appearanceSettings:this.appearanceSettings,setShowCountrySelect:function(o){return e.setShowCountrySelect(o)},setShowLanguageSelect:function(o){return e.setShowLanguageSelect(o)}})),this.showCountrySelect&&n("div",{key:"fa17c20b3d893ed9f2249bbceca5237fa48bc64e"},n("zonos-country-select",{key:"15a5924f176c4a805405684c3eda90f47979cf0b",handleOnClose:function(){return e.setShowCountrySelect(false)}})),this.showLanguageSelect&&n("div",{key:"ab1d061a3c9c68b43c4203fa14af2ffcf7d33e82"},n("zonos-language-select",{key:"97f4c760e65d7af39160a1ff978d8a7b0864a763",handleOnClose:function(){return e.setShowLanguageSelect(false)}}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{isOpen:["isOpenHandler"]}},enumerable:false,configurable:true});return e}());k.style=y}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,n){function i(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):i(e.value).then(r,a)}l((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(o){return l([e,o])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(t=0)),t)try{if(n=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;i=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1];s=a;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(a);break}if(s[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];i=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,i=o.length,s;n<i;n++){if(s||!(n in o)){if(!s)s=Array.prototype.slice.call(o,0,n);s[n]=o[n]}}return e.concat(s||Array.prototype.slice.call(o))};System.register(["./p-5fc34563.system.js","./p-cef1e888.system.js","./p-b4fe3604.system.js","./p-89c5164b.system.js","./p-23e7c655.system.js","./p-2d6557ee.system.js","./p-bc7bf53e.system.js","./p-2b8345d8.system.js","./p-01174496.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var o,t,n,i,s,r,a,l,d,c,h,u,f;return{setters:[function(e){o=e.r;t=e.c;n=e.h;i=e.F;s=e.H},function(e){r=e.l;a=e.d},function(e){l=e.t},function(e){d=e.z},function(e){c=e.c},function(e){h=e.f},function(e){u=e.g},function(e){f=e.e},function(){},function(){}],execute:function(){var m=function(e){var o=e.getBoundingClientRect();var t=o.top;var n=window.innerHeight-o.bottom;return t>=n};var g=function(e){var o=e.href,t=e.text;return'<zonos-link href="'.concat(o,'" target="_blank" rel="noopener noreferrer">').concat(t,"</zonos-link>")};var b='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n';var p='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.35028 11.5744C9.05738 11.2815 8.58251 11.2815 8.28962 11.5744C7.99672 11.8673 7.99672 12.3422 8.28962 12.635L11.2917 15.6372C11.6823 16.0277 12.3154 16.0277 12.7059 15.6372L15.708 12.6351C16.0009 12.3422 16.0009 11.8674 15.708 11.5745C15.4151 11.2816 14.9402 11.2816 14.6473 11.5745L12.7488 13.4729V4.68005C12.7488 4.26584 12.413 3.93005 11.9988 3.93005C11.5846 3.93005 11.2488 4.26584 11.2488 4.68005L11.2488 13.4729L9.35028 11.5744Z" fill="#4D505A"/>\n<path d="M20 14C20 13.5858 19.6642 13.25 19.25 13.25C18.8358 13.25 18.5 13.5858 18.5 14L18.5 17.25C18.5 17.9404 17.9404 18.5 17.25 18.5L6.75 18.5C6.05964 18.5 5.5 17.9404 5.5 17.25L5.5 14C5.5 13.5858 5.16421 13.25 4.75 13.25C4.33579 13.25 4 13.5858 4 14V17.25C4 18.7688 5.23122 20 6.75 20H17.25C18.7688 20 20 18.7688 20 17.25L20 14Z" fill="#4D505A"/>\n</svg>\n';var v='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.04505 6.64123C2.19006 8.49622 2.19006 11.5038 4.04505 13.3587L11.2929 20.6066C11.6834 20.9971 12.3166 20.9971 12.7071 20.6066L19.955 13.3587C21.8099 11.5038 21.8099 8.49622 19.955 6.64123L17.8336 4.51991C17.4431 4.12939 16.8099 4.12939 16.4194 4.51991L13.5241 7.41527C12.5864 6.86157 11.4136 6.86157 10.4759 7.41527L7.58059 4.51991C7.19006 4.12939 6.5569 4.12939 6.16637 4.51991L4.04505 6.64123ZM5.10571 12.2981C3.83651 11.0289 3.83651 8.9711 5.10571 7.70189L6.87348 5.93413L9.70191 8.76255C10.1056 9.16622 10.6991 9.12 11.0641 8.82749C11.6091 8.39083 12.3909 8.39082 12.9359 8.82749C13.301 9.12 13.8944 9.16622 14.2981 8.76255L17.1265 5.93413L18.8943 7.70189C20.1635 8.9711 20.1635 11.0289 18.8943 12.2981L12 19.1924L5.10571 12.2981Z"\n fill="#0F1015" />\n <path\n d="M10.0333 3.28075C9.63566 3.39679 9.40739 3.8132 9.52343 4.21083C9.63947 4.60846 10.0559 4.83673 10.4535 4.72069C11.4618 4.42644 12.5383 4.42644 13.5466 4.72069C13.9442 4.83673 14.3606 4.60846 14.4766 4.21083C14.5927 3.81321 14.3644 3.39679 13.9668 3.28075C12.6841 2.90642 11.316 2.90642 10.0333 3.28075Z"\n fill="#0F1015" />\n</svg>';var w='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var x='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n';var z='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var C=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--zonos-elements-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--zonos-elements-radius-12);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:2147483647}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:8px;top:8px;width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--zonos-elements-hover-color);border-radius:var(--zonos-elements-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:16px}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:12px}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}@media (max-height: 600px){:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{max-height:80vh}}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px) and (max-height: 600px){:host .zonos--hello-dialog{max-height:80vh}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";var y=C;var k=e("zonos_hello_dialog",function(){function e(e){var n=this;o(this,e);this.closeDialog=t(this,"closeDialog",7);this.isOpen=false;this.setIsOpen=function(){};this.restrictedItems=[];this.welcomeMessage="Welcome to our Demo App!";this.showCountrySelect=false;this.showLanguageSelect=false;this.clickOutsideDialogHandler=function(e){if(!e.composedPath().includes(n.dialogRef)&&n.isOpen){n.setIsOpen(false)}};this.getCurrentPageEnum=function(){switch(d.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}};this.setShowCountrySelect=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(o){this.showCountrySelect=e;return[2]}))}))};this.setShowLanguageSelect=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(o){this.showLanguageSelect=e;return[2]}))}))};this.hasTaxId=function(){var e;return(e=r.countryLandedCost)===null||e===void 0?void 0:e.hasTaxId};this.hasInclusivePrices=function(){var e;return((e=r.inclusivePricing)===null||e===void 0?void 0:e.status)==="ENABLED"};this.isNoThresholdCountry=function(e){if(!e||!n.hasTaxId()){return false}var o=__spreadArray(["AU","NZ","GB","NO","SG"],f,true);return o.includes(e)};this.getDutyMessage=function(){var e=r.countryLandedCost;if(!(e===null||e===void 0?void 0:e.allowLowValueOrders)&&(e===null||e===void 0?void 0:e.countryCode)==="GB"){return l("Duties will apply to all orders.")}var o=(e===null||e===void 0?void 0:e.dutyDeminimus)?a({amount:e.dutyDeminimus}):null;return o?l("Spend up to [threshold] duty free.",{threshold:o}):l("Duties will apply to all orders.")};this.getTaxMessage=function(){var e=r.countryLandedCost;if(!(e===null||e===void 0?void 0:e.allowLowValueOrders)&&(e===null||e===void 0?void 0:e.countryCode)==="GB"){return l("Taxes will apply to all orders.")}var o=(e===null||e===void 0?void 0:e.vatTaxDeminimus)?a({amount:e.vatTaxDeminimus}):null;return o&&!n.isNoThresholdCountry(e===null||e===void 0?void 0:e.countryCode)?l("Spend up to [threshold] tax free.",{threshold:o}):l("Taxes will apply to all orders.")};this.getEuDutyTaxMessage=function(e){return["".concat(l("Due to the IOSS tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/european-ioss",text:l("Learn more.")}))]};this.getUkDutyTaxMessage=function(e){if(e.allowLowValueOrders){return["".concat(l("Due to the UK tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/european-ioss",text:l("Learn more.")}))]}var o=e.dutyDeminimus;return[l("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:a({amount:o})})]};this.getAustraliaDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return[]}return["".concat(l("Due to the Australia tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:l("Learn more.")}))]};this.getNewZealandDutyTaxMessge=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the New Zealand tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/guides/country-guides/new-zealand/new-zealand-import-taxes",text:l("Learn more.")}))]};this.getNorwayDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the VOEC tax law, all orders will be assessed at [percentage] VAT regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/guides/country-guides/norway-voec-scheme",text:l("Learn more.")}))]};this.getSingaporeDutyTaxMessage=function(e){if(n.hasInclusivePrices()){return null}return["".concat(l("Due to the Singapore tax law, all orders will be assessed at [percentage] GST regardless of order total.",{percentage:"".concat(e.vatTaxRate*100,"%")})," ").concat(g({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/singapore-gst-settings",text:l("Learn more.")}))]};this.getInclusivePriceMessage=function(){var e=r.inclusivePricing;if((e===null||e===void 0?void 0:e.status)!=="ENABLED"){return null}if(e.duty.status==="INCLUDED"&&e.tax.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"&&e.tax.status==="INCLUDED"){return l("Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions.")}if(e.tax.status==="INCLUDED"&&e.fee.status==="INCLUDED"){return l("Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions.")}if(e.duty.status==="INCLUDED"){return l("Product prices already include duties. No additional duties will be added at checkout, with rare exceptions.")}if(e.tax.status==="INCLUDED"){return l("Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions.")}if(e.fee.status==="INCLUDED"){return l("Product prices already include fees. No additional fees will be added at checkout, with rare exceptions.")}return null};this.getAdditionalDutyTaxMessage=function(){if(!r.countryLandedCost){return null}if(!n.hasTaxId()){return null}switch(r.countryLandedCost.countryCode){case"GB":return n.getUkDutyTaxMessage(r.countryLandedCost);case"AU":return n.getAustraliaDutyTaxMessage(r.countryLandedCost);case"NZ":return n.getNewZealandDutyTaxMessge(r.countryLandedCost);case"NO":return n.getNorwayDutyTaxMessage(r.countryLandedCost);case"SG":return n.getSingaporeDutyTaxMessage(r.countryLandedCost);default:if(f.includes(r.countryLandedCost.countryCode)){return n.getEuDutyTaxMessage(r.countryLandedCost)}return null}}}e.prototype.globalClickHandler=function(e){this.clickOutsideDialogHandler(e)};e.prototype.isOpenHandler=function(e){if(!e){void this.setShowCountrySelect(false);void this.setShowLanguageSelect(false)}};e.prototype.render=function(){var e=this;var o;var t=r.selectedCountryCode;var a=this.hasInclusivePrices();var f=this.getInclusivePriceMessage();var g=this.getDutyMessage();var C=this.getTaxMessage();var y=this.getAdditionalDutyTaxMessage();var k=this.animateFromLeftOverride||this.dialogRef&&u(this.dialogRef);var L=this.dialogRef&&m(this.dialogRef);var D=r.customMessages;var N=l("Welcome to [storeName]",{storeName:d.organizationName});var H=((o=D.find((function(e){return e.pageName==="hello_default"})))===null||o===void 0?void 0:o.message)||l("Know about duties and taxes before you buy. Shop with confidence!");var V=h(H);var _=this.getCurrentPageEnum();var Z=D.filter((function(e){return e.pageName===_}));return n(s,{key:"178654e9b701bb68a4d47495897445cf87806c37",class:"zonos--elements"},n("div",{key:"eb0f3ced0226513df3911e0664aff10d523fdac7",class:c(["zonos--hello-dialog",k&&"zonos--hello-dialog-animate-from-left",L&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),inert:!this.isOpen,ref:function(o){return o&&(e.dialogRef=o)}},!this.showCountrySelect&&!this.showLanguageSelect&&n("div",{key:"f185f2d707a3b9628896a7e15f2a0ad20da112ec"},n("div",{key:"80c53ad6728b221bedbfaec2ec77fee96029e12b",class:"zonos--hello-dialog-content"},n("zonos-button",{key:"31b71832bee5e4515dbf060746f022d9c91502af",class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:z}),noBackground:true,onClick:function(){return e.setIsOpen(false)}}),n("zonos-v-stack",{key:"5f11c3b0355ba0c85cf134522b6e21fd28dfe16c",spacing:24},n("zonos-country-flag",{key:"6d6dcad7e3700f67c4261995d867aacb42715404",class:"zonos--hello-country-flag",countryCode:t}),n("zonos-v-stack",{key:"7a325a9b94e58dc5f8dba5baba9a00f835466ee2",class:"zonos--hello-dialog-header",spacing:4},n("zonos-text",{key:"24e2407475b740b50ca07fe9278363fdefc27d01",type:"boldSubheader"},N),n("zonos-text",{key:"6b38dee6ec6fcf39e02c5225155e2af69c367a39",innerHTML:V,textColor:"gray-800"})),n("zonos-v-stack",{key:"567d126d05f236fa0aab764d78b1692ebfe82f8b",spacing:8},this.restrictedItems.map((function(e){var o;return e&&n("zonos-banner",{bannerTitle:e.name,intent:"error"},(o=e.itemRestrictions)===null||o===void 0?void 0:o.map((function(e){return n("zonos-text",{textColor:"red-800"},e===null||e===void 0?void 0:e.note)})))})),n("zonos-card",{key:"e96943bc58d47531f748217858939ddf2a586441",spacing:"12px"},n("zonos-v-stack",{key:"3e1850a86542ad66c224e4b81f1c5442e7716f6d",spacing:12},a?n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Duty de minimis",content:v}),n("zonos-text",null,f)):n(i,null,g&&n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Duty de minimis icon",content:p}),n("zonos-text",{"aria-label":"Duty de minimis message"},g)),C&&n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Tax de minimis icon",content:x}),n("zonos-text",{"aria-label":"Tax de minimis message"},C))),y===null||y===void 0?void 0:y.map((function(e){return n("div",{class:"zonos--flex-message"},n("zonos-icon",{"aria-label":"Additional information for buying goods from selected country icon",content:b}),n("zonos-text",{"aria-label":"Additional information for buying goods from selected country message",innerHTML:e}))})))),Z.map((function(e){return n("zonos-custom-message",{icon:w,message:e.message})}))))),n("zonos-hello-dialog-footer",{key:"33e41b69e4a5b00623f3e412609e7162cb560c38",appearanceSettings:this.appearanceSettings,setShowCountrySelect:function(o){return e.setShowCountrySelect(o)},setShowLanguageSelect:function(o){return e.setShowLanguageSelect(o)}})),this.showCountrySelect&&n("div",{key:"fa17c20b3d893ed9f2249bbceca5237fa48bc64e"},n("zonos-country-select",{key:"15a5924f176c4a805405684c3eda90f47979cf0b",handleOnClose:function(){return e.setShowCountrySelect(false)}})),this.showLanguageSelect&&n("div",{key:"ab1d061a3c9c68b43c4203fa14af2ffcf7d33e82"},n("zonos-language-select",{key:"97f4c760e65d7af39160a1ff978d8a7b0864a763",handleOnClose:function(){return e.setShowLanguageSelect(false)}}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{isOpen:["isOpenHandler"]}},enumerable:false,configurable:true});return e}());k.style=y}}}));
|