@zonos/elements 1.3.13-alpha.0 → 1.3.13-alpha.2

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.
@@ -1 +0,0 @@
1
- import{r as o,h as s,F as e,H as t}from"./p-07bb1bed.js";import{l as c,a as n,s as i,b as a,c as r,d as h,e as u,i as d,f as l,g as m,h as z,j as k,k as p,m as g,t as f,n as v,o as b,p as y,q as w}from"./p-c5321a31.js";import{z as C,g as x,m as O}from"./p-1bbdfae5.js";import{c as A,s as I,t as S}from"./p-c43da0c6.js";import{s as L,i as H}from"./p-03da9e9d.js";import{c as N}from"./p-b4b7f705.js";import{g as j}from"./p-07022f11.js";import{i as M}from"./p-9a90fb56.js";const B=({key:o,value:s})=>s?{key:o,value:s}:null,P=o=>[B({key:"brand",value:o.itemBrand}),B({key:"material",value:o.itemMaterial}),B({key:"category",value:o.itemCategory}),B({key:"color",value:o.itemColor}),B({key:"customization",value:o.itemCustomization}),B({key:"descriptionDetailed",value:o.itemDescriptionDetailed}),B({key:"fabricContent",value:o.itemFabricContent}),B({key:"ltlClass",value:o.itemLtlClass}),B({key:"pickingLocation",value:o.itemPickingLocation}),B({key:"shipFromLocation",value:o.itemShipFromLocation}),B({key:"size",value:o.itemSize}),B({key:"status",value:o.status})].filter(Boolean),D=o=>{if(!o)return"POUND";switch(o.toUpperCase()){case"KG":return"KILOGRAM";case"OZ":return"OUNCE";case"G":return"GRAM";default:return"POUND"}},E=o=>{if(!o)return[];const s=[];return o.length&&s.push({type:"LENGTH",unitOfMeasure:"INCH",value:o.length}),o.width&&s.push({type:"WIDTH",unitOfMeasure:"INCH",value:o.width}),o.weight&&s.push({type:"WEIGHT",unitOfMeasure:D(o.weightUnits),value:o.weight}),o.height&&s.push({type:"HEIGHT",unitOfMeasure:"INCH",value:o.height}),s},_=(o=!0)=>!(!c.localizationLoaded||!c.isShippableCountry&&(document.dispatchEvent(A("legacyCheckoutError","Unable to initiate checkout process in a country where shipping is not available")),o&&n("Checkout: not shippable country"),1)),T='<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',G='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--amino-gray-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',R=class{constructor(s){o(this,s),this.applyStripeTheme=async()=>{var o,s,e,t;const c=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||C.appearance.theme;await d({overrideBorderRaidus:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.style,overridePrimaryColor:null===(e=this.appearanceSettingsOverride)||void 0===e?void 0:e.colorPrimary,overrideSecondaryColor:null===(t=this.appearanceSettingsOverride)||void 0===t?void 0:t.colorSecondary,overrideTheme:this.isMobile?c:void 0})},this.getCurrentLocalePageEnum=()=>{switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}},this.appearanceSettingsOverride=void 0,this.preview=!1,this.mobile=!1,this.defaultAddress=null,this.forceDialogOpen=!1,this.open=this.forceDialogOpen,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.paymentError=!1,this.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.zonosReviewRef=void 0,this.storybookPaymentStatusOverride=void 0,this.domesticRedirectedBtnSelector="#zonos--domestic-redirected-checkout-button",this.legacyCheckoutHiddenBtnSelector="#legacy-checkout-hidden-button",this.isLegacyCheckout=!1}async initCartInfoHandler(o){m(o.detail)}async closeDialogHandler(){I("zonos-checkout-close"),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==l.step||z(),l.step="customer-info"}async buildCartAndInit(){if(window.Zonos.tempCartData){const o=(o=>{var s;return(null===(s=null==o?void 0:o.items)||void 0===s?void 0:s.map((o=>({amount:o.unitPrice||0,attributes:P(o),countryOfOrigin:o.countryOfOrigin||void 0,currencyCode:"USD",description:o.itemDescriptionLong||"",imageUrl:o.imageURL||"",itemType:"PHYSICAL_GOOD",measurements:E(o),name:o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""}))))||[]})(window.Zonos.tempCartData);await m(o)}else if(C.checkoutSettings.buildCartDetail){n("build cart detail");const o=await C.checkoutSettings.buildCartDetail();await m(o)}if(!k.clientSecret){const o=await p();if(n(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}return await this.applyStripeTheme(),!0}attachCheckout(){const o=C.checkoutSettings.placeOrderButtonSelector;o&&document.querySelectorAll(`${o}, ${this.domesticRedirectedBtnSelector}`).forEach((o=>{o.getAttribute("data-zonos-checkout-attached")||(o.addEventListener("click",(async o=>{if(_()){o.preventDefault(),o.stopPropagation(),n("zonos checkout button clicked"),k.isFetchingSession=!0,this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");I("zonos-checkout-start"),S("checkout_open")}catch(o){k.isFetchingSession=!1,g({messages:[f("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:f("Error creating Checkout")})}}})),o.removeAttribute("disabled"),o.setAttribute("data-zonos-checkout-attached","true"),o.matches(this.domesticRedirectedBtnSelector)&&(o.dispatchEvent(A("click")),r(),o.remove()),o.matches(this.legacyCheckoutHiddenBtnSelector)&&(this.isLegacyCheckout=!0,o.dispatchEvent(A("click")),o.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useLegacyQueryParam(){const o=new URLSearchParams(window.location.search),s={country:o.get("country"),customerAddress1:o.get("customerAddress1"),customerAddress2:o.get("customerAddress2"),customerCity:o.get("customerCity"),customerEmail:o.get("customerEmail"),customerName:o.get("customerName"),customerPhone:o.get("customerPhone"),customerState:o.get("customerState"),customerZip:o.get("customerZip")};s.customerAddress1&&s.customerCity&&s.customerName&&s.customerPhone&&s.customerState&&s.customerZip&&s.country&&(this.defaultAddress={address:{city:s.customerCity,country:s.country,line1:s.customerAddress1,line2:s.customerAddress2||"",postal_code:s.customerZip,state:s.customerState},name:s.customerName,phone:s.customerPhone})}async init(){k.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,(({domesticRedirectedBtnSelector:o,onShippingAddressSessionFound:s})=>{if(!window.Zonos.isBigCommerce)return;const e=new MutationObserver((async()=>{const t=document.querySelector(o),c=i();if(!t&&c){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==s||s(c),void e.disconnect()}const n=document.querySelector('select[name="shippingAddress.countryCode"]'),d=document.querySelector("#checkout-shipping-continue");n&&d&&(e.disconnect(),d.addEventListener("click",(async o=>{var s,e;const t=n.value;if(!t)return;if(a(t),!_(!1))return void r();const c=document.querySelector("form");if(!c)return;const i=new FormData(c),d=document.querySelector("input#addressLine1Input"),l={address1:null!==(s=i.get("shippingAddress.address1"))&&void 0!==s?s:d&&d.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:null!==(e=i.get("shippingAddress.stateOrProvince"))&&void 0!==e?e:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((o=>null==o)))return h("One or more shipping address field is missing",Object.entries(l)),void L({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(l))],metadata:{domain:window.location.hostname,storeId:C.storeId}});u({address1:l.address1,address2:l.address2,city:l.city,countryCode:l.countryCode,firstName:l.firstName,lastName:l.lastName,phone:l.phone,postalCode:l.postalCode,state:l.stateOrProvince}),o.preventDefault(),o.stopPropagation(),window.location.href="/"})))}));e.observe(document.body,{childList:!0,subtree:!0})})({domesticRedirectedBtnSelector:this.domesticRedirectedBtnSelector,onShippingAddressSessionFound:o=>{this.defaultAddress={address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},name:`${o.firstName} ${o.lastName}`,phone:o.phone}}}),window.Zonos.tempCartData&&this.useLegacyQueryParam();const o=setInterval((()=>{const s=window.Zonos.internationalHideSelector;if(!s)return void clearInterval(o);const e=_(!1),t=document.querySelectorAll(s);e?null==t||t.forEach((o=>{const s=o;s.setAttribute("data-zonos-checkout-original-display",s.style.display),s.style.display="none"})):null==t||t.forEach((o=>{const s=o,e=s.getAttribute("data-zonos-checkout-original-display")||getComputedStyle(s).display;s.style.display=e||"initial"}))}),100),s=setInterval((()=>{k.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(n("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(s)):n("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(s)}),1e4)}async setToFinishStep(o){l.step="finish",this.storybookPaymentStatusOverride=o}async handleCustomerInfoContinue(){this.submitLoading=!0,await v();const o=setInterval((()=>{!l.landedCostData&&k.isFetchingLandedCost||(l.landedCostData&&b(),this.submitLoading=!1,clearInterval(o))}),500)}async handleShippingContinue(){this.submitLoading=!0,setTimeout((()=>{b(),this.submitLoading=!1}),500)}async handleCheckoutPaymentContinue(){this.paymentError=!1,this.submitLoading=!0;try{await y(),b()}catch(o){h(o),this.paymentError=!0}this.submitLoading=!1}async handleFinishClick(){if(w(),this.preview)return l.step="customer-info",void await this.init();if(z(),this.isLegacyCheckout&&window.Zonos.tempCartData){const o=window.Zonos.tempCartData.contShoppingURL;return void(window.location.href=o)}const o=window.location.href.split("?")[0];window.history.replaceState({},document.title,o),this.open=!1,window.location.reload()}handleWindowResize(){this.isMobile=H(this.mobile),this.applyStripeTheme(),n(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=H(this.mobile),this.applyStripeTheme(),n(`mobile: ${this.isMobile}`)}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=x(this.appearanceSettingsOverride.theme))}componentWillLoad(){this.init(),this.isMobile=H(this.mobile),this.handleAppearanceSettingsOverrideChange(),n(`mobile: ${this.isMobile}`)}disconnectedCallback(){w(),z()}render(){var o;const n="finish"!==l.step&&"error"!==l.step&&!k.stripeElements||k.isFetchingSession,{colorPrimary:i,colorSecondary:a,logoUrl:r,style:h}=O(C.appearance,this.appearanceSettingsOverride),u="ENABLED"===C.appearance.zonosAttribution,d=C.appearance.theme,m=i&&M(i)?"DARK":"LIGHT",z=this.isMobile?d:m,p=this.isMobile?void 0:a,{customMessages:g}=c,f=null===(o=g.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,v=this.getCurrentLocalePageEnum(),b=g.filter((o=>o.pageName===v)),y=()=>s("div",{class:"zonos--logo"},r&&s("img",{alt:`${C.organizationName} logo`,src:r,width:100})),w=()=>s("zonos-v-stack",null,y(),s("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--amino-gray-0":null}),b.map((o=>s("zonos-custom-message",{icon:T,message:o.message})))),x=()=>s("div",{class:"zonos--content",style:{"--border-radius":j(h)}},"finish"!==l.step&&"error"!==l.step&&s(e,null,s("div",{class:"zonos--left","data-theme":z,style:{"--primary-color":this.isMobile?"":i}},!this.isMobile&&w(),"customer-info"===l.step&&s("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.defaultAddress,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:p}),"shipping"===l.step&&s("zonos-shipping",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:p}),"payment"===l.step&&s("zonos-checkout-payment",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleCheckoutPaymentContinue(),paymentError:this.paymentError,submitBtnColor:p})),s("div",{class:"zonos--right","data-theme":d},this.isMobile&&w(),!this.isLegacyCheckout&&s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{"aria-label":"Close checkout dialog",content:G}),noBackground:!0,onClick:()=>this.closeDialogHandler()}),s("div",{class:"flex--wrapper"},s("div",{class:"zonos--wrapper"},s("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)}}),s("zonos-collapse",{collapsed:this.collapseReviewMobile&&this.isMobile},s("zonos-cart-items",null),this.isMobile&&s("zonos-v-stack",{spacing:16},s("zonos-cart-subtotal",null),s("zonos-custom-message",{class:"zonos--checkout-default-message",icon:T,message:f})))),!this.isMobile&&s("zonos-v-stack",{spacing:16},s("zonos-cart-subtotal",null),s("zonos-custom-message",{class:"zonos--checkout-default-message",icon:T,message:f}))))),("finish"===l.step||"error"===l.step)&&s("div",{class:"zonos--done","data-theme":d},s("div",{class:"zonos--header"},y(),s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{"aria-label":"Close checkout dialog",content:G}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:d})),s("zonos-checkout-finish",{borderRadius:h,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===l.step&&l.error?Object.assign(Object.assign({},l.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),s("zonos-checkout-footer",{"data-theme":d,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return s(t,{class:N(["zonos--checkout zonos--elements",u&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?x():s("zonos-dialog",{borderStyle:h,height:"980px",isLoading:n,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},x()))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],mobile:["handleMobileChange"]}}};R.style=".sc-zonos-checkout-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--amino-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:var(--amino-space-32)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--amino-gray-0));border-right:1px solid var(--amino-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--amino-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--amino-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:var(--amino-space-24);padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 var(--amino-space-8) var(--amino-space-8)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:var(--amino-space-24);top:var(--amino-space-24);z-index:2}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:var(--amino-space-76);margin-bottom:var(--amino-space-8)}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--amino-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:var(--amino-space-32)}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:var(--amino-space-12);padding-bottom:var(--amino-space-76)}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:var(--amino-space-0)}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:var(--amino-space-16)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--amino-border);border-radius:var(--border-radius, var(--amino-radius-10));background-color:var(--amino-gray-50);padding:var(--amino-space-12);margin-top:var(--amino-space-32)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:var(--amino-space-8)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}";export{R as zonos_checkout}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,o){function i(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function u(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o["throw"](t))}catch(t){r(t)}}function a(t){t.done?e(t.value):i(t.value).then(u,s)}a((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(t){return function(n){return a([t,n])}}function a(s){if(o)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(e=0)),e)try{if(o=1,i&&(r=s[0]&2?i["return"]:s[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;if(i=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;i=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label<r[1]){e.label=r[1];r=s;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(s);break}if(r[2])e.ops.pop();e.trys.pop();continue}s=n.call(t,e)}catch(t){s=[6,t];i=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-52de4d70.system.js","./p-3639f458.system.js","./p-167b3369.system.js","./p-86034f1e.system.js","./p-41c2b1c5.system.js"],(function(t){"use strict";var n,e,o,i,r,u,s,a,c,f,h,d,l,v;return{setters:[function(t){n=t.r;e=t.c;o=t.h;i=t.H},function(t){r=t.r;u=t.d;s=t.u;a=t.a;c=t.j;f=t.v;h=t.b},function(t){d=t.z;l=t.b;v=t.d},function(){},function(){}],execute:function(){var _=this;var m=function(){return __awaiter(_,void 0,void 0,(function(){var t,n,e,o;return __generator(this,(function(i){switch(i.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/zonos-elements/zonos-settings");return[4,r(t)];case 1:n=i.sent(),e=n.errors,o=n.json;if(e.length){u("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:e,json:null}]}return[2,{errors:[],json:o}]}}))}))};var w=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var g=function(t){if(!t.placeOrderButtonSelector){return}if(!s(t.placeOrderButtonSelector)){u('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}w()};var y=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var o=document.createElement("zonos-hello");n.appendChild(o);return true}return false};var b=function(t){return __awaiter(_,void 0,void 0,(function(){var n,e,o;return __generator(this,(function(i){n=t.anchorElementSelector;if(!n||!s(n)){u('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}a("Hello init complete");e=y(n);if(!e){o=new MutationObserver((function(){var t=y(n);if(t){o.disconnect()}}));o.observe(document.body,{childList:true,subtree:true});setTimeout((function(){o.disconnect()}),5e3)}return[2]}))}))};var p=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--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}";var z=p;var k=t("zonos_controller",function(){function t(t){n(this,t);this.stripeInitEvent=e(this,"stripeInitEvent",7);this.config=undefined;this.zonosApiKey=undefined}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){a("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}c.stripe=t;void g(d.checkoutSettings);a("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,o,i,u,s,c,f;return __generator(this,(function(h){switch(h.label){case 0:o=t||v();if(o==="Inter"){if(!t){return[2]}a("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}i="https://v1.route.js.zonos.com";return[4,r("".concat(i,"/api/zonos-elements/get-font-detail?family=").concat(o))];case 1:u=h.sent(),s=u.errors,c=u.json;if(s.length>0||!c){a("Failed to load font ".concat(o),"warn");return[2]}f=c.fontUrl;(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,f);if(!t){return[2]}a("[FONT] ".concat(t," font override applied"));d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){d.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,o,i,r;return __generator(this,(function(u){switch(u.label){case 0:return[4,m()];case 1:e=u.sent(),o=e.errors,i=e.json;if(((t=o[0])===null||t===void 0?void 0:t.type.toString())==="403"){a("Failed to load zonos settings. This domain may not have access","warn");return[2]}this.initZonosNotification();l({overrideSettings:this.config,zonosSettings:i});void this.setupGoogleFont();if(d.helloSettings){void b(d.helloSettings)}return[4,f()];case 2:u.sent();r=((n=i===null||i===void 0?void 0:i.checkoutSettings)===null||n===void 0?void 0:n.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!r||!this.stripeInitEvent){a("Checkout failed to load -- missing publishable key","warn");return[2]}if(d.checkoutSettings.subscriptionStatus==="INACTIVE"){a('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");a("zonos controller loaded");return[2]}if(d.checkoutSettings.visibilityStatus==="DISABLED"){a("=== Checkout is disabled by store owner ===","warn");a("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:r.token});a("zonos controller loaded");return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){a("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){l({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){void h(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,d.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d.organizationName=t;return[2]}))}))};t.prototype.render=function(){return o(i,{key:"bd56d32009707ec9042ae5f8a87de7a7cedcca73",class:"zonos--elements"})};return t}());k.style=z}}}));
@@ -1 +0,0 @@
1
- import{r as o,c as t,h as n,H as e}from"./p-07bb1bed.js";import{r as s,d as i,u as r,a,j as c,v as l,b as d}from"./p-c5321a31.js";import{z as h,b as u,d as m}from"./p-1bbdfae5.js";import"./p-9a90fb56.js";import"./p-07022f11.js";const f=o=>{const t=document.querySelector(o);if(!document.querySelector("zonos-hello")&&t){const o=document.createElement("zonos-hello");return t.appendChild(o),!0}return!1},p=class{constructor(n){o(this,n),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){var t;o?(c.stripe=o,(t=h.checkoutSettings).placeOrderButtonSelector&&(r(t.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():i(`Selector checkoutButtonAnchor "${t.placeOrderButtonSelector}" is not a valid selector`)),a("init checkout element")):a("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const o=document.createElement("zonos-notification");document.body.appendChild(o)}async setupGoogleFont(o){var t,n;const e=o||m();if("Inter"===e){if(!o)return;a("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),h.appearance=Object.assign(Object.assign({},h.appearance),{fontFamily:o})}const{errors:i,json:r}=await s(`https://v1.route.js.zonos.com/api/zonos-elements/get-font-detail?family=${e}`);i.length>0||!r?a(`Failed to load font ${e}`,"warn"):(null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,r.fontUrl),o&&(a(`[FONT] ${o} font override applied`),h.appearance=Object.assign(Object.assign({},h.appearance),{fontFamily:o})))}async componentWillLoad(){h.zonosApiKey=this.zonosApiKey,(async()=>{var o,t;const{errors:n,json:e}=await(async()=>{const{errors:o,json:t}=await s("https://v1.route.js.zonos.com/api/zonos-elements/zonos-settings");return o.length?(i("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}):{errors:[],json:t}})();if("403"===(null===(o=n[0])||void 0===o?void 0:o.type.toString()))return void a("Failed to load zonos settings. This domain may not have access","warn");this.initZonosNotification(),u({overrideSettings:this.config,zonosSettings:e}),this.setupGoogleFont(),h.helloSettings&&(async o=>{const{anchorElementSelector:t}=o;if(t&&r(t)){if(a("Hello init complete"),!f(t)){const o=new MutationObserver((()=>{f(t)&&o.disconnect()}));o.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{o.disconnect()}),5e3)}}else i(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`)})(h.helloSettings),await l();const c=(null===(t=null==e?void 0:e.checkoutSettings)||void 0===t?void 0:t.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(c&&this.stripeInitEvent){if("INACTIVE"===h.checkoutSettings.subscriptionStatus)return a('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void a("zonos controller loaded");if("DISABLED"===h.checkoutSettings.visibilityStatus)return a("=== Checkout is disabled by store owner ===","warn"),void a("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:c.token}),a("zonos controller loaded")}else a("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):a("Failed to show notification - zonos-notification not found","warn")}async overrideConfig(o){u({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){d(o)}async getAppearanceSetting(){return h.appearance}async updateOrganizationName(o){h.organizationName=o}render(){return n(e,{key:"bd56d32009707ec9042ae5f8a87de7a7cedcca73",class:"zonos--elements"})}};p.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--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{p as zonos_controller}