@zonos/elements 1.3.164 → 1.3.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-51536404.js → cart-dbeee1e9.js} +63 -0
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-d15299be.js → paypal-38ab2263.js} +1 -1
- package/dist/cjs/{zonos-address_8.cjs.entry.js → zonos-address_7.cjs.entry.js} +20 -67
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
- package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +73 -0
- package/dist/collection/components/store/checkout/stripe.js +1 -0
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.css +3 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +19 -1
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +10 -0
- package/dist/esm/{cart-c98b72a5.js → cart-f2f5f13f.js} +63 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-64f0e379.js → paypal-7d253663.js} +1 -1
- package/dist/esm/{zonos-address_8.entry.js → zonos-address_7.entry.js} +21 -67
- package/dist/esm/zonos-cart-items_13.entry.js +2 -2
- package/dist/esm/zonos-checkout.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-stripe-input.entry.js +69 -0
- package/dist/esm-es5/cart-f2f5f13f.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-64f0e379.js → paypal-7d253663.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -0
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -0
- package/dist/scripts/index.d.ts +1 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/store/checkout/stripe.d.ts +4 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +1 -0
- package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +13 -0
- package/dist/types/types/generated/graphql.internal.types.ts +20 -0
- package/dist/types/types/utils/ZonosSettings.d.ts +4 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-0dfd0b45.entry.js → p-163425d9.entry.js} +1 -1
- package/dist/zonos-elements/{p-582c2da5.system.entry.js → p-16413274.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fb7e3be0.entry.js → p-18d23528.entry.js} +1 -1
- package/dist/zonos-elements/{p-b8ef4465.system.entry.js → p-1c850630.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c5ee0895.entry.js → p-20802055.entry.js} +1 -1
- package/dist/zonos-elements/{p-25d32c05.system.entry.js → p-25ad92dc.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3bff5a9f.system.js +1 -0
- package/dist/zonos-elements/{p-449e5921.system.js → p-3c865c53.system.js} +1 -1
- package/dist/zonos-elements/{p-054a2257.system.entry.js → p-3edccfff.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d8a738ff.entry.js → p-405f70b1.entry.js} +1 -1
- package/dist/zonos-elements/{p-323097dc.system.entry.js → p-41688151.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b74441b2.system.entry.js → p-466de014.system.entry.js} +1 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/{p-0376ca85.system.js → p-4a0d1e3c.system.js} +1 -1
- package/dist/zonos-elements/p-607a6750.entry.js +1 -0
- package/dist/zonos-elements/{p-32059b2a.system.entry.js → p-669a7b5d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-000602f9.entry.js → p-6e864533.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d520fcc.entry.js → p-7011d8e2.entry.js} +1 -1
- package/dist/zonos-elements/p-718c9603.system.entry.js +1 -0
- package/dist/zonos-elements/{p-63c6d77e.system.entry.js → p-735d4097.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-717a54c5.entry.js → p-93499c9b.entry.js} +1 -1
- package/dist/zonos-elements/{p-fab63f6b.system.entry.js → p-9d53988d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0b05bea8.entry.js → p-ab699c84.entry.js} +1 -1
- package/dist/zonos-elements/p-c371558a.system.entry.js +1 -0
- package/dist/zonos-elements/p-c556ff98.js +1 -0
- package/dist/zonos-elements/p-e4a52de7.entry.js +1 -0
- package/dist/zonos-elements/p-e97f9606.js +17 -0
- package/dist/zonos-elements/{p-42d6ec3b.entry.js → p-f9c2ff4c.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-c98b72a5.js +0 -1
- package/dist/esm-es5/zonos-address_8.entry.js +0 -1
- package/dist/zonos-elements/p-1a17b3ef.js +0 -17
- package/dist/zonos-elements/p-41447a72.system.js +0 -1
- package/dist/zonos-elements/p-a82b1632.entry.js +0 -1
- package/dist/zonos-elements/p-ae156715.js +0 -1
- package/dist/zonos-elements/p-c7def16c.system.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as o,h as e,H as t,d as n}from"./p-ab68ad11.js";import{f as i,V as a,r as d,l,e as r}from"./p-c556ff98.js";import{z as c,d as h}from"./p-dd999b44.js";import{i as p}from"./p-81a54668.js";import{b,l as f}from"./p-f0c8150e.js";import{i as u,c as m}from"./p-0c64dbbb.js";import{c as z}from"./p-b4b7f705.js";import{R as y}from"./p-08e7107d.js";import{g}from"./p-98e9c9cf.js";import{i as v}from"./p-672707ce.js";const x=class{constructor(e){s(this,e),this.invalidCharacters=o(this,"invalidCharacters",7),this.isAutoCompleteAdjusted=!1,this.type=void 0,this.titleText=void 0,this.defaultAddress=null,this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:i.stripeBillingAddressElement,stripeAddressEventData:i.stripeBillingAddressEventData,stripeElements:i.stripeElementsForBillingAddress}:{stripeAddressElement:i.stripeAddressElement,stripeAddressEventData:i.stripeAddressEventData,stripeElements:i.stripeElements}}updateAddressEventData({event:s,type:o}){"billing"===o?i.stripeBillingAddressEventData=s:i.stripeAddressEventData=s}updateAddressElement({stripeAddressElement:s,type:o}){"shipping"!==o?i.stripeBillingAddressElement=s:i.stripeAddressElement=s}async watchInitStripe(){var s,o;this.stripe=window.Zonos.stripe;const{stripeAddressEventData:e,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void b("Stripe is not initialized. Couldn't load stripe element.");(null===(s=this.defaultAddress)||void 0===s?void 0:s.phone)||null===(o=this.defaultAddress)||void 0===o||delete o.phone;const n=l.shippingZoneCountries,i=n?Object.values(n).map((s=>s.code)):[],d=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?i:[],c=(null==e?void 0:e.value.address.country)||a(r);f(`Stripe country code: ${c}`,"info");const h=t.create("address",{allowedCountries:d?[]:r,contacts:this.defaultAddress&&!e?[this.defaultAddress]:[],defaultValues:{address:Object.assign(Object.assign({},null==e?void 0:e.value.address),{country:c}),firstName:null==e?void 0:e.value.firstName,lastName:null==e?void 0:e.value.lastName,phone:null==e?void 0:e.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});h.mount(this.el.querySelector(".zonos--address-component")),h.on("change",(s=>{const o=s.value;!this.isDirtyAddress&&o.address.line1.length>=3&&(this.isDirtyAddress=!0,setTimeout((()=>{if(!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="2"),this.isAutoCompleteAdjusted=!0}if(p())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,o=this.el.closest(".zonos--group"),e=this.el.getBoundingClientRect().top+s;null==o||o.scrollTo({behavior:"smooth",top:e})}}),600)),this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},o),{firstName:o.firstName||o.name.split(" ")[0],lastName:o.lastName||o.name.split(" ")[1]})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:h,type:this.type})}defaultAddressChanged(){f("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy(),this.watchInitStripe()}renderCompanyNameInput(){var s;return"billing"===this.type?null:(null===(s=c.genericSettings)||void 0===s?void 0:s.companyNameInputEnabled)?e("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:d("Company name (optional)"),inputValue:i.companyName,onInputChange:s=>{i.companyName=s.detail}}):(i.companyName="",null)}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy()}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe()}render(){return e(t,{key:"18d2602886588dfeb39c7c0386354671076dd9bf",class:"zonos--address zonos--elements"},e("zonos-text",{key:"9c4f704259e307932930995b14a9f2edd51dd3e3",class:"zonos--title",type:"semiBoldLabel"},this.titleText),this.renderCompanyNameInput(),e("div",{key:"7b2031b0b29cc8153b9b6376f27ccd331cc46e7a",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};x.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const k=class{constructor(o){s(this,o),this.currentAddress=void 0,this.addressType=void 0}render(){var s;const{city:o,country:n,email:i,line1:a,line2:r,name:c,phone:h,postal_code:p,state:b}=this.currentAddress,f=null===(s=l.shippingZoneCountries)||void 0===s?void 0:s[n],m=({bold:s,content:o})=>{const t=u(o)?"red-600":"gray-1000";return e("zonos-text",{textColor:t,type:s?"boldLabel":"body"},o)};return e(t,{class:"zonos--address-form zonos--elements"},e("div",{class:"zonos--title"},e("zonos-text",{textColor:"gray-700",type:"smallHeader"},d("shipping"===this.addressType?"Shipping":"Billing"))),e("div",{class:"zonos--address-group"},c&&e("div",{class:"zonos--address-line"},m({bold:!0,content:c})),i&&e("div",{class:"zonos--address-line"},m({content:i})),h&&e("div",{class:"zonos--address-line"},m({content:h})),a&&e("div",{class:"zonos--address-line"},m({content:a})),r&&e("div",{class:"zonos--address-line"},m({content:r})),e("div",{class:"zonos--address-line"},o&&m({content:o}),b&&m({content:b}),p&&m({content:p})),f&&e("div",{class:"zonos--address-line"},e("zonos-country-flag",{class:"zonos--country-flag",countryCode:f.code})," ",m({content:f.displayName}))))}};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 .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}';const w=class{constructor(e){s(this,e),this.addressChange=o(this,"addressChange",7),this.onInputChange=({key:s,value:o})=>{this.addressChange.emit(Object.assign(Object.assign({},this.localAddress),{[s]:o}))},this.currentAddress=void 0,this.translatedAddress=void 0,this.addressType=void 0,this.localAddress=this.currentAddress}watchCurrentAddress(){var s,o,e,t,n,i;const{city:a,line1:d,line2:l,name:r,postal_code:c,state:h}=this.currentAddress;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:(null===(s=this.translatedAddress.city)||void 0===s?void 0:s[a])||a,line1:(null===(o=this.translatedAddress.line1)||void 0===o?void 0:o[d])||d,line2:(null===(e=this.translatedAddress.line2)||void 0===e?void 0:e[l])||l,name:(null===(t=this.translatedAddress.name)||void 0===t?void 0:t[r])||r,postal_code:(null===(n=this.translatedAddress.postal_code)||void 0===n?void 0:n[c])||c,state:(null===(i=this.translatedAddress.state)||void 0===i?void 0:i[h])||h})}componentWillLoad(){this.watchCurrentAddress()}render(){const{city:s,country:o,line1:n,line2:i,name:a,phone:l,postal_code:r,state:c}=this.localAddress,h=a.split(" ")[0]||"",p=a.split(" ").slice(1).join(" ")||"";return e(t,{key:"8b578737e33203a23563be7e9be0778deec99bbf",class:"zonos--address-form zonos--elements"},e("div",{key:"793675a1348547bf3f781788956befe325191011",class:"zonos--title"},e("zonos-text",{key:"13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9",textColor:"gray-700",type:"smallHeader"},d("shipping"===this.addressType?"Shipping":"Billing"))),e("div",{key:"2c5de5b5283fb99ee5f8b61d7a217177986fc2db",class:"zonos--address-group"},e("div",{key:"23bf3c893071000d5995a5f175867bab11929193",class:"zonos--contact"},e("zonos-text",{key:"7cdfe2a84ebad89ba5b16498d75def99cf392384",type:"label"},d("Contact")),e("zonos-input",{key:"1c39c38767fd306c5eb1164cdc989b8291209cf0",class:"zonos--form-email",inputLabel:d("Email"),inputValue:this.currentAddress.email,isDisabled:!0}),e("div",{key:"cbdf61217125e22b1a6cec9a340ef0aca2c75670",class:"zonos--name zonos--address-row"},e("zonos-input",{key:"360c99e7b2c6caa64580d5768b5bb53368927275",class:"zonos--form-first-name",inputLabel:d("First name"),inputValue:h,isError:u(h),onInputChange:s=>this.onInputChange({key:"name",value:`${s.detail} ${p}`})}),e("zonos-input",{key:"8ce5fa5c15c6f7928339ea10009ce0e68954a91f",class:"zonos--form-last-name",inputLabel:d("Last name"),inputValue:p,isError:u(p),onInputChange:s=>this.onInputChange({key:"name",value:`${h} ${s.detail}`})}))),e("div",{key:"7b4fa2d3baa6cb257e7688e5ba6777123898b3fd",class:"zonos--address"},e("zonos-text",{key:"9d5782331b2642755a755aeb7f98c9f4d87f9a20",type:"label"},d("Address")),e("zonos-input",{key:"a622025924ca86bdbf1d3c04b79e6dee172b4c42",class:"zonos--form-country",inputLabel:d("Country"),inputValue:o,isDisabled:!0}),e("zonos-input",{key:"f99b3a74db09ab5730878e80705b9aeac76bf800",class:"zonos--form-line1",inputLabel:d("Address line 1"),inputValue:n,isError:u(n),onInputChange:s=>this.onInputChange({key:"line1",value:s.detail})}),e("zonos-input",{key:"5d16aefa45a78045c87d166aaaec0255606e455e",class:"zonos--form-line2",inputLabel:d("Address line 2"),inputValue:i,isError:u(i),onInputChange:s=>this.onInputChange({key:"line2",value:s.detail})}),e("div",{key:"dc166be9381142835d72e731cb38a718522a068a",class:"zonos--address-row"},e("zonos-input",{key:"4f1a98f9d10ce0cff3ef18a3037a12382552b31d",class:"zonos--form-city",inputLabel:d("City"),inputValue:s,isError:u(s),onInputChange:s=>this.onInputChange({key:"city",value:s.detail})}),e("zonos-input",{key:"d4f97900b5fe2e1619950a52d1d1f716a8bc19ff",class:"zonos--form-state",inputLabel:d("State/Province"),inputValue:c,isError:u(c),onInputChange:s=>this.onInputChange({key:"state",value:s.detail})})),e("zonos-input",{key:"cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733",class:"zonos--form-postal-code",inputLabel:d("Postal code"),inputValue:r,isError:u(r),onInputChange:s=>this.onInputChange({key:"postal_code",value:s.detail})}),e("zonos-input",{key:"7421c82847eded6bdbcce49ef8196124d8e50c1d",class:"zonos--form-phone",inputLabel:d("Phone number"),inputValue:l,onInputChange:s=>this.onInputChange({key:"phone",value:s.detail})}))))}static get watchers(){return{translatedAddress:["watchCurrentAddress"]}}};w.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";const A=class{constructor(e){s(this,e),this.closeUpdateDialog=o(this,"closeUpdateDialog",7),this.continueClicked=o(this,"continueClicked",7),this.closeUpdateDialogHandler=()=>{this.closeUpdateDialog.emit()},this.getTranslatedAddress=({currentAddress:s,translatedAddress:o})=>{var e,t,n,i,a,d;const{city:l,line1:r,line2:c,name:h,postal_code:p,state:b}=s;return{city:(null===(e=o.city)||void 0===e?void 0:e[l])||l,line1:(null===(t=o.line1)||void 0===t?void 0:t[r])||r,line2:(null===(n=o.line2)||void 0===n?void 0:n[c])||c,name:(null===(i=o.name)||void 0===i?void 0:i[h])||h,postal_code:(null===(a=o.postal_code)||void 0===a?void 0:a[p])||p,state:(null===(d=o.state)||void 0===d?void 0:d[b])||b}},this.continueClickHandler=async()=>{var s,o,e;this.continueLoading=!0;const t=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null,n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState}),i=m(Object.assign(Object.assign({},n),{country:this.shippingAddress.country})),a=t&&this.billingAddress&&m(Object.assign(Object.assign({},t),{country:this.billingAddress.country})),d=!!Object.keys(i).length,l=!!a&&!!Object.keys(a).length;if(d||l){const t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelectorAll("zonos-address-form"),n=null==t?void 0:t[0],i=null==t?void 0:t[1],a=(null===(o=null==n?void 0:n.shadowRoot)||void 0===o?void 0:o.querySelector(".has-error"))||(null===(e=null==i?void 0:i.shadowRoot)||void 0===e?void 0:e.querySelector(".has-error"));return a&&a.scrollIntoView({behavior:"smooth",block:"center"}),void(this.continueLoading=!1)}this.continueClicked.emit({billingAddress:t,shippingAddress:n})},this.buildTranslateAddressState=({currentAddress:s,translatedAddress:o})=>{const{city:e,line1:t,line2:n,name:i,postal_code:a,state:d}=s;return{city:{[e]:o.city},line1:{[t]:o.line1},line2:{[n]:o.line2},name:{[i]:o.name},postal_code:{[a]:o.postal_code},state:{[d]:o.state}}},this.continueLoading=!1,this.dialogLoading=void 0,this.dialogOpen=!1,this.submitBtnType=void 0,this.submitBtnColor=void 0,this.isMobile=!1,this.shippingAddress=void 0,this.billingAddress=void 0,this.translatedShippingAddress=void 0,this.translatedBillingAddress=void 0,this.showErrorBanner=!1,this.translatedShippingAddressState={},this.translatedBillingAddressState={}}watchTranslatedShippingAddress(){this.translatedShippingAddressState=this.translatedShippingAddress}watchTranslatedBillingAddress(){this.translatedBillingAddressState=this.translatedBillingAddress}componentWillLoad(){this.watchTranslatedBillingAddress(),this.watchTranslatedShippingAddress()}render(){const s="#ffffff"===(this.submitBtnColor||c.appearance.colorSecondary)?"outline":this.submitBtnType||"standard",o=this.billingAddress,n=this.shippingAddress;return e(t,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:z(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},e("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeUpdateDialog.emit(),open:this.dialogOpen,width:"568px"},e("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},e("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},e("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},e("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},d("Update your address")),e("zonos-button",{key:"66abf7b74045e68e84e631298504236d32ca9c4e",class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:y}),noBackground:!0,onClick:()=>this.closeUpdateDialogHandler()})),e("zonos-text",{key:"ffb3d8f169867d5f6dff269e1becd99c98c5a7da"},d("To ensure delivery all address details must be in Latin characters."))),e("div",{key:"2cb61f06ce174e2317870decfdd337c67c5cf128",class:"zonos--group"},e("zonos-text",{key:"a616c540984120b468e52bccfb380ea3974ced22",class:"zonos--what-you-entered",type:"semiBoldLabel"},d("What you entered")),e("div",{key:"6ac8f9c14472370c501af1b0d50bd8f8746b7694",class:"zonos--address-display-group"},e("zonos-address-display",{key:"ea2c67a7bba51c99f80be968e448beeffcf1f863",addressType:"shipping",currentAddress:n}),o&&e("zonos-address-display",{key:"7ea1683dc04a292810e04ed6550d86086f25186f",addressType:"billing",currentAddress:o})),e("div",{key:"4d1cd9096943518b8b4e267608a5e1542befb6a9",class:"zonos--address-form-section"},e("zonos-text",{key:"e4184a2cc618d26d43979fa8cfe06070cf8b5af8",type:"semiBoldLabel"},d("Translated address")),e("zonos-address-form",{key:"c55d9d3c658565ceb7c7b879f444e3937b9f7ad6",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:s=>{this.translatedShippingAddressState=this.buildTranslateAddressState({currentAddress:n,translatedAddress:s.detail})},translatedAddress:this.translatedShippingAddressState}),o&&e("zonos-address-form",{key:"c3facc295b1322bb00baa6081f343dcea4f10777",addressType:"billing",class:"zonos--billing-address-form",currentAddress:o,onAddressChange:s=>{this.translatedBillingAddressState=this.buildTranslateAddressState({currentAddress:o,translatedAddress:s.detail})},translatedAddress:this.translatedBillingAddressState}))),e("div",{key:"1c89c9604ba0dece40275fcfac97e7f93706b430",class:"zonos--group-btn"},e("div",{key:"e47d393940b094b4e123864e4070daa87f0616f0",class:"zonos--button-wrapper"},e("zonos-button",{key:"216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6",class:"zonos--cancel-btn",onClick:()=>this.closeUpdateDialogHandler(),variant:"subtle"},d("Cancel")),e("zonos-button",{key:"acbacb92cedb325b46843d8f3aff13f4e7c86ab5",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"sm",variant:s},d("Update address")))))))}get el(){return n(this)}static get watchers(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}}};A.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--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";const C=["blue","cyan","green","orange","purple","red","gray","glass"],I=class{constructor(e){s(this,e),this.checkboxSelected=o(this,"checkboxSelected",7),this.backgroundColor="blue",this.label=void 0,this.isChecked=!1,this.isDisabled=!1,this.size=12,this.fontSize="base",this.borderStyle=void 0}onClick(){this.isDisabled||this.checkboxSelected.emit(!this.isChecked)}render(){const s=C.includes(this.backgroundColor),o=s?`var(--zonos-elements-${this.backgroundColor}-600)`:this.backgroundColor,n=s?`var(--zonos-elements-${this.backgroundColor}-200)`:v(o)?"var(--zonos-elements-gray-0)":"var(--zonos-elements-gray-800)",i=g({customRoundRadius:"4px",overrideBorderStyle:this.borderStyle});return e(t,{key:"7a2972128b04d5dffe09f60b5292d90f7201066a",class:z(["zonos--elements zonos--checkbox"]),style:{"--zonos--background-color":o,"--zonos--border-radius":i,"--zonos--font-family":h(),"--zonos--size":`${this.size}px`}},e("label",{key:"b18d0f091b783555b4b3a1fc2b5d5cb1c62a9d41",class:z([this.isDisabled&&"disabled"])},e("input",{key:"f3b86525ef7988d6df87f9147f5aa22b447c1303",checked:this.isChecked,disabled:this.isDisabled,hidden:!0,onChange:s=>{this.checkboxSelected.emit(s.target.checked)},type:"checkbox"}),e("span",{key:"2007c2fbc4d8437f75b9a3d7a4e65d394922abf4",class:"checkmark-container"},e("svg",{key:"481b9272c99cf464d8d88ab24a8dba35de921abf",class:"checkmark",color:n,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"ab7690fba113135175248c8926907312dfe478d5","clip-rule":"evenodd",d:"M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z",fill:"currentColor","fill-rule":"evenodd"}))),this.label&&e("zonos-text",{key:"99689099e7469f2ff928619daa2fcee0ce35a418",size:this.fontSize},this.label)))}};I.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--zonos--size);width:var(--zonos--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--zonos--background-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";const j=class{constructor(e){s(this,e),this.closeDialog=o(this,"closeDialog",3),this.isMobileMode=()=>this.mobile||window.innerWidth<=768,this.closeButtonHandler=()=>{this.open&&this.closeDialog.emit()},this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialog.emit()},this.open=!1,this.headerText="",this.width="460px",this.height=void 0,this.minHeight=void 0,this.noHeader=!1,this.noBodyPadding=!1,this.noBorder=!1,this.borderStyle=void 0,this.noCloseButton=!1,this.noClickOutside=!1,this.mobile=!1,this.isLoading=!0,this.isMobile=!1}handleWindowResize(){this.isMobile=this.isMobileMode()}handleKeyDown(s){"Escape"===s.key&&this.closeButtonHandler()}componentDidLoad(){this.isMobile=this.isMobileMode()}render(){const s=g({overrideBorderStyle:this.borderStyle});return e(t,{key:"a9932187bccf8e7fa505c7e07175d03541d66852",class:z(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--zonos--border-radius":s,"--zonos--font-family":h(),"--zonos--height":this.height||"initial","--zonos--min-height":this.minHeight||"500px","--zonos--width":this.width}},e("div",{key:"0298cf365a50e3544656a6d27ae59e922b9e3aed",class:"zonos--backdrop"}),e("div",{key:"9fce580a07147d51f17c898a22204c3d9ce6ac7b",class:"zonos--dialog-layout",inert:!this.open,onClick:this.clickOutsideDialogHandler},e("div",{key:"b168439cd985cc5c0166a653db206688504cf7dd",class:"zonos--dialog"},this.isLoading&&e("div",{key:"e0b6215f3c7bc939721669069bc294e08558d8b5",class:"zonos--loading"},e("zonos-spinner",{key:"687bcd6d2695933de828484c34aff1230bf71d49",size:30})),(this.headerText||!this.noCloseButton)&&e("div",{key:"04a57a4add896e3d96faca8b77321bba5f00b889",class:"zonos--header"},this.headerText&&e("h3",{key:"d084cb3aedcb7e5bb8fd82012b57f441d7dce4a2",class:"zonos--header-text"},this.headerText),!this.noCloseButton&&e("zonos-button",{key:"7b73bd57b8651fd3f3ebd29e3c252bd83d9375ee",class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close 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.closeButtonHandler,variant:"subtle"})),e("div",{key:"7af04c281b6410b87bfe53913e74fa215f6de24b",class:z(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},e("slot",{key:"8c6ce4437d2bc98f9eccea0280cee31794883b77"})),e("slot",{key:"11f97e705b3cc1bad11c037ede940d2f392d67e7",name:"dialog-footer"}))))}static get assetsDirs(){return["assets"]}};j.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--zonos--min-height, auto);height:var(--zonos--height, auto);width:var(--zonos--width, auto);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{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;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";const L=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),E=class{constructor(e){s(this,e),this.linkAuthenticationChange=o(this,"linkAuthenticationChange",7),this.setCustomEmailInputToLinkEvent=s=>{const o=L(s);i.stripeLinkEventData={complete:!!o,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var o;this.setCustomEmailInputToLinkEvent(s.detail),null===(o=this.linkAuthenticationChange)||void 0===o||o.emit()},this.titleText=void 0,this.defaultEmail=null,this.isEmailError=!1,this.stripe=i.stripe,this.isStagingMode=r.isStagingMode,this.clientSecret=i.clientSecret}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}watchInitStripe(){if(!this.stripe||!i.stripeElements)return;if(r.isStagingMode||!this.clientSecret)return;const s=i.stripeLinkElement||i.stripeElements.create("linkAuthentication",{defaultValues:(this.defaultEmail?{email:this.defaultEmail}:void 0)||void 0}),o=this.el.querySelector(".zonos--link-authentication-component");o?(s.mount(o),s.on("change",(s=>{var o;i.stripeLinkEventData=s,null===(o=this.linkAuthenticationChange)||void 0===o||o.emit()})),i.stripeLinkElement=s):b("Cannot find container element for linkAuthenticationElement")}watchDefaultEmail(){this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}componentDidLoad(){this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=r.isStagingMode,this.clientSecret=i.clientSecret,e(t,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":g()}},e("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return r.isStagingMode?e("zonos-stripe-input",{inputLabel:d("Email"),inputValue:this.defaultEmail||(null===(s=i.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const o=(null===(s=i.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!o)return;const e=L(o);this.isEmailError=!e},onInputChange:this.handleNormalEmailInput}):e("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&e("zonos-text",{textColor:"red-600"},d("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};E.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";export{x as zonos_address,k as zonos_address_display,w as zonos_address_form,A as zonos_address_update_dialog,I as zonos_checkbox,j as zonos_dialog,E as zonos_link_authentication}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{z as o,c as r}from"./p-dd999b44.js";import{F as e,f as n,e as t,z as a,r as i,x as s,k as l}from"./p-c556ff98.js";import{h as c,l as u,b as d,j as p}from"./p-f0c8150e.js";import{t as v}from"./p-672707ce.js";
|
|
2
|
+
/*!
|
|
3
|
+
* paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
|
|
4
|
+
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/function f(o,r){void 0===r&&(r={});var e=document.createElement("script");return e.src=o,Object.keys(r).forEach((function(o){e.setAttribute(o,r[o]),"data-csp-nonce"===o&&e.setAttribute("nonce",r["data-csp-nonce"])})),e}function y(o){return window[o]}function w(o,r){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var e=o.environment;if(e&&"production"!==e&&"sandbox"!==e)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==r&&"function"!=typeof r)throw new Error("Expected PromisePonyfill to be a function.")}const b=({backgroundColor1:o,backgroundColor2:r})=>v.readability(o,r)>2.5,h=r=>{const e=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));e&&"DISABLED"!==(null==e?void 0:e.status)&&"function"==typeof window.gtag&&(u("Zonos submits gtag event","log",r),window.gtag("event",r,{}))},{reset:P,state:m}=r((()=>({orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),k=({checkoutSessionId:r,onPaypalFail:u,onPaypalSessionDone:v,overrideBorderRaidus:f,overridePrimaryColor:y})=>({createOrder:async()=>{const o=await e();if(!o.valid)return m.paypalErrorMessage=o.errorMessage,n.hasPaymentError=!1,n.customErrorMessage=null,null==u||u(),"";try{m.paypalErrorMessage=null,t.inventoryCheckErrorMessage=null;try{t.inventoryCheckErrorMessage=await a()}catch(o){t.inventoryCheckErrorMessage=i("Unable to check inventory. Please try again.")}return t.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var r,e;const{errors:n,json:t}=await(async({checkoutSessionId:o})=>{const{errors:r,json:e}=await c("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"});return{errors:r,json:e}})({checkoutSessionId:o}),a=null===(r=null==t?void 0:t.paypalOrderCreate)||void 0===r?void 0:r.paypalOrderId;if(n.length||!a)throw new Error((null===(e=n.find(Boolean))||void 0===e?void 0:e.message)||"An unexpected error occurred when creating paypal order.");return a})({checkoutSessionId:r})}catch(o){return d("Failed to create paypal order",o),m.paypalErrorMessage=i("Failed to create PayPal order. Please try again, or consider using an alternative method."),n.hasPaymentError=!1,n.customErrorMessage=null,null==u||u(),""}},onApprove:async()=>{try{m.paypalErrorMessage=null,h("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{var e,n;const{errors:t,json:a}=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{const{errors:e,json:n}=await c("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:r},method:"POST"});return{errors:e,json:n}})({checkoutSessionId:o,paypalMockResponse:r}),s=null===(e=null==a?void 0:a.paypalOrderCapture.order)||void 0===e?void 0:e.id;if(t.length||!s)throw new Error((null===(n=t.find(Boolean))||void 0===n?void 0:n.message)||i("An unexpected error occurred when processing PayPal order."));return s})({checkoutSessionId:r,paypalMockResponse:window.Zonos._paypalMockResponse});m.orderIdCreated=o,null==v||v({orderId:o}),s(),l()}catch(o){if(d("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var r;const e=p(o.message),n=null===(r=null==e?void 0:e.errors.find(Boolean))||void 0===r?void 0:r.message,t=(null==n?void 0:n.match(/\[(.*?)\] (.*)/i))||[];t||(m.paypalErrorMessage=i("An unexpected error occurred when processing PayPal order."));const a=t[2]||i("An unexpected error occurred when processing PayPal order.");m.paypalErrorMessage=a})({error:o});null==u||u()}},style:{borderRadius:"SHARP"===f?0:10,color:b({backgroundColor1:"#ffc33a",backgroundColor2:y||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),j=async({currency:r})=>{var e;if(!(null===(e=o.checkoutSettings.externalPaymentMethods)||void 0===e?void 0:e.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void u("=== Paypal is disabled for this store","warn");const n=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!n)return void u("Failed to load paypal -- missing paypal publishable key","warn");const t="production"===o.zonosMode&&"LIVE"===o.checkoutSettings.mode?"production":"sandbox";window.Zonos.paypal=await function(o,r){if(void 0===r&&(r=Promise),w(o,r),"undefined"==typeof document)return r.resolve(null);var e=function(o){var r="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(r=o.sdkBaseUrl,delete o.sdkBaseUrl);var e,n,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,r){var e=t[r].toString();return"data"===(r=r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,r){return(r?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===r?o.attributes[r]=e:o.queryParams[r]=e,o}),{queryParams:{},attributes:{}}),i=a.queryParams,s=a.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(r,"?").concat((e=i,n="",Object.keys(e).forEach((function(o){0!==n.length&&(n+="&"),n+=o+"="+e[o]})),n)),attributes:s}}(o),n=e.url,t=e.attributes,a=t["data-namespace"]||"paypal",i=y(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,r){var e=document.querySelector('script[src="'.concat(o,'"]'));if(null===e)return null;var n=f(o,r),t=e.cloneNode();if(delete t.dataset.uidAuto,Object.keys(t.dataset).length!==Object.keys(n.dataset).length)return null;var a=!0;return Object.keys(t.dataset).forEach((function(o){t.dataset[o]!==n.dataset[o]&&(a=!1)})),a?e:null}(n,t)&&i?r.resolve(i):function(o,r){void 0===r&&(r=Promise),w(o,r);var e=o.url,n=o.attributes;if("string"!=typeof e||0===e.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new r((function(o,r){if("undefined"==typeof document)return o();!function(o){var r=o.onSuccess,e=o.onError,n=f(o.url,o.attributes);n.onerror=e,n.onload=r,document.head.insertBefore(n,document.head.firstElementChild)}({url:e,attributes:n,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(o)}})}))}({url:n,attributes:t},r).then((function(){var o=y(a);if(o)return o;throw new Error("The window.".concat(a," global variable is not available."))}))}({clientId:n.token,currency:r,environment:t}),u("==== Paypal script loaded")},g=o=>{var r;const e=window.Zonos.paypal;if(!e)return u("Paypal is not available"),null;const n=t.checkoutSessionId;if(!n)return u("Paypal is not available due to checkoutSessionId is not available"),null;u("==== Loading Paypal buttons"),m.paypalButtons.length&&(m.paypalButtons.forEach((async o=>{await o.close()})),m.paypalButtons=[]);const a=[null===(r=e.FUNDING)||void 0===r?void 0:r.PAYPAL].filter(Boolean);return m.paypalButtons=a.map((r=>{var t;let a=null;try{a=(null===(t=e.Buttons)||void 0===t?void 0:t.call(e,Object.assign(Object.assign({},k(Object.assign({checkoutSessionId:n,fundingSource:r},o))),{fundingSource:r})))||null}catch(o){u(`===== Failed to load paypal's "${r}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(u(`==== Paypal button ${r} loaded`),a):null})).filter(Boolean),m.paypalButtons},E=()=>{var r,e;return"ENABLED"===(null===(e=null===(r=o.checkoutSettings.externalPaymentMethods)||void 0===r?void 0:r.find((o=>"PAYPAL"===o.type)))||void 0===e?void 0:e.status)||!!m.paypalButtons.length};export{j as a,m as b,P as c,g as d,b as i,E as p,h as s}
|