@zonos/elements 1.3.195 → 1.3.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/cjs/{cart-bc882927.js → cart-2e3968e9.js} +7 -2
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/{paypal-608fa681.js → paypal-b5c80f16.js} +1 -1
  4. package/dist/cjs/zonos-address_11.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +9 -44
  7. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +7 -42
  15. package/dist/collection/components/store/checkout/stripe.js +7 -2
  16. package/dist/esm/{cart-2f0ee51d.js → cart-006b6633.js} +7 -2
  17. package/dist/esm/index.js +7 -7
  18. package/dist/esm/{paypal-3ecdf234.js → paypal-86483f34.js} +1 -1
  19. package/dist/esm/zonos-address_11.entry.js +1 -1
  20. package/dist/esm/zonos-cart-items_13.entry.js +2 -2
  21. package/dist/esm/zonos-checkout.entry.js +9 -44
  22. package/dist/esm/zonos-controller.entry.js +1 -1
  23. package/dist/esm/zonos-country-flag.entry.js +1 -1
  24. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  25. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  26. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  27. package/dist/esm/zonos-hello.entry.js +1 -1
  28. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  29. package/dist/esm-es5/{cart-2f0ee51d.js → cart-006b6633.js} +1 -1
  30. package/dist/esm-es5/index.js +1 -1
  31. package/dist/esm-es5/{paypal-3ecdf234.js → paypal-86483f34.js} +1 -1
  32. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  33. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  34. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  35. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  36. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  37. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  38. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  39. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  40. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  41. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  42. package/dist/scripts/index.js +1 -1
  43. package/dist/scripts/loadZonos.js +1 -1
  44. package/dist/scripts/zonos.js +1 -1
  45. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -4
  46. package/dist/types/types/generated/graphql.internal.types.d.ts +8 -0
  47. package/dist/types/types/generated/graphql.internal.types.ts +8 -0
  48. package/dist/zonos-elements/index.esm.js +1 -1
  49. package/dist/zonos-elements/{p-39e369f6.system.entry.js → p-06547c8c.system.entry.js} +1 -1
  50. package/dist/zonos-elements/{p-3e15061e.system.entry.js → p-0d5fe109.system.entry.js} +1 -1
  51. package/dist/zonos-elements/{p-4931d780.entry.js → p-1383ab6b.entry.js} +1 -1
  52. package/dist/zonos-elements/{p-127deab4.system.entry.js → p-2abcaaa1.system.entry.js} +1 -1
  53. package/dist/zonos-elements/{p-de73fec0.system.js → p-3bcf2091.system.js} +1 -1
  54. package/dist/zonos-elements/p-3febb54a.entry.js +1 -0
  55. package/dist/zonos-elements/{p-5d7c9ac3.entry.js → p-4e11db81.entry.js} +1 -1
  56. package/dist/zonos-elements/{p-2f34e29a.js → p-63bfe67c.js} +1 -1
  57. package/dist/zonos-elements/{p-0fe6efef.system.entry.js → p-76468d91.system.entry.js} +1 -1
  58. package/dist/zonos-elements/{p-649d3e92.entry.js → p-7b1e8a42.entry.js} +1 -1
  59. package/dist/zonos-elements/{p-9e27aaff.system.entry.js → p-81bf423c.system.entry.js} +1 -1
  60. package/dist/zonos-elements/{p-e275d241.entry.js → p-8558486d.entry.js} +1 -1
  61. package/dist/zonos-elements/{p-76d8844b.entry.js → p-8caac4e2.entry.js} +1 -1
  62. package/dist/zonos-elements/{p-dc1b3bcb.entry.js → p-9350f23a.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-34b5ae9c.system.js → p-98753f6e.system.js} +1 -1
  64. package/dist/zonos-elements/{p-8df9a41b.entry.js → p-a35aab84.entry.js} +1 -1
  65. package/dist/zonos-elements/{p-c7f0941d.system.entry.js → p-b1970c2c.system.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-f8253ae4.system.entry.js → p-bde07ab8.system.entry.js} +1 -1
  67. package/dist/zonos-elements/{p-6ccb1b13.entry.js → p-c1173557.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-6a31eb14.system.js → p-c69c3219.system.js} +1 -1
  69. package/dist/zonos-elements/{p-4abc1b34.system.entry.js → p-d319e084.system.entry.js} +1 -1
  70. package/dist/zonos-elements/{p-23752a7e.entry.js → p-ddbeb2ec.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-fccf8c66.system.entry.js → p-e5d4705e.system.entry.js} +1 -1
  72. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
  73. package/dist/zonos-elements/{p-264e7688.js → p-f57b0170.js} +1 -1
  74. package/dist/zonos-elements/{p-139566b2.system.entry.js → p-fb75b13f.system.entry.js} +1 -1
  75. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  76. package/package.json +1 -1
  77. package/dist/zonos-elements/p-6b2358f2.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as o,c as e,h as t,F as s,H as i}from"./p-c137dc82.js";import{r as n,l as a,E as l}from"./p-2f34e29a.js";import{z as r}from"./p-337fab4e.js";import{c as d}from"./p-b4b7f705.js";import{f as h}from"./p-a87561b8.js";import{g as c}from"./p-5883217a.js";import"./p-0fc02cde.js";import"./p-4593324c.js";import"./p-b8d87932.js";const f=`${n("The low-value GST law passed July 1st, 2018 applies to this retailer.")} ${(({href:o,text:e})=>`<zonos-link href="${o}" target="_blank" rel="noopener noreferrer">${e}</zonos-link>`)({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:n("Learn more.")})}`,m=class{constructor(t){o(this,t),this.closeDialog=e(this,"closeDialog",7),this.clickOutsideDialogHandler=o=>{!o.composedPath().includes(this.dialogRef)&&this.isOpen&&this.setIsOpen(!1)},this.getCurrentPageEnum=()=>{switch(r.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=async o=>{this.showCountrySelect=o},this.setShowLanguageSelect=async o=>{this.showLanguageSelect=o},this.hasTaxId=()=>{var o;return null===(o=a.countryLandedCost)||void 0===o?void 0:o.hasTaxId},this.hasInclusivePrices=()=>{var o;return"ENABLED"===(null===(o=a.inclusivePricing)||void 0===o?void 0:o.status)},this.isNoThresholdCountry=o=>!(!o||!this.hasTaxId())&&["AU"].includes(o),this.getDutyMessage=()=>{const{countryLandedCost:o}=a,e=(null==o?void 0:o.dutyDeminimus)?l({amount:o.dutyDeminimus}):null;return e&&!this.isNoThresholdCountry(null==o?void 0:o.countryCode)?n("Spend [threshold] duty free.",{threshold:e}):n("Duties will apply to all orders.")},this.getTaxMessage=()=>{const{countryLandedCost:o}=a,e=(null==o?void 0:o.vatTaxDeminimus)?l({amount:o.vatTaxDeminimus}):null;return e&&!this.isNoThresholdCountry(null==o?void 0:o.countryCode)?n("Spend [threshold] tax free.",{threshold:e}):n("Taxes will apply to all orders.")},this.getUkDutyTaxMessage=o=>o.allowLowValueOrders?null:[n("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:l({amount:o.dutyDeminimus})})],this.getAustraliaDutyTaxMessage=o=>this.hasInclusivePrices()?[f]:[n("Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.",{percentage:100*o.vatTaxRate+"%"}),f],this.getNewZealandDutyTaxMessge=o=>this.hasInclusivePrices()?null:[n("[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.",{percentage:100*o.vatTaxRate+"%",threshold:l({amount:o.vatTaxDeminimus})})],this.getInclusivePriceMessage=()=>{const o=a.inclusivePricing;return"ENABLED"!==(null==o?void 0:o.status)?null:"INCLUDED"===o.duty.status&&"INCLUDED"===o.tax.status&&"INCLUDED"===o.fee.status?n("Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status&&"INCLUDED"===o.tax.status?n("Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status&&"INCLUDED"===o.fee.status?n("Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.tax.status&&"INCLUDED"===o.fee.status?n("Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status?n("Product prices already include duties. No additional duties will be added at checkout, with rare exceptions."):"INCLUDED"===o.tax.status?n("Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions."):"INCLUDED"===o.fee.status?n("Product prices already include fees. No additional fees will be added at checkout, with rare exceptions."):null},this.getAdditionalDutyTaxMessage=()=>{if(!a.countryLandedCost)return null;if(!this.hasTaxId())return null;switch(a.countryLandedCost.countryCode){case"GB":return this.getUkDutyTaxMessage(a.countryLandedCost);case"AU":return this.getAustraliaDutyTaxMessage(a.countryLandedCost);case"NZ":return this.getNewZealandDutyTaxMessge(a.countryLandedCost);default:return null}},this.isOpen=!1,this.setIsOpen=()=>{},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettings=void 0,this.restrictedItems=[],this.welcomeMessage="Welcome to our Demo App!",this.showCountrySelect=!1,this.showLanguageSelect=!1}globalClickHandler(o){this.clickOutsideDialogHandler(o)}isOpenHandler(o){o||(this.setShowCountrySelect(!1),this.setShowLanguageSelect(!1))}render(){var o;const{selectedCountryCode:e}=a,l=this.hasInclusivePrices(),f=this.getInclusivePriceMessage(),m=this.getDutyMessage(),g=this.getTaxMessage(),u=this.getAdditionalDutyTaxMessage(),b=this.animateFromLeftOverride||this.dialogRef&&c(this.dialogRef),p=this.dialogRef&&(()=>{const o=this.dialogRef.getBoundingClientRect();return o.top>=window.innerHeight-o.bottom})(),{customMessages:w}=a,x=n("Welcome to [storeName]",{storeName:r.organizationName}),C=(null===(o=w.find((o=>"hello_default"===o.pageName)))||void 0===o?void 0:o.message)||n("Know about duties and taxes before you buy. Shop with confidence!"),z=h(C),v=this.getCurrentPageEnum(),y=w.filter((o=>o.pageName===v));return t(i,{key:"0345651f8cf8b06b95b21e5ad2cc427339932229",class:"zonos--elements"},t("div",{key:"4089308c6460f903130eb4d99b03a7e65937973d",class:d(["zonos--hello-dialog",b&&"zonos--hello-dialog-animate-from-left",p&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),inert:!this.isOpen,ref:o=>o&&(this.dialogRef=o)},!this.showCountrySelect&&!this.showLanguageSelect&&t("div",{key:"8f5dcc0f0bbd4e3f103105baab5b3d87636930f3"},t("div",{key:"04b20f5394ddf48861ee97cde4d13000c5765348",class:"zonos--hello-dialog-content"},t("zonos-button",{key:"176b0173785632b211affb603380f7fef9fa0027",class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:'<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>'}),noBackground:!0,onClick:()=>this.setIsOpen(!1)}),t("zonos-v-stack",{key:"b21f5ab0438f8f5ab922800047bae222d6738e0e",spacing:24},t("zonos-country-flag",{key:"d153054f02852e8c565997a118f2bea8e5834bc0",class:"zonos--hello-country-flag",countryCode:e}),t("zonos-v-stack",{key:"b6f6f630f44ed19eca3ee62baaca9b22867635d5",class:"zonos--hello-dialog-header",spacing:4},t("zonos-text",{key:"47b5d0a2dd74f39337b4d5a5a968a94ead40a45e",type:"boldSubheader"},x),t("zonos-text",{key:"9038333f6574e110b6f860ffa0e3b6ebdad81dc0",innerHTML:z,textColor:"gray-800"})),t("zonos-v-stack",{key:"8afaf9eb87813ace65475467d422f150b487fe30",spacing:8},this.restrictedItems.map((o=>{var e;return o&&t("zonos-banner",{bannerTitle:o.name,intent:"error"},null===(e=o.itemRestrictions)||void 0===e?void 0:e.map((o=>t("zonos-text",{textColor:"red-800"},null==o?void 0:o.note))))})),t("zonos-card",{key:"522ba22b8709a962fd7c39ae4e1386b2a696072c",spacing:"12px"},t("zonos-v-stack",{key:"86fa97265982e6ca5bf9aa078b845c99056d55bf",spacing:12},l?t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Duty de minimis",content:'<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>'}),t("zonos-text",null,f)):t(s,null,t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Duty de minimis",content:'<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'}),t("zonos-text",null,m)),t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Tax de minimis",content:'<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'}),t("zonos-text",null,g))),null==u?void 0:u.map((o=>t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Additional information for buying goods from selected country",content:'<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'}),t("zonos-text",{innerHTML:o})))))),y.map((o=>t("zonos-custom-message",{icon:'<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',message:o.message})))))),t("zonos-hello-dialog-footer",{key:"7421346614aed925f25e3571cbe935045e392615",appearanceSettings:this.appearanceSettings,setShowCountrySelect:o=>this.setShowCountrySelect(o),setShowLanguageSelect:o=>this.setShowLanguageSelect(o)})),this.showCountrySelect&&t("div",{key:"35560fe611d0424186e79aa1ff56f15c89d122b6"},t("zonos-country-select",{key:"c437335dcbcfcf74dab7baeddf663cc216f0b377",handleOnClose:()=>this.setShowCountrySelect(!1)})),this.showLanguageSelect&&t("div",{key:"4692f2be013dc35e821cf1ee9c20d05cf0de9d8e"},t("zonos-language-select",{key:"19337a5bb390beb9f7629e577f296f2c9f806c98",handleOnClose:()=>this.setShowLanguageSelect(!1)}))))}static get assetsDirs(){return["assets"]}static get watchers(){return{isOpen:["isOpenHandler"]}}};m.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--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:1001}: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}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";export{m as zonos_hello_dialog}
1
+ import{r as o,c as e,h as t,F as s,H as i}from"./p-c137dc82.js";import{r as n,l as a,E as l}from"./p-63bfe67c.js";import{z as r}from"./p-337fab4e.js";import{c as d}from"./p-b4b7f705.js";import{f as h}from"./p-a87561b8.js";import{g as c}from"./p-5883217a.js";import"./p-0fc02cde.js";import"./p-4593324c.js";import"./p-b8d87932.js";const f=`${n("The low-value GST law passed July 1st, 2018 applies to this retailer.")} ${(({href:o,text:e})=>`<zonos-link href="${o}" target="_blank" rel="noopener noreferrer">${e}</zonos-link>`)({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:n("Learn more.")})}`,m=class{constructor(t){o(this,t),this.closeDialog=e(this,"closeDialog",7),this.clickOutsideDialogHandler=o=>{!o.composedPath().includes(this.dialogRef)&&this.isOpen&&this.setIsOpen(!1)},this.getCurrentPageEnum=()=>{switch(r.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=async o=>{this.showCountrySelect=o},this.setShowLanguageSelect=async o=>{this.showLanguageSelect=o},this.hasTaxId=()=>{var o;return null===(o=a.countryLandedCost)||void 0===o?void 0:o.hasTaxId},this.hasInclusivePrices=()=>{var o;return"ENABLED"===(null===(o=a.inclusivePricing)||void 0===o?void 0:o.status)},this.isNoThresholdCountry=o=>!(!o||!this.hasTaxId())&&["AU"].includes(o),this.getDutyMessage=()=>{const{countryLandedCost:o}=a,e=(null==o?void 0:o.dutyDeminimus)?l({amount:o.dutyDeminimus}):null;return e&&!this.isNoThresholdCountry(null==o?void 0:o.countryCode)?n("Spend [threshold] duty free.",{threshold:e}):n("Duties will apply to all orders.")},this.getTaxMessage=()=>{const{countryLandedCost:o}=a,e=(null==o?void 0:o.vatTaxDeminimus)?l({amount:o.vatTaxDeminimus}):null;return e&&!this.isNoThresholdCountry(null==o?void 0:o.countryCode)?n("Spend [threshold] tax free.",{threshold:e}):n("Taxes will apply to all orders.")},this.getUkDutyTaxMessage=o=>o.allowLowValueOrders?null:[n("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:l({amount:o.dutyDeminimus})})],this.getAustraliaDutyTaxMessage=o=>this.hasInclusivePrices()?[f]:[n("Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.",{percentage:100*o.vatTaxRate+"%"}),f],this.getNewZealandDutyTaxMessge=o=>this.hasInclusivePrices()?null:[n("[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.",{percentage:100*o.vatTaxRate+"%",threshold:l({amount:o.vatTaxDeminimus})})],this.getInclusivePriceMessage=()=>{const o=a.inclusivePricing;return"ENABLED"!==(null==o?void 0:o.status)?null:"INCLUDED"===o.duty.status&&"INCLUDED"===o.tax.status&&"INCLUDED"===o.fee.status?n("Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status&&"INCLUDED"===o.tax.status?n("Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status&&"INCLUDED"===o.fee.status?n("Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.tax.status&&"INCLUDED"===o.fee.status?n("Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions."):"INCLUDED"===o.duty.status?n("Product prices already include duties. No additional duties will be added at checkout, with rare exceptions."):"INCLUDED"===o.tax.status?n("Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions."):"INCLUDED"===o.fee.status?n("Product prices already include fees. No additional fees will be added at checkout, with rare exceptions."):null},this.getAdditionalDutyTaxMessage=()=>{if(!a.countryLandedCost)return null;if(!this.hasTaxId())return null;switch(a.countryLandedCost.countryCode){case"GB":return this.getUkDutyTaxMessage(a.countryLandedCost);case"AU":return this.getAustraliaDutyTaxMessage(a.countryLandedCost);case"NZ":return this.getNewZealandDutyTaxMessge(a.countryLandedCost);default:return null}},this.isOpen=!1,this.setIsOpen=()=>{},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettings=void 0,this.restrictedItems=[],this.welcomeMessage="Welcome to our Demo App!",this.showCountrySelect=!1,this.showLanguageSelect=!1}globalClickHandler(o){this.clickOutsideDialogHandler(o)}isOpenHandler(o){o||(this.setShowCountrySelect(!1),this.setShowLanguageSelect(!1))}render(){var o;const{selectedCountryCode:e}=a,l=this.hasInclusivePrices(),f=this.getInclusivePriceMessage(),m=this.getDutyMessage(),g=this.getTaxMessage(),u=this.getAdditionalDutyTaxMessage(),b=this.animateFromLeftOverride||this.dialogRef&&c(this.dialogRef),p=this.dialogRef&&(()=>{const o=this.dialogRef.getBoundingClientRect();return o.top>=window.innerHeight-o.bottom})(),{customMessages:w}=a,x=n("Welcome to [storeName]",{storeName:r.organizationName}),C=(null===(o=w.find((o=>"hello_default"===o.pageName)))||void 0===o?void 0:o.message)||n("Know about duties and taxes before you buy. Shop with confidence!"),z=h(C),v=this.getCurrentPageEnum(),y=w.filter((o=>o.pageName===v));return t(i,{key:"0345651f8cf8b06b95b21e5ad2cc427339932229",class:"zonos--elements"},t("div",{key:"4089308c6460f903130eb4d99b03a7e65937973d",class:d(["zonos--hello-dialog",b&&"zonos--hello-dialog-animate-from-left",p&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),inert:!this.isOpen,ref:o=>o&&(this.dialogRef=o)},!this.showCountrySelect&&!this.showLanguageSelect&&t("div",{key:"8f5dcc0f0bbd4e3f103105baab5b3d87636930f3"},t("div",{key:"04b20f5394ddf48861ee97cde4d13000c5765348",class:"zonos--hello-dialog-content"},t("zonos-button",{key:"176b0173785632b211affb603380f7fef9fa0027",class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:'<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>'}),noBackground:!0,onClick:()=>this.setIsOpen(!1)}),t("zonos-v-stack",{key:"b21f5ab0438f8f5ab922800047bae222d6738e0e",spacing:24},t("zonos-country-flag",{key:"d153054f02852e8c565997a118f2bea8e5834bc0",class:"zonos--hello-country-flag",countryCode:e}),t("zonos-v-stack",{key:"b6f6f630f44ed19eca3ee62baaca9b22867635d5",class:"zonos--hello-dialog-header",spacing:4},t("zonos-text",{key:"47b5d0a2dd74f39337b4d5a5a968a94ead40a45e",type:"boldSubheader"},x),t("zonos-text",{key:"9038333f6574e110b6f860ffa0e3b6ebdad81dc0",innerHTML:z,textColor:"gray-800"})),t("zonos-v-stack",{key:"8afaf9eb87813ace65475467d422f150b487fe30",spacing:8},this.restrictedItems.map((o=>{var e;return o&&t("zonos-banner",{bannerTitle:o.name,intent:"error"},null===(e=o.itemRestrictions)||void 0===e?void 0:e.map((o=>t("zonos-text",{textColor:"red-800"},null==o?void 0:o.note))))})),t("zonos-card",{key:"522ba22b8709a962fd7c39ae4e1386b2a696072c",spacing:"12px"},t("zonos-v-stack",{key:"86fa97265982e6ca5bf9aa078b845c99056d55bf",spacing:12},l?t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Duty de minimis",content:'<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>'}),t("zonos-text",null,f)):t(s,null,t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Duty de minimis",content:'<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'}),t("zonos-text",null,m)),t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Tax de minimis",content:'<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'}),t("zonos-text",null,g))),null==u?void 0:u.map((o=>t("div",{class:"zonos--flex-message"},t("zonos-icon",{"aria-label":"Additional information for buying goods from selected country",content:'<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'}),t("zonos-text",{innerHTML:o})))))),y.map((o=>t("zonos-custom-message",{icon:'<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',message:o.message})))))),t("zonos-hello-dialog-footer",{key:"7421346614aed925f25e3571cbe935045e392615",appearanceSettings:this.appearanceSettings,setShowCountrySelect:o=>this.setShowCountrySelect(o),setShowLanguageSelect:o=>this.setShowLanguageSelect(o)})),this.showCountrySelect&&t("div",{key:"35560fe611d0424186e79aa1ff56f15c89d122b6"},t("zonos-country-select",{key:"c437335dcbcfcf74dab7baeddf663cc216f0b377",handleOnClose:()=>this.setShowCountrySelect(!1)})),this.showLanguageSelect&&t("div",{key:"4692f2be013dc35e821cf1ee9c20d05cf0de9d8e"},t("zonos-language-select",{key:"19337a5bb390beb9f7629e577f296f2c9f806c98",handleOnClose:()=>this.setShowLanguageSelect(!1)}))))}static get assetsDirs(){return["assets"]}static get watchers(){return{isOpen:["isOpenHandler"]}}};m.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--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:1001}: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}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";export{m as zonos_hello_dialog}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,e,t,r){function o(n){return n instanceof t?n:new t((function(e){e(n)}))}return new(t||(t=Promise))((function(t,i){function u(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r["throw"](n))}catch(n){i(n)}}function s(n){n.done?t(n.value):o(n.value).then(u,a)}s((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(e){return s([n,e])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=e.call(n,t)}catch(n){a=[6,n];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-1b75aa35.system.js","./p-5e1b2654.system.js","./p-2b8345d8.system.js"],(function(n){"use strict";var e,t,r,o,i,u,a,s,c,d,l;return{setters:[function(n){e=n.c},function(n){t=n.g;r=n.I},function(n){o=n.g;i=n.a;u=n.l;a=n.h;s=n.b},function(e){c=e._;d=e.c;l=e.a;var t={};t.checkoutHiddenBtnSelector=e.c;t.checkoutHiddenInternationalBtnSelector=e.a;t.domesticRedirectedBtnSelector=e.d;n(t)},function(e){var t={};t.countryRequireTaxId=e.c;t.euCountryCodes=e.e;t.shipToTaxIdLabels=e.s;n(t)}],execute:function(){var f=this;var v=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(e).origin;var i=t.some((function(n){return o.includes(n)}));var u=r.some((function(n){return o.includes(n)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var w="jsdelivr";var p=function(n){var e=m.indexOf(n);var t=m[e+1];return t||null};var h=function(){return __awaiter(f,void 0,void 0,(function(){var n,e,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:n=o();e=i();if(!n&&!e||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var y=function(n){if(!n){return null}var e=new URL(n).searchParams;var t=e.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=y(window.location.href);var t="https://v1.3.195.js.zonos.com";if(!e&&(t.includes("test.")||t.includes("test-"))){return t}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(e,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var t="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var b="https://js.stripe.com/v3";var z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var O=function(){var n=document.querySelectorAll('script[src^="'.concat(b,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!z.test(t.src)){continue}return t}return null};var j=null;var k=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(b).concat(e);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var _=function(n){if(j!==null){return j}j=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(S)}if(window.Stripe){e(window.Stripe);return}try{var r=O();if(r&&n){console.warn(S)}else if(!r){r=k(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(n){t(n);return}}));return j};var Z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var N=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);Z(r,t);return r};var I=Promise.resolve().then((function(){return _(null)}));var L=false;I.catch((function(n){if(!L){console.warn(n)}}));var U=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(f,void 0,void 0,(function(){var e;return __generator(this,(function(t){L=true;e=Date.now();return[2,I.then((function(t){return N(t,n,e)}))]}))}))};var R="tempCartUUID";var T=function(){var n=new URLSearchParams(window.location.search);var e=n.get(R);return e};var A=function(n){return __awaiter(f,[n],void 0,(function(n){var e,r,i,s,c,d,l,f;var v=n.cartId,m=n.retries;return __generator(this,(function(n){switch(n.label){case 0:e=o();r=t();i=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(i.toString()),{body:{isTestMode:e,tempCartUUID:v},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:s=n.sent(),c=s.errors,d=s.json,l=s.zonosMode;f=!d||c.length;if(!(f&&m))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:m});return[4,new Promise((function(n){return setTimeout(n,500)}))];case 2:n.sent();return[2,A({cartId:v,retries:m-1})];case 3:if(f){return[2,null]}return[2,Object.assign(Object.assign({},d),{zonosMode:l})]}}))}))};var F=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=c(n),t=e.isDgsCartId,r=e.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,A({cartId:n,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var E;var P=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=v({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var C="https://v1.3.195.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.195";var M="https://unpkg.com/@zonos/elements@1.3.195";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.195";var G="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function n(){}return n}();n("Zonos",V);E=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1746235369220";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.195");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o,i,a,c,l,f,v,m,w,p,y,b;return __generator(this,(function(z){switch(z.label){case 0:e=n.appearance,t=n.checkoutSettings,r=n.currencyConverter,o=n.helloSettings,i=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;E.cartId=T();if(E.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(E.version,") ======"));E.zonosApiKey=l;E.storeId=c;if(!E.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=E.isNpm;window.Zonos.isBigCommerce=E.isBigCommerce;window.Zonos.isLegacyCheckout=E.isLegacyCheckout;void window.Zonos.init(n)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!l&&!E.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!E.cartData&&E.cartId))return[3,2];u("Initialize cart data");return[4,F(E.cartId)];case 1:m=z.sent();if(!m){s("Failed to get cart data");return[2]}E.cartData=m.cartData;E.zonosApiKey=m.zonosApiKey;E.cartSettings=m.settings;z.label=2;case 2:return[4,h()];case 3:w=z.sent();if(w){E.zonosApiKey=w}z.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");y=E.cartId&&E.cartData||!!p;if(y){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");b=document.createElement("button");b.style.display="none";b.id="".concat(d);document.body.appendChild(b)}u("init zonos");E.restoreNativeBrowserFunctions();E.injectCustomScriptForHostedCheckout();E.injectZonosCdn();E.injectZonosCss();E.injectFonts();E.injectCheckoutInternationalButton();E.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});E.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(l))){var n=document.createElement("button");n.id=l;n.style.display="none";document.body.appendChild(n)}};V.injectCustomScriptForHostedCheckout=function(){var n=E.cartData;var e=(n===null||n===void 0?void 0:n.metadata)||[];var t=e.find((function(n){return n.key==="customHeaderScript"}));var r=e.find((function(n){return n.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(f,void 0,void 0,(function(){var n;return __generator(this,(function(t){n=document.querySelector("#".concat(l));setTimeout((function(){if(n){n.dispatchEvent(e("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};V.showNotification=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.showNotification(n))};V.updateOrganizationName=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};V.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.config,o=n.disable,i=n.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};a.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(o){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var n;var e=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(e){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((n=r.contentWindow)===null||n===void 0?void 0:n.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(n){var e=n.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=e.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=e.checkoutSettings.placeOrderButtonSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=e;c.zonosApiKey=E.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(n){return __awaiter(f,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;u("loading Stripe");return[4,U(e.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);E.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(n){var e=n.cdnType,t=n.isModule,r=n.theRestUrl;var o=E.getZonosUrl(e);var i="".concat(o,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var n=p(e);if(!n){return}E.injectScript({cdnType:n,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return D;case"unpkg":return M;case"cdnjs":return x;case"vercel":return C}};if(E.isNpm){var t=g();return t||e()}return e()};V.injectZonosCdn=function(){E.injectScript({cdnType:w,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});E.injectScript({cdnType:w,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(n){var e=n.cdnType,t=n.theRestUrl;var r=E.getZonosUrl(e);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(C,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var n=p(e);if(!n){return}E.injectStylesheet({cdnType:n,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){u("Zonos style links already injected","warn");return}E.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var n=function(){var n=document.fonts.check("1em Inter");if(n){u("Inter font already loaded","warn");return}var e=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(G,'"]'));for(var t=0;t<e.length;t++){var r=e[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(n()){u("Inter font already injected","warn");return}var e=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=G;e.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(G,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");e.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};V.injectSupportGoogleFont=function(n){var e;u("[FONT] injecting ".concat(n));var t=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(G,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=G;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))}}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,e,t,r){function o(n){return n instanceof t?n:new t((function(e){e(n)}))}return new(t||(t=Promise))((function(t,i){function u(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r["throw"](n))}catch(n){i(n)}}function s(n){n.done?t(n.value):o(n.value).then(u,a)}s((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(e){return s([n,e])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=e.call(n,t)}catch(n){a=[6,n];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-1b75aa35.system.js","./p-5e1b2654.system.js","./p-2b8345d8.system.js"],(function(n){"use strict";var e,t,r,o,i,u,a,s,c,d,l;return{setters:[function(n){e=n.c},function(n){t=n.g;r=n.I},function(n){o=n.g;i=n.a;u=n.l;a=n.h;s=n.b},function(e){c=e._;d=e.c;l=e.a;var t={};t.checkoutHiddenBtnSelector=e.c;t.checkoutHiddenInternationalBtnSelector=e.a;t.domesticRedirectedBtnSelector=e.d;n(t)},function(e){var t={};t.countryRequireTaxId=e.c;t.euCountryCodes=e.e;t.shipToTaxIdLabels=e.s;n(t)}],execute:function(){var f=this;var v=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(e).origin;var i=t.some((function(n){return o.includes(n)}));var u=r.some((function(n){return o.includes(n)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var w="jsdelivr";var p=function(n){var e=m.indexOf(n);var t=m[e+1];return t||null};var h=function(){return __awaiter(f,void 0,void 0,(function(){var n,e,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:n=o();e=i();if(!n&&!e||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var y=function(n){if(!n){return null}var e=new URL(n).searchParams;var t=e.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=y(window.location.href);var t="https://v1.3.196.js.zonos.com";if(!e&&(t.includes("test.")||t.includes("test-"))){return t}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(e,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var t="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var b="https://js.stripe.com/v3";var z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var O=function(){var n=document.querySelectorAll('script[src^="'.concat(b,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!z.test(t.src)){continue}return t}return null};var j=null;var k=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(b).concat(e);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var _=function(n){if(j!==null){return j}j=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(S)}if(window.Stripe){e(window.Stripe);return}try{var r=O();if(r&&n){console.warn(S)}else if(!r){r=k(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(n){t(n);return}}));return j};var Z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var N=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);Z(r,t);return r};var I=Promise.resolve().then((function(){return _(null)}));var L=false;I.catch((function(n){if(!L){console.warn(n)}}));var U=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(f,void 0,void 0,(function(){var e;return __generator(this,(function(t){L=true;e=Date.now();return[2,I.then((function(t){return N(t,n,e)}))]}))}))};var R="tempCartUUID";var T=function(){var n=new URLSearchParams(window.location.search);var e=n.get(R);return e};var A=function(n){return __awaiter(f,[n],void 0,(function(n){var e,r,i,s,c,d,l,f;var v=n.cartId,m=n.retries;return __generator(this,(function(n){switch(n.label){case 0:e=o();r=t();i=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(i.toString()),{body:{isTestMode:e,tempCartUUID:v},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:s=n.sent(),c=s.errors,d=s.json,l=s.zonosMode;f=!d||c.length;if(!(f&&m))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:m});return[4,new Promise((function(n){return setTimeout(n,500)}))];case 2:n.sent();return[2,A({cartId:v,retries:m-1})];case 3:if(f){return[2,null]}return[2,Object.assign(Object.assign({},d),{zonosMode:l})]}}))}))};var F=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=c(n),t=e.isDgsCartId,r=e.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,A({cartId:n,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var E;var P=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=v({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var C="https://v1.3.196.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.196";var M="https://unpkg.com/@zonos/elements@1.3.196";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.196";var G="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function n(){}return n}();n("Zonos",V);E=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1746458422535";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.196");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o,i,a,c,l,f,v,m,w,p,y,b;return __generator(this,(function(z){switch(z.label){case 0:e=n.appearance,t=n.checkoutSettings,r=n.currencyConverter,o=n.helloSettings,i=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;E.cartId=T();if(E.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(E.version,") ======"));E.zonosApiKey=l;E.storeId=c;if(!E.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=E.isNpm;window.Zonos.isBigCommerce=E.isBigCommerce;window.Zonos.isLegacyCheckout=E.isLegacyCheckout;void window.Zonos.init(n)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!l&&!E.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!E.cartData&&E.cartId))return[3,2];u("Initialize cart data");return[4,F(E.cartId)];case 1:m=z.sent();if(!m){s("Failed to get cart data");return[2]}E.cartData=m.cartData;E.zonosApiKey=m.zonosApiKey;E.cartSettings=m.settings;z.label=2;case 2:return[4,h()];case 3:w=z.sent();if(w){E.zonosApiKey=w}z.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");y=E.cartId&&E.cartData||!!p;if(y){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");b=document.createElement("button");b.style.display="none";b.id="".concat(d);document.body.appendChild(b)}u("init zonos");E.restoreNativeBrowserFunctions();E.injectCustomScriptForHostedCheckout();E.injectZonosCdn();E.injectZonosCss();E.injectFonts();E.injectCheckoutInternationalButton();E.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});E.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(l))){var n=document.createElement("button");n.id=l;n.style.display="none";document.body.appendChild(n)}};V.injectCustomScriptForHostedCheckout=function(){var n=E.cartData;var e=(n===null||n===void 0?void 0:n.metadata)||[];var t=e.find((function(n){return n.key==="customHeaderScript"}));var r=e.find((function(n){return n.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(f,void 0,void 0,(function(){var n;return __generator(this,(function(t){n=document.querySelector("#".concat(l));setTimeout((function(){if(n){n.dispatchEvent(e("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};V.showNotification=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.showNotification(n))};V.updateOrganizationName=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};V.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.config,o=n.disable,i=n.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};a.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(o){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var n;var e=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(e){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((n=r.contentWindow)===null||n===void 0?void 0:n.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(n){var e=n.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=e.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=e.checkoutSettings.placeOrderButtonSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=e;c.zonosApiKey=E.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(n){return __awaiter(f,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;u("loading Stripe");return[4,U(e.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);E.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(n){var e=n.cdnType,t=n.isModule,r=n.theRestUrl;var o=E.getZonosUrl(e);var i="".concat(o,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var n=p(e);if(!n){return}E.injectScript({cdnType:n,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return D;case"unpkg":return M;case"cdnjs":return x;case"vercel":return C}};if(E.isNpm){var t=g();return t||e()}return e()};V.injectZonosCdn=function(){E.injectScript({cdnType:w,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});E.injectScript({cdnType:w,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(n){var e=n.cdnType,t=n.theRestUrl;var r=E.getZonosUrl(e);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(C,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var n=p(e);if(!n){return}E.injectStylesheet({cdnType:n,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){u("Zonos style links already injected","warn");return}E.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var n=function(){var n=document.fonts.check("1em Inter");if(n){u("Inter font already loaded","warn");return}var e=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(G,'"]'));for(var t=0;t<e.length;t++){var r=e[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(n()){u("Inter font already injected","warn");return}var e=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=G;e.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(G,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");e.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};V.injectSupportGoogleFont=function(n){var e;u("[FONT] injecting ".concat(n));var t=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(G,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=G;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))}}}}));
@@ -1 +1 @@
1
- import{r as t,c as e,h as o,H as i}from"./p-c137dc82.js";import{G as n,f as s,H as r,e as c,a as l}from"./p-2f34e29a.js";import{z as a,b as d,d as h}from"./p-337fab4e.js";import{g as u,i as p,a as f}from"./p-e7b0c156.js";import{h as v,b as m,l as g}from"./p-0fc02cde.js";import"./p-4593324c.js";import"./p-b8d87932.js";const w=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},y=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},S=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483007",document.body.appendChild(o),e},z=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=S({position:"bottom-right"});o=t}if(o&&n(o)){if(g("Hello init complete"),!w(o)){const e=new MutationObserver((()=>{w(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{w(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=S({position:y(t.notFoundElementFallback)});w(e)}}),3e3)}}else m(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class b{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,i;const n=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(i=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===i?void 0:i.defaultView);if(t.source!==s)return;if(!this.isValidMessage(n))return;const r=this.listeners.get(n.type);null==r||r.forEach((t=>{try{t(n.payload)}catch(t){m("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,i=this.listeners.get(t);return i&&i.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class I extends b{constructor(){g("=== [Google Places Service] Initializing","info"),super(p.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(i,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class j{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new I,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const k=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(t){var e;t?(s.stripe=t,((e=a.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||n(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||n(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():m(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):m(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const i=t||h();if("Inter"===i){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t})}const n=new URLSearchParams;n.set("family",i);const{errors:s,json:r}=await v(`/api/zonos-elements/get-font-detail?${n.toString()}`);if(s.length>0)return g(`Failed to load font ${i}`,"warn"),void(a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t}))}handleLocationChange(){z(a.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)}))}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&f({id:p.GOOGLE_PLACES,onload:()=>{a.checkoutAddressService=new j},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}async componentWillLoad(){this.initHistoryListener(),a.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,i,n,s;const{errors:c,json:l,zonosMode:h}=await(async()=>{if(window.Zonos.cartSettings)return{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=u(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const{errors:o,json:i,zonosMode:n}=await v(`/api/zonos-elements/zonos-settings?${e.toString()}`);return o.length?(m("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:i,zonosMode:n}})();if("403"===(null===(e=null===(t=c[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const p=(null===(o=null==l?void 0:l.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(p),this.initZonosNotification();const f=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(i=this.config.checkoutSettings)||void 0===i?void 0:i.successBehavior),w=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==l?void 0:l.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0,successBehavior:f?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:f?(null===(n=window.Zonos.cartData)||void 0===n?void 0:n.storeBaseUrl)||(null==l?void 0:l.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):void 0});d({overrideSettings:w,zonosSettings:l}),a.zonosMode=h,this.setupGoogleFont(),"DISABLED"===a.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),a.helloSettings&&"ENABLED"===a.helloSettings.visibilityStatus&&(g("Initializing hello"),z(a.helloSettings)),await r();const y=(null===(s=null==l?void 0:l.checkoutSettings)||void 0===s?void 0:s.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(y&&this.stripeInitEvent){if("INACTIVE"===a.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===a.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:y.token}),this.initGooglePlacesService(l)}else g("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(t){d({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),l(t)}async getAppearanceSetting(){return a.appearance}async updateOrganizationName(t){a.organizationName=t}render(){return o(i,{key:"525180de311aea6ffaf2ecaa3fc35befd6bd9142",class:"zonos--elements"})}};k.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{visibility:hidden;opacity:0;height:0}";export{k as zonos_controller}
1
+ import{r as t,c as e,h as o,H as i}from"./p-c137dc82.js";import{G as n,f as s,H as r,e as c,a as l}from"./p-63bfe67c.js";import{z as a,b as d,d as h}from"./p-337fab4e.js";import{g as u,i as p,a as f}from"./p-e7b0c156.js";import{h as v,b as m,l as g}from"./p-0fc02cde.js";import"./p-4593324c.js";import"./p-b8d87932.js";const w=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},y=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},S=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483007",document.body.appendChild(o),e},b=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=S({position:"bottom-right"});o=t}if(o&&n(o)){if(g("Hello init complete"),!w(o)){const e=new MutationObserver((()=>{w(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{w(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=S({position:y(t.notFoundElementFallback)});w(e)}}),3e3)}}else m(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class z{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,i;const n=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(i=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===i?void 0:i.defaultView);if(t.source!==s)return;if(!this.isValidMessage(n))return;const r=this.listeners.get(n.type);null==r||r.forEach((t=>{try{t(n.payload)}catch(t){m("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,i=this.listeners.get(t);return i&&i.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class I extends z{constructor(){g("=== [Google Places Service] Initializing","info"),super(p.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(i,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class j{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new I,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const k=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(t){var e;t?(s.stripe=t,((e=a.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||n(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||n(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():m(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):m(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const i=t||h();if("Inter"===i){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t})}const n=new URLSearchParams;n.set("family",i);const{errors:s,json:r}=await v(`/api/zonos-elements/get-font-detail?${n.toString()}`);if(s.length>0)return g(`Failed to load font ${i}`,"warn"),void(a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t}))}handleLocationChange(){b(a.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)}))}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&f({id:p.GOOGLE_PLACES,onload:()=>{a.checkoutAddressService=new j},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}async componentWillLoad(){this.initHistoryListener(),a.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,i,n,s;const{errors:c,json:l,zonosMode:h}=await(async()=>{if(window.Zonos.cartSettings)return{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=u(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const{errors:o,json:i,zonosMode:n}=await v(`/api/zonos-elements/zonos-settings?${e.toString()}`);return o.length?(m("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:i,zonosMode:n}})();if("403"===(null===(e=null===(t=c[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const p=(null===(o=null==l?void 0:l.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(p),this.initZonosNotification();const f=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(i=this.config.checkoutSettings)||void 0===i?void 0:i.successBehavior),w=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==l?void 0:l.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0,successBehavior:f?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:f?(null===(n=window.Zonos.cartData)||void 0===n?void 0:n.storeBaseUrl)||(null==l?void 0:l.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):void 0});d({overrideSettings:w,zonosSettings:l}),a.zonosMode=h,this.setupGoogleFont(),"DISABLED"===a.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),a.helloSettings&&"ENABLED"===a.helloSettings.visibilityStatus&&(g("Initializing hello"),b(a.helloSettings)),await r();const y=(null===(s=null==l?void 0:l.checkoutSettings)||void 0===s?void 0:s.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(y&&this.stripeInitEvent){if("INACTIVE"===a.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===a.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:y.token}),this.initGooglePlacesService(l)}else g("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(t){d({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),l(t)}async getAppearanceSetting(){return a.appearance}async updateOrganizationName(t){a.organizationName=t}render(){return o(i,{key:"525180de311aea6ffaf2ecaa3fc35befd6bd9142",class:"zonos--elements"})}};k.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{visibility:hidden;opacity:0;height:0}";export{k as zonos_controller}