@zonos/elements 1.3.90 → 1.3.92
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-e15290ab.js → cart-d456e0b8.js} +28 -11
- package/dist/cjs/{createCustomEvent-3da45800.js → createCustomEvent-94c259c7.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-47b71e3b.js → paypal-5c5f8d32.js} +1 -5
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +17 -18
- package/dist/cjs/zonos-checkout.cjs.entry.js +19 -12
- 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-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-notification_3.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +11 -8
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +1 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +18 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
- package/dist/collection/components/store/checkout/cart.js +15 -10
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +14 -2
- package/dist/esm/{cart-08c2a740.js → cart-1083aa3b.js} +29 -12
- package/dist/esm/{createCustomEvent-a8a9fe09.js → createCustomEvent-a45228e7.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-4a21792c.js → paypal-a2399ed3.js} +2 -5
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_12.entry.js +17 -18
- package/dist/esm/zonos-checkout.entry.js +19 -12
- 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-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-notification_3.entry.js +2 -2
- package/dist/esm-es5/{cart-08c2a740.js → cart-1083aa3b.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-a8a9fe09.js → createCustomEvent-a45228e7.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-4a21792c.js → paypal-a2399ed3.js} +2 -2
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-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-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-notification_3.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-4f13a851.entry.js → p-1560ee37.entry.js} +1 -1
- package/dist/zonos-elements/{p-fc2191b7.system.entry.js → p-1f1aaf73.system.entry.js} +1 -1
- package/dist/zonos-elements/p-340408f2.system.entry.js +1 -0
- package/dist/zonos-elements/{p-db4c833d.js → p-362bd7de.js} +2 -2
- package/dist/zonos-elements/{p-2aeb1f26.entry.js → p-3d6a7efd.entry.js} +1 -1
- package/dist/zonos-elements/p-403b3460.entry.js +1 -0
- package/dist/zonos-elements/{p-49010cea.system.entry.js → p-460cc134.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c1f0aeb4.system.js → p-4854c65b.system.js} +1 -1
- package/dist/zonos-elements/{p-76015899.system.entry.js → p-4e3d23ad.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dbd51a62.system.entry.js → p-52fdf52d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-05b75d37.system.js → p-57aa09e7.system.js} +1 -1
- package/dist/zonos-elements/{p-3951ac01.entry.js → p-7995965e.entry.js} +1 -1
- package/dist/zonos-elements/{p-5f0c4397.system.js → p-8aad6abd.system.js} +2 -2
- package/dist/zonos-elements/{p-7c8ad901.js → p-8dc1342e.js} +1 -1
- package/dist/zonos-elements/{p-6d5d31ac.entry.js → p-8e4348e9.entry.js} +1 -1
- package/dist/zonos-elements/{p-3214b2df.js → p-95b4ea5e.js} +1 -1
- package/dist/zonos-elements/{p-9c7da870.system.js → p-b53f9c25.system.js} +1 -1
- package/dist/zonos-elements/{p-f5e29ed6.system.entry.js → p-ba0aef88.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-531973ca.entry.js → p-c39c3ed6.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-3ac3a8be.entry.js → p-cf28a962.entry.js} +1 -1
- package/dist/zonos-elements/{p-0033c20b.system.entry.js → p-d8a3b001.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-aab5ccde.entry.js → p-dbe8a5de.entry.js} +1 -1
- package/dist/zonos-elements/{p-12f25739.system.entry.js → p-ded2ae47.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4a417566.system.entry.js → p-e8c3387c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-e9ee2062.entry.js +1 -0
- package/dist/zonos-elements/p-ed276123.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9773abc9.entry.js → p-f13738a1.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-48b151ae.entry.js +0 -1
- package/dist/zonos-elements/p-8bbe007f.system.entry.js +0 -1
- package/dist/zonos-elements/p-c28824a0.system.entry.js +0 -1
- package/dist/zonos-elements/p-f49ca64f.entry.js +0 -1
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.90.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.90.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.90",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1728926269469",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.90",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.90";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.90";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.92.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.92.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.92",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1728934669160",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.92",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.92";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.92";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--zonos-elements-
|
|
1
|
+
<svg color="var(--zonos-elements-red-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(--zonos-elements-red-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>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,a as n}from"./p-ad7ce197.js";import{s as t,c as o}from"./p-b8e85bf5.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b8e85bf5.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.90.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.90",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1728926225081",g.isLegacyCheckout=!1,g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.90",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.90";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.90";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.90.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}
|
|
1
|
+
import{l as e,a as n}from"./p-ad7ce197.js";import{s as t,c as o}from"./p-b8e85bf5.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b8e85bf5.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.92.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.92",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1728934623320",g.isLegacyCheckout=!1,g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.92",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.92";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.92";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.92.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as e,H as t}from"./p-5b7da777.js";import{_ as s,e as i,i as n,f as l,z as r,g as a,m as h}from"./p-1086aac3.js";import{l as d,x as c,t as m,z as f,A as p,B as g,C as u,D as w,E as z}from"./p-3214b2df.js";import{c as b}from"./p-b4b7f705.js";import{h as v,a as x,l as y}from"./p-ad7ce197.js";import{g as k}from"./p-5883217a.js";import"./p-a1b755bf.js";import"./p-1ca5696d.js";var L=s,T=/\s/,C=/^\s+/,O=i,E=n,D=function(o){return o?o.slice(0,function(o){for(var e=o.length;e--&&T.test(o.charAt(e)););return e}(o)+1).replace(C,""):o},S=l,I=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,A=/^0o[0-7]+$/i,B=parseInt,X=l,F=function(){return L.Date.now()},H=function(o){if("number"==typeof o)return o;if(function(o){return"symbol"==typeof o||E(o)&&"[object Symbol]"==O(o)}(o))return NaN;if(S(o)){var e="function"==typeof o.valueOf?o.valueOf():o;o=S(e)?e+"":e}if("string"!=typeof o)return 0===o?o:+o;o=D(o);var t=j.test(o);return t||A.test(o)?B(o.slice(2),t?2:8):I.test(o)?NaN:+o},N=Math.max,M=Math.min;const P=o=>{const e=null==o?void 0:o.replace("www.","").replace("https://","");return e&&new RegExp(e).test(window.location.href)},R=()=>{var o,e;const{productAddToCartElementSelector:t,productDescriptionElementSelector:s,productTitleElementSelector:i,restrictionBehavior:n}=r.helloSettings;i&&s||x("Hello could not check item restrictions - must provide title and description selectors.");const l=i&&c(i)&&document.querySelectorAll(i)||[],a=s&&c(s)&&document.querySelectorAll(s)||[];if(l.length!==a.length)return x("Hello could not check item restrictions - Title and description selectors do not match"),[];const h="RESTRICT_AND_BLOCK"===n,d=h&&t&&c(t)&&document.querySelectorAll(t)||[];h&&d.length!==a.length&&x('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');const m=[];for(let t=0;t<l.length;t++){const s=l[t],i=a[t];if(s&&i){const n={cartButtonNode:d[t]||null,description:(null===(o=i.textContent)||void 0===o?void 0:o.trim())||"",title:(null===(e=s.textContent)||void 0===e?void 0:e.trim())||""};m.push(n)}}return m},$=class{constructor(e){o(this,e),this.getHelloPeekMessage=o=>{if(("productDetail"===r.currentHelloPage||"productList"===r.currentHelloPage)&&this.allRestrictedItems.length){const o=m("click to learn more");return`${m("productDetail"===r.currentHelloPage?"Restricted item":"Restricted items found")} - ${o}`}switch(r.currentHelloPage){case"cart":return m("Prepay duties and taxes at checkout");case"productList":case"productDetail":return m("See duty and tax thresholds");default:return m("Welcome to [storeName]",{storeName:o})}},this.enableShowPeekMessage=()=>{this.peekMessage&&(this.showPeekMessage=!0)},this.getNewItemRestrictions=async o=>"productDetail"!==r.currentHelloPage&&"productList"!==r.currentHelloPage||"DISABLED"===r.helloSettings.restrictionBehavior?[]:await(async o=>{if(!o.length)return[];const{selectedCountryCode:e}=d;if(!e)return x("Hello could not check item restrictions - No country code selected"),[];const t=o.map((o=>({description:o.description,name:o.title})));return(await(async({items:o,shipFrom:e,shipTo:t})=>{var s;const i={items:o,shipFrom:e,shipTo:t},{errors:n,json:l}=await v("/api/zonos-elements/check-item-restrictions",{body:i,method:"POST"});return n.length||!l?(x(`Error fetching item restrictions: ${null===(s=n.find(Boolean))||void 0===s?void 0:s.message}`),[]):l.filter(Boolean)})({items:t,shipFrom:"AD",shipTo:e})).map((o=>{var e;const s=(null===(e=t.filter((e=>e.description===o.itemDescription)).find(Boolean))||void 0===e?void 0:e.name)||"";return Object.assign(Object.assign({},o),{name:s})}))})(o),this.triggerShowPeekMessage=()=>{this.peekMessage=this.getHelloPeekMessage(r.organizationName);const{peekMessageBehavior:o,peekMessageDelay:e}=r.helloSettings;"ENABLED"===o&&setTimeout((()=>{this.enableShowPeekMessage(),this.allRestrictedItems.some((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))))||setTimeout((()=>{this.showPeekMessage=!1}),3e3)}),1e3*e)},this.disableAddToCartButtons=()=>{this.productsOnPage.length&&this.productsOnPage.forEach((o=>{var e,t;this.allRestrictedItems.some((e=>e.itemDescription===o.description))?null===(e=o.cartButtonNode)||void 0===e||e.setAttribute("disabled","disabled"):null===(t=o.cartButtonNode)||void 0===t||t.removeAttribute("disabled")}))},this.handleItemRestrictions=async()=>{this.productsOnPage=R();const o=this.productsOnPage.filter((o=>!this.allFoundProducts.some((e=>e.title===o.title)))),e=await this.getNewItemRestrictions(o);this.allRestrictedItems.push(...e),this.allFoundProducts.push(...o),this.disableAddToCartButtons()},this.reloadHelloData=async()=>{await this.handleItemRestrictions(),this.triggerShowPeekMessage()},this.handleProductCountChange=function(o,e,t){var s,i,n,l,r,a,h=0,d=!1,c=!1,m=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function f(e){var t=s,n=i;return s=i=void 0,h=e,l=o.apply(n,t)}function p(o){var t=o-a;return void 0===a||t>=e||t<0||c&&o-h>=n}function g(){var o=F();if(p(o))return u(o);r=setTimeout(g,function(o){var t=e-(o-a);return c?M(t,n-(o-h)):t}(o))}function u(o){return r=void 0,m&&s?f(o):(s=i=void 0,l)}function w(){var o=F(),t=p(o);if(s=arguments,i=this,a=o,t){if(void 0===r)return function(o){return h=o,r=setTimeout(g,e),d?f(o):l}(a);if(c)return clearTimeout(r),r=setTimeout(g,e),f(a)}return void 0===r&&(r=setTimeout(g,e)),l}return e=H(e)||0,X(t)&&(d=!!t.leading,n=(c="maxWait"in t)?N(H(t.maxWait)||0,e):n,m="trailing"in t?!!t.trailing:m),w.cancel=function(){void 0!==r&&clearTimeout(r),h=0,s=a=i=r=void 0},w.flush=function(){return void 0===r?l:u(F())},w}((()=>{const{productTitleElementSelector:o}=r.helloSettings;if(o){const o=R();if(this.allFoundProducts.length!==o.length&&window.location.href===this.initialUrl){if(!this.allFoundProducts.length)return;this.reloadHelloData()}}}),1e3),this.watchProductCountChange=()=>{new MutationObserver(this.handleProductCountChange).observe(document.body,{childList:!0,subtree:!0})},this.watchPriceChange=()=>{new MutationObserver((()=>{this.displayCurrency()})).observe(document.body,{attributes:!0,childList:!0,subtree:!0})},this.updateHelloOnPageChange=()=>{this.watchProductCountChange(),setInterval((()=>{if(window.location.href!==this.initialUrl){const o=this.initialUrl&&new URL(this.initialUrl);(o&&f(o.searchParams))!==d.selectedCountryCode&&(this.allFoundProducts=[],this.allRestrictedItems=[],this.productsOnPage=[]),this.initialUrl=window.location.href,r.currentHelloPage=(()=>{const{cartUrlPattern:o,homepageUrlPattern:e,productDetailUrlPattern:t,productListUrlPattern:s}=r.helloSettings;return P(o)?"cart":P(t)?"productDetail":P(s)?"productList":P(e)?"home":""})();const e=new URL(window.location.href);if(!f(e.searchParams))return void p(d.selectedCountryCode);this.reloadHelloData()}}),1e3)},this.changeShowDialog=o=>{this.showDialog=o},this.shouldAnimateLeftDesktop=()=>{const o=this.helloRef&&getComputedStyle(this.helloRef).position;if(this.helloRef&&"relative"===o)return k(this.helloRef)},this.shouldRenderHello=(o=!0)=>{if(!d.localizationLoaded)return!1;const{showForCountries:e}=r.helloSettings;return o&&(d.isShippableCountry||y(`Hello: not shippable country - Show for countries: ${e}`)),"ONLY_SHIPPABLE"===e?d.isShippableCountry:"ALL"===e||(null==e?void 0:e.includes(d.selectedCountryCode||""))},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettingsOverride=void 0,this.showPeekMessage=!1,this.zonosStoreHelloSettings=r.helloSettings,this.showDialog=!1,this.peekMessage="",this.initialUrl="",this.allRestrictedItems=[],this.allFoundProducts=[],this.productsOnPage=[],this.isHelloWidgetRendered=!1,this.isMobile=!1}async getCountryList(){return d.helloCountryList}componentWillLoad(){const o=setInterval((async()=>{this.helloRef&&r.loadedConfig&&(this.helloRef.setAttribute("data-zonos-hello-loaded",""),this.updateHelloOnPageChange(),this.watchPriceChange(),this.handleAppearanceSettingsOverrideChange(),clearInterval(o))}),100)}async displayCurrency(){"DISABLED"!==r.helloSettings.currencyBehavior&&(d.exchangeRate?g():y("Could not display currency. Exchange rate and format data is not available.","warn"))}async convertAndFormat(o){return u(o)}async convert(o){return w(o)}async format(o){return z({amount:o})}async openHelloDialog(o){this.changeShowDialog(o)}handleResize(){this.isMobile=window.innerWidth<=768}handleHelloWidgetInitializedState({countryCode:o,currencyCode:e}){var t,s;this.isHelloWidgetRendered||d.selectedCountryCode&&"function"==typeof r.helloSettings.onInitSuccess&&(this.isHelloWidgetRendered=!0,null===(s=(t=r.helloSettings).onInitSuccess)||void 0===s||s.call(t,{countryCode:o,currencyCode:e}))}getHelloLocation(){const o=this.mobileLocationOverride||r.helloSettings.mobileLocation,e=r.helloSettings.desktopLocation,t=this.isMobile;if(!0===t)return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==o?void 0:o.includes("LEFT")),isOnTop:null==o?void 0:o.includes("TOP"),shouldFloat:!!o};{const o=!r.helloSettings.anchorElementSelector&&!!e;return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==e?void 0:e.includes("LEFT"))||this.shouldAnimateLeftDesktop(),isOnTop:null==e?void 0:e.includes("TOP"),shouldFloat:o}}}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=a(this.appearanceSettingsOverride.theme))}componentDidLoad(){this.isMobile=window.innerWidth<=768}render(){var o,s;if(null===(o=r.helloSettings.excludedUrlPatterns)||void 0===o?void 0:o.some((o=>new RegExp(o).test(window.location.href))))return y("Hello is excluded on this url","warn"),null;const{selectedCountryCode:i,targetCurrency:n}=d,{isOnLeft:l,isOnTop:a,shouldFloat:c}=this.getHelloLocation(),m=h(r.appearance,this.appearanceSettingsOverride),{theme:f}=m,p=null===(s=this.allRestrictedItems)||void 0===s?void 0:s.filter((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))));this.peekMessage=this.getHelloPeekMessage(r.organizationName);const g=this.shouldRenderHello()&&!!i;return g&&!this.isHelloWidgetRendered&&this.handleHelloWidgetInitializedState({countryCode:i,currencyCode:n}),e(t,{class:"zonos--hello zonos--elements","data-theme":f},g&&e("div",{class:b(["zonos--hello-wrapper",c&&"zonos--hello-widget-float"])},e("button",{class:b(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",l&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",a&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions",c&&"zonos--hello-widget-float"]),onClick:()=>{this.changeShowDialog(!this.showDialog)},onMouseEnter:()=>this.enableShowPeekMessage(),onMouseLeave:()=>this.showPeekMessage=!1,ref:o=>o&&(this.helloRef=o)},e("zonos-text",{class:"zonos--hello-message"},this.peekMessage),i&&e("div",{class:"zonos--hello-country-flag-wrapper"},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:i}))),e("div",{class:b(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override",c&&"zonos--hello-widget-float"]),style:{height:this.showDialog?"fit-content":"0px"}},e("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:m,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:p,setIsOpen:this.changeShowDialog}))))}static get watchers(){return{appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}}};$.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{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .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-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}";export{$ as zonos_hello}
|
|
1
|
+
import{r as o,h as e,H as t}from"./p-5b7da777.js";import{_ as s,e as i,i as n,f as l,z as r,g as a,m as h}from"./p-1086aac3.js";import{l as d,y as c,t as m,o as f,A as p,B as g,C as u,D as w,E as z}from"./p-95b4ea5e.js";import{c as b}from"./p-b4b7f705.js";import{h as v,a as x,l as y}from"./p-ad7ce197.js";import{g as k}from"./p-5883217a.js";import"./p-a1b755bf.js";import"./p-1ca5696d.js";var L=s,T=/\s/,C=/^\s+/,O=i,E=n,D=function(o){return o?o.slice(0,function(o){for(var e=o.length;e--&&T.test(o.charAt(e)););return e}(o)+1).replace(C,""):o},S=l,I=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,A=/^0o[0-7]+$/i,B=parseInt,X=l,F=function(){return L.Date.now()},H=function(o){if("number"==typeof o)return o;if(function(o){return"symbol"==typeof o||E(o)&&"[object Symbol]"==O(o)}(o))return NaN;if(S(o)){var e="function"==typeof o.valueOf?o.valueOf():o;o=S(e)?e+"":e}if("string"!=typeof o)return 0===o?o:+o;o=D(o);var t=j.test(o);return t||A.test(o)?B(o.slice(2),t?2:8):I.test(o)?NaN:+o},N=Math.max,M=Math.min;const P=o=>{const e=null==o?void 0:o.replace("www.","").replace("https://","");return e&&new RegExp(e).test(window.location.href)},R=()=>{var o,e;const{productAddToCartElementSelector:t,productDescriptionElementSelector:s,productTitleElementSelector:i,restrictionBehavior:n}=r.helloSettings;i&&s||x("Hello could not check item restrictions - must provide title and description selectors.");const l=i&&c(i)&&document.querySelectorAll(i)||[],a=s&&c(s)&&document.querySelectorAll(s)||[];if(l.length!==a.length)return x("Hello could not check item restrictions - Title and description selectors do not match"),[];const h="RESTRICT_AND_BLOCK"===n,d=h&&t&&c(t)&&document.querySelectorAll(t)||[];h&&d.length!==a.length&&x('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');const m=[];for(let t=0;t<l.length;t++){const s=l[t],i=a[t];if(s&&i){const n={cartButtonNode:d[t]||null,description:(null===(o=i.textContent)||void 0===o?void 0:o.trim())||"",title:(null===(e=s.textContent)||void 0===e?void 0:e.trim())||""};m.push(n)}}return m},$=class{constructor(e){o(this,e),this.getHelloPeekMessage=o=>{if(("productDetail"===r.currentHelloPage||"productList"===r.currentHelloPage)&&this.allRestrictedItems.length){const o=m("click to learn more");return`${m("productDetail"===r.currentHelloPage?"Restricted item":"Restricted items found")} - ${o}`}switch(r.currentHelloPage){case"cart":return m("Prepay duties and taxes at checkout");case"productList":case"productDetail":return m("See duty and tax thresholds");default:return m("Welcome to [storeName]",{storeName:o})}},this.enableShowPeekMessage=()=>{this.peekMessage&&(this.showPeekMessage=!0)},this.getNewItemRestrictions=async o=>"productDetail"!==r.currentHelloPage&&"productList"!==r.currentHelloPage||"DISABLED"===r.helloSettings.restrictionBehavior?[]:await(async o=>{if(!o.length)return[];const{selectedCountryCode:e}=d;if(!e)return x("Hello could not check item restrictions - No country code selected"),[];const t=o.map((o=>({description:o.description,name:o.title})));return(await(async({items:o,shipFrom:e,shipTo:t})=>{var s;const i={items:o,shipFrom:e,shipTo:t},{errors:n,json:l}=await v("/api/zonos-elements/check-item-restrictions",{body:i,method:"POST"});return n.length||!l?(x(`Error fetching item restrictions: ${null===(s=n.find(Boolean))||void 0===s?void 0:s.message}`),[]):l.filter(Boolean)})({items:t,shipFrom:"AD",shipTo:e})).map((o=>{var e;const s=(null===(e=t.filter((e=>e.description===o.itemDescription)).find(Boolean))||void 0===e?void 0:e.name)||"";return Object.assign(Object.assign({},o),{name:s})}))})(o),this.triggerShowPeekMessage=()=>{this.peekMessage=this.getHelloPeekMessage(r.organizationName);const{peekMessageBehavior:o,peekMessageDelay:e}=r.helloSettings;"ENABLED"===o&&setTimeout((()=>{this.enableShowPeekMessage(),this.allRestrictedItems.some((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))))||setTimeout((()=>{this.showPeekMessage=!1}),3e3)}),1e3*e)},this.disableAddToCartButtons=()=>{this.productsOnPage.length&&this.productsOnPage.forEach((o=>{var e,t;this.allRestrictedItems.some((e=>e.itemDescription===o.description))?null===(e=o.cartButtonNode)||void 0===e||e.setAttribute("disabled","disabled"):null===(t=o.cartButtonNode)||void 0===t||t.removeAttribute("disabled")}))},this.handleItemRestrictions=async()=>{this.productsOnPage=R();const o=this.productsOnPage.filter((o=>!this.allFoundProducts.some((e=>e.title===o.title)))),e=await this.getNewItemRestrictions(o);this.allRestrictedItems.push(...e),this.allFoundProducts.push(...o),this.disableAddToCartButtons()},this.reloadHelloData=async()=>{await this.handleItemRestrictions(),this.triggerShowPeekMessage()},this.handleProductCountChange=function(o,e,t){var s,i,n,l,r,a,h=0,d=!1,c=!1,m=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function f(e){var t=s,n=i;return s=i=void 0,h=e,l=o.apply(n,t)}function p(o){var t=o-a;return void 0===a||t>=e||t<0||c&&o-h>=n}function g(){var o=F();if(p(o))return u(o);r=setTimeout(g,function(o){var t=e-(o-a);return c?M(t,n-(o-h)):t}(o))}function u(o){return r=void 0,m&&s?f(o):(s=i=void 0,l)}function w(){var o=F(),t=p(o);if(s=arguments,i=this,a=o,t){if(void 0===r)return function(o){return h=o,r=setTimeout(g,e),d?f(o):l}(a);if(c)return clearTimeout(r),r=setTimeout(g,e),f(a)}return void 0===r&&(r=setTimeout(g,e)),l}return e=H(e)||0,X(t)&&(d=!!t.leading,n=(c="maxWait"in t)?N(H(t.maxWait)||0,e):n,m="trailing"in t?!!t.trailing:m),w.cancel=function(){void 0!==r&&clearTimeout(r),h=0,s=a=i=r=void 0},w.flush=function(){return void 0===r?l:u(F())},w}((()=>{const{productTitleElementSelector:o}=r.helloSettings;if(o){const o=R();if(this.allFoundProducts.length!==o.length&&window.location.href===this.initialUrl){if(!this.allFoundProducts.length)return;this.reloadHelloData()}}}),1e3),this.watchProductCountChange=()=>{new MutationObserver(this.handleProductCountChange).observe(document.body,{childList:!0,subtree:!0})},this.watchPriceChange=()=>{new MutationObserver((()=>{this.displayCurrency()})).observe(document.body,{attributes:!0,childList:!0,subtree:!0})},this.updateHelloOnPageChange=()=>{this.watchProductCountChange(),setInterval((()=>{if(window.location.href!==this.initialUrl){const o=this.initialUrl&&new URL(this.initialUrl);(o&&f(o.searchParams))!==d.selectedCountryCode&&(this.allFoundProducts=[],this.allRestrictedItems=[],this.productsOnPage=[]),this.initialUrl=window.location.href,r.currentHelloPage=(()=>{const{cartUrlPattern:o,homepageUrlPattern:e,productDetailUrlPattern:t,productListUrlPattern:s}=r.helloSettings;return P(o)?"cart":P(t)?"productDetail":P(s)?"productList":P(e)?"home":""})();const e=new URL(window.location.href);if(!f(e.searchParams))return void p(d.selectedCountryCode);this.reloadHelloData()}}),1e3)},this.changeShowDialog=o=>{this.showDialog=o},this.shouldAnimateLeftDesktop=()=>{const o=this.helloRef&&getComputedStyle(this.helloRef).position;if(this.helloRef&&"relative"===o)return k(this.helloRef)},this.shouldRenderHello=(o=!0)=>{if(!d.localizationLoaded)return!1;const{showForCountries:e}=r.helloSettings;return o&&(d.isShippableCountry||y(`Hello: not shippable country - Show for countries: ${e}`)),"ONLY_SHIPPABLE"===e?d.isShippableCountry:"ALL"===e||(null==e?void 0:e.includes(d.selectedCountryCode||""))},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettingsOverride=void 0,this.showPeekMessage=!1,this.zonosStoreHelloSettings=r.helloSettings,this.showDialog=!1,this.peekMessage="",this.initialUrl="",this.allRestrictedItems=[],this.allFoundProducts=[],this.productsOnPage=[],this.isHelloWidgetRendered=!1,this.isMobile=!1}async getCountryList(){return d.helloCountryList}componentWillLoad(){const o=setInterval((async()=>{this.helloRef&&r.loadedConfig&&(this.helloRef.setAttribute("data-zonos-hello-loaded",""),this.updateHelloOnPageChange(),this.watchPriceChange(),this.handleAppearanceSettingsOverrideChange(),clearInterval(o))}),100)}async displayCurrency(){"DISABLED"!==r.helloSettings.currencyBehavior&&(d.exchangeRate?g():y("Could not display currency. Exchange rate and format data is not available.","warn"))}async convertAndFormat(o){return u(o)}async convert(o){return w(o)}async format(o){return z({amount:o})}async openHelloDialog(o){this.changeShowDialog(o)}handleResize(){this.isMobile=window.innerWidth<=768}handleHelloWidgetInitializedState({countryCode:o,currencyCode:e}){var t,s;this.isHelloWidgetRendered||d.selectedCountryCode&&"function"==typeof r.helloSettings.onInitSuccess&&(this.isHelloWidgetRendered=!0,null===(s=(t=r.helloSettings).onInitSuccess)||void 0===s||s.call(t,{countryCode:o,currencyCode:e}))}getHelloLocation(){const o=this.mobileLocationOverride||r.helloSettings.mobileLocation,e=r.helloSettings.desktopLocation,t=this.isMobile;if(!0===t)return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==o?void 0:o.includes("LEFT")),isOnTop:null==o?void 0:o.includes("TOP"),shouldFloat:!!o};{const o=!r.helloSettings.anchorElementSelector&&!!e;return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==e?void 0:e.includes("LEFT"))||this.shouldAnimateLeftDesktop(),isOnTop:null==e?void 0:e.includes("TOP"),shouldFloat:o}}}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=a(this.appearanceSettingsOverride.theme))}componentDidLoad(){this.isMobile=window.innerWidth<=768}render(){var o,s;if(null===(o=r.helloSettings.excludedUrlPatterns)||void 0===o?void 0:o.some((o=>new RegExp(o).test(window.location.href))))return y("Hello is excluded on this url","warn"),null;const{selectedCountryCode:i,targetCurrency:n}=d,{isOnLeft:l,isOnTop:a,shouldFloat:c}=this.getHelloLocation(),m=h(r.appearance,this.appearanceSettingsOverride),{theme:f}=m,p=null===(s=this.allRestrictedItems)||void 0===s?void 0:s.filter((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))));this.peekMessage=this.getHelloPeekMessage(r.organizationName);const g=this.shouldRenderHello()&&!!i;return g&&!this.isHelloWidgetRendered&&this.handleHelloWidgetInitializedState({countryCode:i,currencyCode:n}),e(t,{class:"zonos--hello zonos--elements","data-theme":f},g&&e("div",{class:b(["zonos--hello-wrapper",c&&"zonos--hello-widget-float"])},e("button",{class:b(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",l&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",a&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions",c&&"zonos--hello-widget-float"]),onClick:()=>{this.changeShowDialog(!this.showDialog)},onMouseEnter:()=>this.enableShowPeekMessage(),onMouseLeave:()=>this.showPeekMessage=!1,ref:o=>o&&(this.helloRef=o)},e("zonos-text",{class:"zonos--hello-message"},this.peekMessage),i&&e("div",{class:"zonos--hello-country-flag-wrapper"},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:i}))),e("div",{class:b(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override",c&&"zonos--hello-widget-float"]),style:{height:this.showDialog?"fit-content":"0px"}},e("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:m,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:p,setIsOpen:this.changeShowDialog}))))}static get watchers(){return{appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}}};$.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{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .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-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}";export{$ as zonos_hello}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,t,o,e){function a(n){return n instanceof o?n:new o((function(t){t(n)}))}return new(o||(o=Promise))((function(o,s){function i(n){try{c(e.next(n))}catch(n){s(n)}}function r(n){try{c(e["throw"](n))}catch(n){s(n)}}function c(n){n.done?o(n.value):a(n.value).then(i,r)}c((e=e.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},e,a,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(t){return c([n,t])}}function c(r){if(e)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(o=0)),o)try{if(e=1,a&&(s=r[0]&2?a["return"]:r[0]?a["throw"]||((s=a["return"])&&s.call(a),0):a.next)&&!(s=s.call(a,r[1])).done)return s;if(a=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:o.label++;return{value:r[1],done:false};case 5:o.label++;a=r[1];r=[0];continue;case 7:r=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){o=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(r[0]===6&&o.label<s[1]){o.label=s[1];s=r;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(r);break}if(s[2])o.ops.pop();o.trys.pop();continue}r=t.call(n,o)}catch(n){r=[6,n];a=0}finally{e=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,t,o){if(o||arguments.length===2)for(var e=0,a=t.length,s;e<a;e++){if(s||!(e in t)){if(!s)s=Array.prototype.slice.call(t,0,e);s[e]=t[e]}}return n.concat(s||Array.prototype.slice.call(t))};System.register(["./p-fd061229.system.js","./p-b74ff880.system.js","./p-23e7c655.system.js","./p-c1f0aeb4.system.js","./p-197c5707.system.js","./p-5f0c4397.system.js","./p-91462d96.system.js","./p-455b7545.system.js"],(function(n){"use strict";var t,o,e,a,s,i,r,c,p,f,y;return{setters:[function(n){t=n.r;o=n.h;e=n.H;a=n.d;s=n.c},function(n){i=n.d},function(n){r=n.c},function(n){c=n.j},function(n){p=n.a;f=n.l},function(n){y=n.d},function(){},function(){}],execute:function(){var l=":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{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var m=l;var h=n("zonos_notification",function(){function n(n){t(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var t,o;var e=this;return __generator(this,(function(a){t="id-".concat(Math.random().toString(36).substring(2,9));o=Object.assign(Object.assign({},n),{id:t,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[o],false);setTimeout((function(){e.updateTransitionClass({id:t,transitionClass:"show"})}),50);setTimeout((function(){e.removeNotification(t)}),o.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var t=n.id,o=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===t){return Object.assign(Object.assign({},n),{transitionClass:o})}return n}))};n.prototype.removeNotification=function(n){var t=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){t.notificationArray=t.notificationArray.filter((function(t){return t.id!==n}))}),300)};n.prototype.render=function(){var n=this;return o(e,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:r(["zonos--elements zonos--notification"]),style:{"--font-family":i()}},o("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(t){return o("div",{"aria-hidden":"true",class:r(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:function(){n.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))}))))};return n}());h.style=m;var u=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var d=u;var z=n("zonos_payment",function(){function n(n){t(this,n);this.titleText=undefined;this.stripe=c.stripe;this.stripeElements=c.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=c.stripePaymentElement||this.stripeElements.create("payment",{layout:"tabs"});var t=this.el.querySelector(".zonos--payment-component");if(!t){p("Cannot find container element for paymentElement");return}n.mount(t);n.on("change",(function(n){c.stripePaymentEventData=n}));c.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return o(e,{key:"cf616ec959fd1b7396ed86b23561f459e0da8722",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"e5564db71ba2c0d67d372cb1804d6d462cdf1b33",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"3ea47f2c0a541590210d181bc73ecb3fb27e7783",class:"zonos--payment-component"}),o("div",{key:"d3a46a127448568caf4309806e88556594075c12",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return a(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}());z.style=d;var b=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var v=b;var g=n("zonos_paypal_payment",function(){function n(n){t(this,n);this.paypalSessionDone=s(this,"paypalSessionDone",7);this.paypalSessionFail=s(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,t;var o=this;return __generator(this,(function(e){if(!window.Zonos.paypal){f("Paypal is not available");return[2]}n=y({onPaypalFail:function(){f("onPaypalFail");o.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var t=n.orderId;f("onPaypalSessionDone","info",{orderId:t});o.paypalSessionDone.emit({orderId:t})}});if(!(n===null||n===void 0?void 0:n.length)){f("There are no paypal buttons available");return[2]}t=this.el.querySelector(".zonos--payment-paypal-container");if(!t){f("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,n.render(t)];case 1:o.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return o(e,{key:"6bfc962de500edbb105b7eb899711e48def78167",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"92d1b1c416f5e233c54e50d47129be375ef0a68b",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return a(this)},enumerable:false,configurable:true});return n}());g.style=v}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,t,o,e){function a(n){return n instanceof o?n:new o((function(t){t(n)}))}return new(o||(o=Promise))((function(o,s){function i(n){try{c(e.next(n))}catch(n){s(n)}}function r(n){try{c(e["throw"](n))}catch(n){s(n)}}function c(n){n.done?o(n.value):a(n.value).then(i,r)}c((e=e.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},e,a,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(t){return c([n,t])}}function c(r){if(e)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(o=0)),o)try{if(e=1,a&&(s=r[0]&2?a["return"]:r[0]?a["throw"]||((s=a["return"])&&s.call(a),0):a.next)&&!(s=s.call(a,r[1])).done)return s;if(a=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:o.label++;return{value:r[1],done:false};case 5:o.label++;a=r[1];r=[0];continue;case 7:r=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){o=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(r[0]===6&&o.label<s[1]){o.label=s[1];s=r;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(r);break}if(s[2])o.ops.pop();o.trys.pop();continue}r=t.call(n,o)}catch(n){r=[6,n];a=0}finally{e=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,t,o){if(o||arguments.length===2)for(var e=0,a=t.length,s;e<a;e++){if(s||!(e in t)){if(!s)s=Array.prototype.slice.call(t,0,e);s[e]=t[e]}}return n.concat(s||Array.prototype.slice.call(t))};System.register(["./p-fd061229.system.js","./p-b74ff880.system.js","./p-23e7c655.system.js","./p-4854c65b.system.js","./p-197c5707.system.js","./p-8aad6abd.system.js","./p-91462d96.system.js","./p-455b7545.system.js"],(function(n){"use strict";var t,o,e,a,s,i,r,c,p,y,f;return{setters:[function(n){t=n.r;o=n.h;e=n.H;a=n.d;s=n.c},function(n){i=n.d},function(n){r=n.c},function(n){c=n.j},function(n){p=n.a;y=n.l},function(n){f=n.c},function(){},function(){}],execute:function(){var l=":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{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var m=l;var h=n("zonos_notification",function(){function n(n){t(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var t,o;var e=this;return __generator(this,(function(a){t="id-".concat(Math.random().toString(36).substring(2,9));o=Object.assign(Object.assign({},n),{id:t,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[o],false);setTimeout((function(){e.updateTransitionClass({id:t,transitionClass:"show"})}),50);setTimeout((function(){e.removeNotification(t)}),o.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var t=n.id,o=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===t){return Object.assign(Object.assign({},n),{transitionClass:o})}return n}))};n.prototype.removeNotification=function(n){var t=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){t.notificationArray=t.notificationArray.filter((function(t){return t.id!==n}))}),300)};n.prototype.render=function(){var n=this;return o(e,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:r(["zonos--elements zonos--notification"]),style:{"--font-family":i()}},o("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(t){return o("div",{"aria-hidden":"true",class:r(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:function(){n.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))}))))};return n}());h.style=m;var u=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var d=u;var z=n("zonos_payment",function(){function n(n){t(this,n);this.titleText=undefined;this.stripe=c.stripe;this.stripeElements=c.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=c.stripePaymentElement||this.stripeElements.create("payment",{layout:"tabs"});var t=this.el.querySelector(".zonos--payment-component");if(!t){p("Cannot find container element for paymentElement");return}n.mount(t);n.on("change",(function(n){c.stripePaymentEventData=n}));c.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return o(e,{key:"cf616ec959fd1b7396ed86b23561f459e0da8722",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"e5564db71ba2c0d67d372cb1804d6d462cdf1b33",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"3ea47f2c0a541590210d181bc73ecb3fb27e7783",class:"zonos--payment-component"}),o("div",{key:"d3a46a127448568caf4309806e88556594075c12",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return a(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}());z.style=d;var b=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var v=b;var g=n("zonos_paypal_payment",function(){function n(n){t(this,n);this.paypalSessionDone=s(this,"paypalSessionDone",7);this.paypalSessionFail=s(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,t;var o=this;return __generator(this,(function(e){if(!window.Zonos.paypal){y("Paypal is not available");return[2]}n=f({onPaypalFail:function(){y("onPaypalFail");o.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var t=n.orderId;y("onPaypalSessionDone","info",{orderId:t});o.paypalSessionDone.emit({orderId:t})}});if(!(n===null||n===void 0?void 0:n.length)){y("There are no paypal buttons available");return[2]}t=this.el.querySelector(".zonos--payment-paypal-container");if(!t){y("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,n.render(t)];case 1:o.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return o(e,{key:"6bfc962de500edbb105b7eb899711e48def78167",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"92d1b1c416f5e233c54e50d47129be375ef0a68b",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return a(this)},enumerable:false,configurable:true});return n}());g.style=v}}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,t,n){function s(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,c){function r(o){try{u(n.next(o))}catch(o){c(o)}}function i(o){try{u(n["throw"](o))}catch(o){c(o)}}function u(o){o.done?t(o.value):s(o.value).then(r,i)}u((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},n,s,c,r;return r={next:i(0),throw:i(1),return:i(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function i(o){return function(e){return u([o,e])}}function u(i){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,i[0]&&(t=0)),t)try{if(n=1,s&&(c=i[0]&2?s["return"]:i[0]?s["throw"]||((c=s["return"])&&c.call(s),0):s.next)&&!(c=c.call(s,i[1])).done)return c;if(s=0,c)i=[i[0]&2,c.value];switch(i[0]){case 0:case 1:c=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;s=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(c=t.trys,c=c.length>0&&c[c.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!c||i[1]>c[0]&&i[1]<c[3])){t.label=i[1];break}if(i[0]===6&&t.label<c[1]){t.label=c[1];c=i;break}if(c&&t.label<c[2]){t.label=c[2];t.ops.push(i);break}if(c[2])t.ops.pop();t.trys.pop();continue}i=e.call(o,t)}catch(o){i=[6,o];s=0}finally{n=c=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};System.register(["./p-fd061229.system.js","./p-4854c65b.system.js","./p-8aad6abd.system.js","./p-b74ff880.system.js","./p-57aa09e7.system.js","./p-aed0098c.system.js","./p-197c5707.system.js","./p-23e7c655.system.js","./p-455b7545.system.js","./p-91462d96.system.js","./p-8c0ff373.system.js","./p-2770ba48.system.js"],(function(o){"use strict";var e,t,n,s,c,r,i,u,a,h,d,l,f,z,m,k,p,v,g,b,w,y,x,C,_,S,j,I,A,O,B,T,L,P,N,D,E,H,M,U,R,Z,F,V,G,q,W,Y;return{setters:[function(o){e=o.r;t=o.h;n=o.H;s=o.F},function(o){c=o.l;r=o.s;i=o.a;u=o.b;a=o.c;h=o.i;d=o.d;l=o.e;f=o.f;z=o.g;m=o.h;k=o.j;p=o.k;v=o.m;g=o.n;b=o.t;w=o.o;y=o.p;x=o.q;C=o.r;_=o.u;S=o.v;j=o.w;I=o.x},function(o){A=o.s;O=o.p},function(o){B=o.z;T=o.g;L=o.m},function(o){P=o.t;N=o.c;D=o.g},function(o){E=o.i},function(o){H=o.l;M=o.a;U=o.s;R=o.b},function(o){Z=o.c},function(o){F=o.g},function(o){V=o.i},function(o){G=o.s;q=o.d;W=o.c},function(o){Y=o.R}],execute:function(){var J=this;var K=function(o){var e=o.items.map((function(o){return{amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||undefined,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""}}))||[];return{adjustments:o.adjustments,cartItems:e}};var Q=function(o){if(o===void 0){o=true}if(!c.localizationLoaded){return true}if(c.isDisabledCountry){if(o){H("Checkout: disabled country")}return true}return false};var X=function(o){if(o===void 0){o=true}if(!c.localizationLoaded){return false}if(!c.isShippableCountry){if(o){H("Checkout: not shippable country")}return false}return true};var $=function(o){var e=o.domesticRedirectedBtnSelector,t=o.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(J,void 0,void 0,(function(){var o,s,c,h,d;var l=this;return __generator(this,(function(f){o=document.querySelector(e);s=r();if(!o&&s){c=document.createElement("button");c.style.display="none";c.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(c);t===null||t===void 0?void 0:t(s);n.disconnect();return[2]}h=document.querySelector('select[name="shippingAddress.countryCode"]');d=document.querySelector("#checkout-shipping-continue");if(!h||!d){return[2]}n.disconnect();d.addEventListener("click",(function(o){return __awaiter(l,void 0,void 0,(function(){var e,t,n,s,c,r,d;return __generator(this,(function(l){n=h.value;if(!n){return[2]}i(n);if(!X(false)){u();return[2]}s=document.querySelector("form");if(!s){return[2]}c=new FormData(s);r=document.querySelector("input#addressLine1Input");d={address1:(e=c.get("shippingAddress.address1"))!==null&&e!==void 0?e:r&&r.value,address2:c.get("shippingAddress.address2"),city:c.get("shippingAddress.city"),countryCode:c.get("shippingAddress.countryCode"),firstName:c.get("shippingAddress.firstName"),lastName:c.get("shippingAddress.lastName"),phone:c.get("shippingAddress.phone"),postalCode:c.get("shippingAddress.postalCode"),stateOrProvince:(t=c.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:c.get("shippingAddress.stateOrProvinceCode")};if(Object.values(d).some((function(o){return o===undefined||o===null}))){M("One or more shipping address field is missing",Object.entries(d));void U({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(d))],metadata:{domain:window.location.hostname,storeId:B.storeId}});return[2]}a({address1:d.address1,address2:d.address2,city:d.city,countryCode:d.countryCode,firstName:d.firstName,lastName:d.lastName,phone:d.phone,postalCode:d.postalCode,state:d.stateOrProvince});o.preventDefault();o.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var oo='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var eo=".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{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--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;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:24px;top:24px;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-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}";var to=eo;var no=90*60*1e3;var so=o("zonos_checkout",function(){function o(o){var t=this;e(this,o);this.onChangeLocaleListener=function(){};this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var o,e,t,n,s;return __generator(this,(function(c){switch(c.label){case 0:s=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||B.appearance.theme;return[4,h({overrideBorderRadius:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?s:undefined})];case 1:c.sent();return[2]}}))}))};this.getCurrentLocalePageEnum=function(){switch(d.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=undefined;this.preview=false;this.mobile=false;this.defaultAddress=null;this.forceDialogOpen=false;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.inventoryCheckErrorMessage=null}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=o.detail;void l({adjustments:d.adjustments,cartItems:e});return[2]}))}))};o.prototype.handleKeyPress=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(o.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};o.prototype.closeDialogHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(o===null||o===void 0?void 0:o.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;A("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&d.step==="finish"){f()}d.step="customer-info";z();m();(t=(e=B.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(e);return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n,s,r,i,e,t,t,u;return __generator(this,(function(a){switch(a.label){case 0:if(!window.Zonos.cartData)return[3,2];H("tempCartUUID is provided, start building cart");o=K(window.Zonos.cartData),e=o.adjustments,t=o.cartItems;return[4,l({adjustments:e,cartItems:t})];case 1:a.sent();return[3,9];case 2:if(!(typeof B.checkoutSettings.createCartId==="function"))return[3,6];H('"createCartId" is provided, start building cart');return[4,B.checkoutSettings.createCartId()];case 3:n=a.sent();window.Zonos.cartId=n;return[4,G(n)];case 4:s=a.sent();r=s===null||s===void 0?void 0:s.cartData;if(!r){M("Failed to build cart, please try again.");return[2]}i=K(r),e=i.adjustments,t=i.cartItems;return[4,l({adjustments:e,cartItems:t})];case 5:a.sent();return[3,9];case 6:if(!(B.checkoutSettings.buildCartDetail&&c.selectedCountryCode))return[3,9];H("build cart detail");return[4,B.checkoutSettings.buildCartDetail({countryCode:c.selectedCountryCode,currencyCode:c.targetCurrency})];case 7:t=a.sent();return[4,l({adjustments:[],cartItems:t})];case 8:a.sent();a.label=9;case 9:if(!!k.clientSecret)return[3,11];return[4,p()];case 10:u=a.sent();H("stripeStoreInitCheckoutSession: ".concat(u));if(!u){return[2,false]}a.label=11;case 11:return[4,this.applyStripeTheme()];case 12:a.sent();return[2,true]}}))}))};o.prototype.reloadCheckoutSession=function(){window.location.reload()};o.prototype.attachCheckout=function(){var o=this;var e=B.checkoutSettings.placeOrderButtonSelector;H("attach checkout ".concat(e));if(!e&&!window.Zonos.cartData){return}var t=[e,"#".concat(q),"#".concat(W)].filter(Boolean);var n=document.querySelectorAll(t.join(","));n.forEach((function(t){var n=t.getAttribute("data-zonos-checkout-attached");if(n){return}H("attached event to button ".concat(e),"info",{button:t});t.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,t,n;return __generator(this,(function(s){switch(s.label){case 0:if(!window.Zonos.isLegacyCheckout&&(!X()||Q())){return[2]}e.preventDefault();e.stopPropagation();H("zonos checkout button clicked");k.isFetchingSession=true;this.open=true;s.label=1;case 1:s.trys.push([1,3,,4]);return[4,this.buildCartAndInit()];case 2:t=s.sent();if(!t){throw new Error("Error building cart")}v({isPreview:this.preview,sessionTimeout:no});A("zonos-checkout-start");void P("checkout_open");return[3,4];case 3:n=s.sent();k.isFetchingSession=false;g({messages:[b("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:b("Error creating Checkout")});void U({endpoint:"Error creating Checkout",errors:[n instanceof Error?n.toString():"Unknown error"],metadata:{allLogs:R,cartId:window.Zonos.cartId,href:window.location.href,storeBaseUrl:(o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl}});return[3,4];case 4:return[2]}}))}))}),{capture:true,passive:false});if(!B.checkoutSettings.disablePlaceOrderButtonActivation){t.removeAttribute("disabled")}t.setAttribute("data-zonos-checkout-attached","true");if(t.matches(q)){t.dispatchEvent(N("click"));u();t.remove()}if(t.matches("#".concat(W))){t.dispatchEvent(N("click"));t.remove()}}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.useLegacyQueryParams=function(){var o=new URLSearchParams(window.location.search);var e=function(e){var t=o.get(e);if(!t||t==="undefined"){return null}return t};var t={country:w(o)||c.selectedCountryCode,customerAddress1:e("customerAddress1"),customerAddress2:e("customerAddress2"),customerCity:e("customerCity"),customerEmail:e("customerEmail"),customerName:e("customerName"),customerPhone:e("customerPhone"),customerState:e("customerState"),customerZip:e("customerZip")};if(!t.customerAddress1||!t.customerCity||!t.customerName||!t.customerPhone||!t.country){H("Missing some query params so it can not be prefilled","info",t);return}this.defaultAddress={address:{city:t.customerCity,country:t.country,line1:t.customerAddress1,line2:t.customerAddress2||"",postal_code:t.customerZip||"",state:t.customerState||""},email:t.customerEmail||"",name:t.customerName,phone:t.customerPhone}};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){k.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;$({domesticRedirectedBtnSelector:q,onShippingAddressSessionFound:function(o){e.defaultAddress={address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:"".concat(o.firstName," ").concat(o.lastName),phone:o.phone}}});if(window.Zonos){this.useLegacyQueryParams()}o=setInterval((function(){k.stripe=window.Zonos.stripe;e.stripe=window.Zonos.stripe;if(!e.stripe){H("waiting for stripe to be loaded");return}if(e.storybookPaymentStatusOverride){clearInterval(o);return}H("init checkout");if(e.preview||e.forceDialogOpen){void e.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){e.attachCheckout()}else if(window){e.attachCheckout();var t=new MutationObserver((function(){e.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(o)}),50);setTimeout((function(){clearInterval(o)}),1e4);return[2]}))}))};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){d.step="finish";this.storybookPaymentStatusOverride=o;return[2]}))}))};o.prototype.mockCheckoutSession=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){y(o);return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){switch(t.label){case 0:this.submitLoading=true;return[4,x()];case 1:t.sent();o=setInterval((function(){if(d.landedCostData||!k.isFetchingLandedCost){if(d.landedCostData){void O({currency:d.currency});C()}e.submitLoading=false;clearInterval(o)}}),500);return[2]}}))}))};o.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.submitLoading=true;setTimeout((function(){C();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleInventoryCheckDialogCancel=function(){d.inventoryCheckErrorMessage=null};o.prototype.handleInventoryCheckDialogConfirm=function(){d.inventoryCheckErrorMessage=null;void this.closeDialogHandler({confirmed:true})};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t;return __generator(this,(function(n){switch(n.label){case 0:k.hasPaymentError=false;this.submitLoading=true;d.inventoryCheckErrorMessage=null;n.label=1;case 1:n.trys.push([1,3,,4]);o=d;return[4,_()];case 2:o.inventoryCheckErrorMessage=n.sent();return[3,4];case 3:e=n.sent();d.inventoryCheckErrorMessage=b("Unable to check inventory. Please try again.");return[3,4];case 4:if(d.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}n.label=5;case 5:n.trys.push([5,7,,8]);return[4,S()];case 6:n.sent();C();m();return[3,8];case 7:t=n.sent();M(t);k.hasPaymentError=true;return[3,8];case 8:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n;return __generator(this,(function(s){switch(s.label){case 0:j();if(!this.preview)return[3,2];d.step="customer-info";return[4,this.init()];case 1:s.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){o=window.Zonos.cartData.storeBaseUrl;window.location.href=o;return[2]}e=window.location.href;t=e.split("?")[0];n=D();this.open=false;if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=E(this.mobile);void this.applyStripeTheme();H("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=E(this.mobile);void this.applyStripeTheme();H("mobile: ".concat(this.isMobile))};o.prototype.handleAppearanceSettingsOverrideChange=function(){var o;if((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme){this.appearanceSettingsOverride.theme=T(this.appearanceSettingsOverride.theme)}};o.prototype.handleAddressChange=function(){j()};o.prototype.componentWillLoad=function(){var o=this;void this.init();this.isMobile=E(this.mobile);this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=I("selectedLocale",(function(){void o.applyStripeTheme()}));H("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){j();f();this.onChangeLocaleListener()};o.prototype.render=function(){var o=this;var e;var r=d.step!=="finish"&&d.step!=="error"&&!k.stripeElements||k.isFetchingSession;var i=L(B.appearance,this.appearanceSettingsOverride),u=i.colorPrimary,a=i.colorSecondary,h=i.logoUrl,l=i.style;var f=B.appearance.zonosAttribution==="ENABLED";var z=B.appearance.theme;var m=u&&V(u)?"DARK":"LIGHT";var p=this.isMobile?z:m;var v=!this.isMobile?a:undefined;var g=c.customMessages;var w=(e=g.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message;var y=this.getCurrentLocalePageEnum();var x=g.filter((function(o){return o.pageName===y}));var C=function(){var e=o.preview?"".concat(h,"?timestamp=").concat(Date.now()):h;return t("div",{class:"zonos--logo"},e&&t("img",{alt:"".concat(B.organizationName," logo"),src:e}))};var _=D();var S=function(){var e=new URLSearchParams(window.location.search);var n=e.get("zonosQaUrl");var s=e.get("zonosDebug");return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},C(),_&&t("zonos-badge",{badgeColor:"orange",size:"small"},b("Test mode")),s==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n)),t("zonos-checkout-progress-tabs",{backgroundColor:o.isMobile?"--zonos-elements-gray-0":null}),x.map((function(o){return t("zonos-custom-message",{icon:oo,message:o.message})})))};var j=function(){if(d.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:b("Your checkout session has expired. Please reload the page to continue."),restStateTitle:b("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return o.reloadCheckoutSession()},variant:"primary"},b("Reload")))}return t("div",{class:"zonos--content",style:{"--border-radius":F({overrideBorderStyle:l})}},d.step!=="finish"&&d.step!=="error"&&t(s,null,t("div",{class:"zonos--left","data-theme":p,style:{"--primary-color":!o.isMobile?u:""}},!o.isMobile&&S(),d.step==="customer-info"&&t("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.defaultAddress,isMobile:o.isMobile,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:v}),d.step==="shipping"&&t("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:v}),d.step==="payment"&&t("zonos-checkout-payment",{continueLoading:o.submitLoading,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))},submitBtnColor:v})),t("div",{class:"zonos--right","data-theme":z},o.isMobile&&S(),!o.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Y}),noBackground:true,onClick:function(){return o.closeDialogHandler()}}),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile}}),t("zonos-collapse",{collapsed:o.collapseReviewMobile&&o.isMobile},t("zonos-cart-items",null),o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:v}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:oo,message:w})))),t("zonos-cart-restricted-items",null),!o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:oo,message:w}))))),(d.step==="finish"||d.step==="error")&&t("div",{class:"zonos--done","data-theme":z},t("div",{class:"zonos--header"},C(),t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:Y}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:z})),t("zonos-checkout-finish",{borderRadius:l,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:d.step==="error"&&!!d.error?Object.assign(Object.assign({},d.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":z,mobile:o.isMobile,slot:!o.isMobile?"dialog-footer":undefined}))};return t(n,{class:Z(["zonos--checkout zonos--elements",f&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?j():t("zonos-dialog",{borderStyle:l,"data-theme":z,height:"980px",isLoading:r,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeDialogHandler()},open:this.open,width:"1200px"},j()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:b("Don't close"),dialogConfirmBtnText:b("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:b("Would you like to close checkout and return to the site?"),dialogTitle:b("Are you sure?"),onCancelClicked:function(){o.confirmDialogOpen=false},onConfirmClicked:function(){return o.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:b("Return to cart"),dialogIntent:"danger",dialogOpen:!!d.inventoryCheckErrorMessage,dialogSubtitle:d.inventoryCheckErrorMessage,dialogTitle:b("Couldn't place order"),dialogType:"alert",onCancelClicked:function(){o.handleInventoryCheckDialogCancel()},onConfirmClicked:function(){return o.handleInventoryCheckDialogConfirm()}}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"]}},enumerable:false,configurable:true});return o}());so.style=to}}}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{z as o,c as e}from"./p-1086aac3.js";import{d as r,
|
|
1
|
+
import{z as o,c as e}from"./p-1086aac3.js";import{d as r,u as n,t,r as a,h as i}from"./p-95b4ea5e.js";import{h as s,l as c,a as l,j as u}from"./p-ad7ce197.js";import{t as d}from"./p-a1b755bf.js";
|
|
2
2
|
/*!
|
|
3
3
|
* paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
|
|
4
4
|
* Copyright 2020-present, PayPal, Inc. All rights reserved.
|
|
@@ -14,4 +14,4 @@ import{z as o,c as e}from"./p-1086aac3.js";import{d as r,r as n,t,q as a,h as i}
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/function p(o,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=o,Object.keys(e).forEach((function(o){r.setAttribute(o,e[o]),"data-csp-nonce"===o&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function y(o){return window[o]}function v(o,e){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var r=o.environment;if(r&&"production"!==r&&"sandbox"!==r)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}const f=({backgroundColor1:o,backgroundColor2:e})=>d.readability(o,e)>2.5,w=e=>{const r=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));r&&"DISABLED"!==(null==r?void 0:r.status)&&"function"==typeof window.gtag&&(c("Zonos submits gtag event","log",e),window.gtag("event",e,{}))},{reset:b,state:h}=e((()=>({orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),m=({checkoutSessionId:e,onPaypalFail:c,onPaypalSessionDone:d,overrideBorderRaidus:p,overridePrimaryColor:y})=>({createOrder:async()=>{try{h.paypalErrorMessage=null,r.inventoryCheckErrorMessage=null;try{r.inventoryCheckErrorMessage=await n()}catch(o){r.inventoryCheckErrorMessage=t("Unable to check inventory. Please try again.")}return r.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var e,r;const{errors:n,json:t}=await(async({checkoutSessionId:o})=>{const{errors:e,json:r}=await s("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"});return{errors:e,json:r}})({checkoutSessionId:o}),a=null===(e=null==t?void 0:t.paypalOrderCreate)||void 0===e?void 0:e.paypalOrderId;if(n.length||!a)throw new Error((null===(r=n.find(Boolean))||void 0===r?void 0:r.message)||"An unexpected error occurred when creating paypal order.");return a})({checkoutSessionId:e})}catch(o){return l("Failed to create paypal order",o),h.paypalErrorMessage=t("Failed to create PayPal order. Please try again, or consider using an alternative method."),null==c||c(),""}},onApprove:async()=>{try{h.paypalErrorMessage=null,w("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{var r,n;new URL(window.location.href);const{errors:a,json:i}=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{const{errors:r,json:n}=await s("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:e},method:"POST"});return{errors:r,json:n}})({checkoutSessionId:o,paypalMockResponse:e}),c=null===(r=null==i?void 0:i.paypalOrderCapture.order)||void 0===r?void 0:r.id;if(a.length||!c)throw new Error((null===(n=a.find(Boolean))||void 0===n?void 0:n.message)||t("An unexpected error occurred when processing PayPal order."));return c})({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse});h.orderIdCreated=o,null==d||d({orderId:o}),a(),i()}catch(o){if(l("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var e;const r=u(o.message),n=null===(e=null==r?void 0:r.errors.find(Boolean))||void 0===e?void 0:e.message,a=(null==n?void 0:n.match(/\[(.*?)\] (.*)/i))||[];a||(h.paypalErrorMessage=t("An unexpected error occurred when processing PayPal order."));const i=a[2]||t("An unexpected error occurred when processing PayPal order.");h.paypalErrorMessage=i})({error:o});null==c||c()}},style:{borderRadius:"SHARP"===p?0:10,color:f({backgroundColor1:"#ffc33a",backgroundColor2:y||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),P=async({currency:e})=>{var r;if(!(null===(r=o.checkoutSettings.externalPaymentMethods)||void 0===r?void 0:r.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void c("=== Paypal is disabled for this store","warn");const n=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!n)return void c("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,e){if(void 0===e&&(e=Promise),v(o,e),"undefined"==typeof document)return e.resolve(null);var r=function(o){var e="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(e=o.sdkBaseUrl,delete o.sdkBaseUrl);var r,n,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,e){var r=t[e].toString();return"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,e){return(e?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===e?o.attributes[e]=r:o.queryParams[e]=r,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(e,"?").concat((r=i,n="",Object.keys(r).forEach((function(o){0!==n.length&&(n+="&"),n+=o+"="+r[o]})),n)),attributes:s}}(o),n=r.url,t=r.attributes,a=t["data-namespace"]||"paypal",i=y(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,e){var r=document.querySelector('script[src="'.concat(o,'"]'));if(null===r)return null;var n=p(o,e),t=r.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?r:null}(n,t)&&i?e.resolve(i):function(o,e){void 0===e&&(e=Promise),v(o,e);var r=o.url,n=o.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new e((function(o,e){if("undefined"==typeof document)return o();!function(o){var e=o.onSuccess,r=o.onError,n=p(o.url,o.attributes);n.onerror=r,n.onload=e,document.head.insertBefore(n,document.head.firstElementChild)}({url:r,attributes:n,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(r,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(o)}})}))}({url:n,attributes:t},e).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:e,environment:t}),c("==== Paypal script loaded")},k=o=>{var e;const n=window.Zonos.paypal;if(!n)return c("Paypal is not available"),null;const t=r.checkoutSessionId;if(!t)return c("Paypal is not available due to checkoutSessionId is not available"),null;c("==== Loading Paypal buttons"),h.paypalButtons.length&&(h.paypalButtons.forEach((async o=>{await o.close()})),h.paypalButtons=[]);const a=[null===(e=n.FUNDING)||void 0===e?void 0:e.PAYPAL].filter(Boolean);return h.paypalButtons=a.map((e=>{var r;let a=null;try{a=(null===(r=n.Buttons)||void 0===r?void 0:r.call(n,Object.assign(Object.assign({},m(Object.assign({checkoutSessionId:t,fundingSource:e},o))),{fundingSource:e})))||null}catch(o){c(`===== Failed to load paypal's "${e}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(c(`==== Paypal button ${e} loaded`),a):null})).filter(Boolean),h.paypalButtons}
|
|
17
|
+
*/function p(o,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=o,Object.keys(e).forEach((function(o){r.setAttribute(o,e[o]),"data-csp-nonce"===o&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function y(o){return window[o]}function v(o,e){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var r=o.environment;if(r&&"production"!==r&&"sandbox"!==r)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}const f=({backgroundColor1:o,backgroundColor2:e})=>d.readability(o,e)>2.5,w=e=>{const r=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));r&&"DISABLED"!==(null==r?void 0:r.status)&&"function"==typeof window.gtag&&(c("Zonos submits gtag event","log",e),window.gtag("event",e,{}))},{reset:b,state:h}=e((()=>({orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),m=({checkoutSessionId:e,onPaypalFail:c,onPaypalSessionDone:d,overrideBorderRaidus:p,overridePrimaryColor:y})=>({createOrder:async()=>{try{h.paypalErrorMessage=null,r.inventoryCheckErrorMessage=null;try{r.inventoryCheckErrorMessage=await n()}catch(o){r.inventoryCheckErrorMessage=t("Unable to check inventory. Please try again.")}return r.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var e,r;const{errors:n,json:t}=await(async({checkoutSessionId:o})=>{const{errors:e,json:r}=await s("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"});return{errors:e,json:r}})({checkoutSessionId:o}),a=null===(e=null==t?void 0:t.paypalOrderCreate)||void 0===e?void 0:e.paypalOrderId;if(n.length||!a)throw new Error((null===(r=n.find(Boolean))||void 0===r?void 0:r.message)||"An unexpected error occurred when creating paypal order.");return a})({checkoutSessionId:e})}catch(o){return l("Failed to create paypal order",o),h.paypalErrorMessage=t("Failed to create PayPal order. Please try again, or consider using an alternative method."),null==c||c(),""}},onApprove:async()=>{try{h.paypalErrorMessage=null,w("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{var r,n;new URL(window.location.href);const{errors:a,json:i}=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{const{errors:r,json:n}=await s("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:e},method:"POST"});return{errors:r,json:n}})({checkoutSessionId:o,paypalMockResponse:e}),c=null===(r=null==i?void 0:i.paypalOrderCapture.order)||void 0===r?void 0:r.id;if(a.length||!c)throw new Error((null===(n=a.find(Boolean))||void 0===n?void 0:n.message)||t("An unexpected error occurred when processing PayPal order."));return c})({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse});h.orderIdCreated=o,null==d||d({orderId:o}),a(),i()}catch(o){if(l("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var e;const r=u(o.message),n=null===(e=null==r?void 0:r.errors.find(Boolean))||void 0===e?void 0:e.message,a=(null==n?void 0:n.match(/\[(.*?)\] (.*)/i))||[];a||(h.paypalErrorMessage=t("An unexpected error occurred when processing PayPal order."));const i=a[2]||t("An unexpected error occurred when processing PayPal order.");h.paypalErrorMessage=i})({error:o});null==c||c()}},style:{borderRadius:"SHARP"===p?0:10,color:f({backgroundColor1:"#ffc33a",backgroundColor2:y||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),P=async({currency:e})=>{var r;if(!(null===(r=o.checkoutSettings.externalPaymentMethods)||void 0===r?void 0:r.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void c("=== Paypal is disabled for this store","warn");const n=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!n)return void c("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,e){if(void 0===e&&(e=Promise),v(o,e),"undefined"==typeof document)return e.resolve(null);var r=function(o){var e="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(e=o.sdkBaseUrl,delete o.sdkBaseUrl);var r,n,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,e){var r=t[e].toString();return"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,e){return(e?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===e?o.attributes[e]=r:o.queryParams[e]=r,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(e,"?").concat((r=i,n="",Object.keys(r).forEach((function(o){0!==n.length&&(n+="&"),n+=o+"="+r[o]})),n)),attributes:s}}(o),n=r.url,t=r.attributes,a=t["data-namespace"]||"paypal",i=y(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,e){var r=document.querySelector('script[src="'.concat(o,'"]'));if(null===r)return null;var n=p(o,e),t=r.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?r:null}(n,t)&&i?e.resolve(i):function(o,e){void 0===e&&(e=Promise),v(o,e);var r=o.url,n=o.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new e((function(o,e){if("undefined"==typeof document)return o();!function(o){var e=o.onSuccess,r=o.onError,n=p(o.url,o.attributes);n.onerror=r,n.onload=e,document.head.insertBefore(n,document.head.firstElementChild)}({url:r,attributes:n,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(r,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(o)}})}))}({url:n,attributes:t},e).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:e,environment:t}),c("==== Paypal script loaded")},k=o=>{var e;const n=window.Zonos.paypal;if(!n)return c("Paypal is not available"),null;const t=r.checkoutSessionId;if(!t)return c("Paypal is not available due to checkoutSessionId is not available"),null;c("==== Loading Paypal buttons"),h.paypalButtons.length&&(h.paypalButtons.forEach((async o=>{await o.close()})),h.paypalButtons=[]);const a=[null===(e=n.FUNDING)||void 0===e?void 0:e.PAYPAL].filter(Boolean);return h.paypalButtons=a.map((e=>{var r;let a=null;try{a=(null===(r=n.Buttons)||void 0===r?void 0:r.call(n,Object.assign(Object.assign({},m(Object.assign({checkoutSessionId:t,fundingSource:e},o))),{fundingSource:e})))||null}catch(o){c(`===== Failed to load paypal's "${e}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(c(`==== Paypal button ${e} loaded`),a):null})).filter(Boolean),h.paypalButtons};export{h as a,b,k as c,f as i,P as p,w as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as t,h as n,H as e}from"./p-5b7da777.js";import{
|
|
1
|
+
import{r as o,c as t,h as n,H as e}from"./p-5b7da777.js";import{y as i,j as s,z as r,d as a,a as c}from"./p-95b4ea5e.js";import{z as l,b as d,d as h}from"./p-1086aac3.js";import{h as u,a as m,l as p}from"./p-ad7ce197.js";import"./p-a1b755bf.js";import"./p-1ca5696d.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},w=async o=>{if(window.Zonos.isLegacyCheckout)return void p("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:t}=o;let n=t;if(!o.anchorElementSelector&&o.desktopLocation){const o=(({position:o="bottom-right"})=>{const t=".zonos--hello-mobile-wrapper";if(document.querySelector(t))return t;const n=document.createElement("div");return n.className="zonos--hello-mobile-wrapper",n.style.position="fixed","top-right"===o&&(n.style.top="72px",n.style.right="24px"),"top-left"===o&&(n.style.top="72px",n.style.left="24px"),"bottom-right"===o&&(n.style.bottom="72px",n.style.right="24px"),"bottom-left"===o&&(n.style.bottom="72px",n.style.left="24px"),n.style.zIndex="2147483007",document.body.appendChild(n),t})({position:"bottom-right"});n=o}if(n&&i(n)){if(p("Hello init complete"),!f(n)){const o=new MutationObserver((()=>{f(n)&&o.disconnect()}));o.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{f(n)}),1e3)}}else m(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`)},b=class{constructor(n){o(this,n),this.paypalInitEvent=t(this,"paypalInitEvent",7),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){var t;o?(s.stripe=o,((t=l.checkoutSettings).placeOrderButtonSelector||window.Zonos.cartData)&&(!t.placeOrderButtonSelector||i(t.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():m(`Selector checkoutButtonAnchor "${t.placeOrderButtonSelector}" is not a valid selector`)),p("init checkout element")):p("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||h();if("Inter"===e){if(!o)return;p("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o})}const i=new URLSearchParams;i.set("family",e);const{errors:s,json:r}=await u(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0||!(null==r?void 0:r.fontUrl))return p(`Failed to load font ${e}`,"warn"),void(l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:"Inter"}));null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,r.fontUrl),o&&(p(`[FONT] ${o} font override applied`),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o}))}handleLocationChange(){w(l.helloSettings)}initHistoryListener(){const o=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),o.apply(this,arguments)};const t=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)}}async componentWillLoad(){this.initHistoryListener(),l.zonosApiKey=this.zonosApiKey,(async()=>{var o,t;const{errors:n,json:e,zonosMode:i}=await(async()=>{const{errors:o,json:t,zonosMode:n}=await u("/api/zonos-elements/zonos-settings");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:t,zonosMode:n}})();if("403"===(null===(o=n[0])||void 0===o?void 0:o.type.toString()))return void p("Failed to load zonos settings. This domain may not have access","warn");this.initZonosNotification();const s=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var o,t,n;return window.Zonos.isLegacyCheckout?(null===(o=null==e?void 0:e.appearanceSettings)||void 0===o?void 0:o.logoUrl)||(null===(t=this.config.appearance)||void 0===t?void 0:t.logoUrl):null===(n=this.config.appearance)||void 0===n?void 0:n.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{subscriptionStatus:void 0}):void 0});d({overrideSettings:s,zonosSettings:e}),l.zonosMode=i,this.setupGoogleFont(),"DISABLED"===l.helloSettings.visibilityStatus&&p("=== Hello is disabled by store owner ===","warn"),l.helloSettings&&"ENABLED"===l.helloSettings.visibilityStatus&&(p("Initializing hello"),w(l.helloSettings)),await r();const a=(null===(t=null==e?void 0:e.checkoutSettings)||void 0===t?void 0:t.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(a&&this.stripeInitEvent)return"INACTIVE"===l.checkoutSettings.subscriptionStatus?(p('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void p("zonos controller loaded")):"DISABLED"===l.checkoutSettings.visibilityStatus?(p("=== Checkout is disabled by store owner ===","warn"),void p("zonos controller loaded")):void this.stripeInitEvent.emit({publishableKey:a.token});p("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):p("Failed to show notification - zonos-notification not found","warn")}async reset(){a.checkoutSessionId=null,s.clientSecret=null}async overrideConfig(o){d({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){p(`Override country code to ${o}`),c(o)}async getAppearanceSetting(){return l.appearance}async updateOrganizationName(o){l.organizationName=o}render(){return n(e,{key:"133cc684aab52bfe4be6c4a318b1769928acc7a8",class:"zonos--elements"})}};b.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{b as zonos_controller}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,h as s,H as e,F as t}from"./p-5b7da777.js";import{l as n,s as c,a as i,b as r,c as a,i as h,d,e as l,f as u,g as m,h as z,j as k,k as p,m as g,n as f,t as b,o as w,p as v,q as y,r as C,u as x,v as S,w as I,x as A}from"./p-95b4ea5e.js";import{s as j,p as O}from"./p-362bd7de.js";import{z as B,g as L,m as P}from"./p-1086aac3.js";import{t as T,c as D,g as $}from"./p-8dc1342e.js";import{i as H}from"./p-81a54668.js";import{l as N,a as _,s as M,b as R}from"./p-ad7ce197.js";import{c as E}from"./p-b4b7f705.js";import{g as U}from"./p-1ca5696d.js";import{i as F}from"./p-a1b755bf.js";import{s as Z,d as V,c as W}from"./p-b8e85bf5.js";import{R as q}from"./p-08e7107d.js";const G=o=>{const s=o.items.map((o=>({amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||void 0,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""})))||[];return{adjustments:o.adjustments,cartItems:s}},K=(o=!0)=>!(!n.localizationLoaded||!n.isShippableCountry&&(o&&N("Checkout: not shippable country"),1)),Q='<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',Y=class{constructor(s){o(this,s),this.onChangeLocaleListener=()=>{},this.applyStripeTheme=async()=>{var o,s,e,t;const n=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||B.appearance.theme;await h({overrideBorderRadius: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?n:void 0})},this.getCurrentLocalePageEnum=()=>{switch(d.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.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.zonosReviewRef=void 0,this.storybookPaymentStatusOverride=void 0,this.isLegacyCheckout=window.Zonos.isLegacyCheckout,this.confirmDialogOpen=!1,this.inventoryCheckErrorMessage=null}async initCartInfoHandler(o){l({adjustments:d.adjustments,cartItems:o.detail})}async handleKeyPress(o){"Escape"===o.key&&this.closeDialogHandler()}async closeDialogHandler(o){var s,e;this.open&&((null==o?void 0:o.confirmed)?(this.confirmDialogOpen=!1,j("zonos-checkout-close"),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==d.step||u(),d.step="customer-info",m(),z(),null===(e=(s=B.checkoutSettings).onClose)||void 0===e||e.call(s)):this.confirmDialogOpen=!0)}async buildCartAndInit(){if(window.Zonos.cartData){N("tempCartUUID is provided, start building cart");const{adjustments:o,cartItems:s}=G(window.Zonos.cartData);await l({adjustments:o,cartItems:s})}else if("function"==typeof B.checkoutSettings.createCartId){N('"createCartId" is provided, start building cart');const o=await B.checkoutSettings.createCartId();window.Zonos.cartId=o;const s=await Z(o),e=null==s?void 0:s.cartData;if(!e)return void _("Failed to build cart, please try again.");const{adjustments:t,cartItems:n}=G(e);await l({adjustments:t,cartItems:n})}else if(B.checkoutSettings.buildCartDetail&&n.selectedCountryCode){N("build cart detail");const o=await B.checkoutSettings.buildCartDetail({countryCode:n.selectedCountryCode,currencyCode:n.targetCurrency});await l({adjustments:[],cartItems:o})}if(!k.clientSecret){const o=await p();if(N(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}return await this.applyStripeTheme(),!0}reloadCheckoutSession(){window.location.reload()}attachCheckout(){const o=B.checkoutSettings.placeOrderButtonSelector;if(N(`attach checkout ${o}`),!o&&!window.Zonos.cartData)return;const s=[o,`#${V}`,`#${W}`].filter(Boolean);document.querySelectorAll(s.join(",")).forEach((s=>{s.getAttribute("data-zonos-checkout-attached")||(N(`attached event to button ${o}`,"info",{button:s}),s.addEventListener("click",(async o=>{var s;if(window.Zonos.isLegacyCheckout||K()&&!((o=!0)=>!n.localizationLoaded||!!n.isDisabledCountry&&(o&&N("Checkout: disabled country"),!0))()){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");g({isPreview:this.preview,sessionTimeout:54e5}),j("zonos-checkout-start"),T("checkout_open")}catch(o){k.isFetchingSession=!1,f({messages:[b("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:b("Error creating Checkout")}),M({endpoint:"Error creating Checkout",errors:[o instanceof Error?o.toString():"Unknown error"],metadata:{allLogs:R,cartId:window.Zonos.cartId,href:window.location.href,storeBaseUrl:null===(s=window.Zonos.cartData)||void 0===s?void 0:s.storeBaseUrl}})}}}),{capture:!0,passive:!1}),B.checkoutSettings.disablePlaceOrderButtonActivation||s.removeAttribute("disabled"),s.setAttribute("data-zonos-checkout-attached","true"),s.matches(V)&&(s.dispatchEvent(D("click")),r(),s.remove()),s.matches(`#${W}`)&&(s.dispatchEvent(D("click")),s.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useLegacyQueryParams(){const o=new URLSearchParams(window.location.search),s=s=>{const e=o.get(s);return e&&"undefined"!==e?e:null},e={country:w(o)||n.selectedCountryCode,customerAddress1:s("customerAddress1"),customerAddress2:s("customerAddress2"),customerCity:s("customerCity"),customerEmail:s("customerEmail"),customerName:s("customerName"),customerPhone:s("customerPhone"),customerState:s("customerState"),customerZip:s("customerZip")};e.customerAddress1&&e.customerCity&&e.customerName&&e.customerPhone&&e.country?this.defaultAddress={address:{city:e.customerCity,country:e.country,line1:e.customerAddress1,line2:e.customerAddress2||"",postal_code:e.customerZip||"",state:e.customerState||""},email:e.customerEmail||"",name:e.customerName,phone:e.customerPhone}:N("Missing some query params so it can not be prefilled","info",e)}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),n=c();if(!t&&n){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==s||s(n),void e.disconnect()}const h=document.querySelector('select[name="shippingAddress.countryCode"]'),d=document.querySelector("#checkout-shipping-continue");h&&d&&(e.disconnect(),d.addEventListener("click",(async o=>{var s,e;const t=h.value;if(!t)return;if(i(t),!K(!1))return void r();const n=document.querySelector("form");if(!n)return;const c=new FormData(n),d=document.querySelector("input#addressLine1Input"),l={address1:null!==(s=c.get("shippingAddress.address1"))&&void 0!==s?s:d&&d.value,address2:c.get("shippingAddress.address2"),city:c.get("shippingAddress.city"),countryCode:c.get("shippingAddress.countryCode"),firstName:c.get("shippingAddress.firstName"),lastName:c.get("shippingAddress.lastName"),phone:c.get("shippingAddress.phone"),postalCode:c.get("shippingAddress.postalCode"),stateOrProvince:null!==(e=c.get("shippingAddress.stateOrProvince"))&&void 0!==e?e:c.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((o=>null==o)))return _("One or more shipping address field is missing",Object.entries(l)),void M({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:B.storeId}});a({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:V,onShippingAddressSessionFound:o=>{this.defaultAddress={address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:`${o.firstName} ${o.lastName}`,phone:o.phone}}}),window.Zonos&&this.useLegacyQueryParams();const o=setInterval((()=>{k.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(N("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():window.Zonos.isLegacyCheckout?this.attachCheckout():window&&(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(o)):N("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(o)}),1e4)}async setToFinishStep(o){d.step="finish",this.storybookPaymentStatusOverride=o}async mockCheckoutSession(o){v(o)}async handleCustomerInfoContinue(){this.submitLoading=!0,await y();const o=setInterval((()=>{!d.landedCostData&&k.isFetchingLandedCost||(d.landedCostData&&(O({currency:d.currency}),C()),this.submitLoading=!1,clearInterval(o))}),500)}async handleShippingContinue(){this.submitLoading=!0,setTimeout((()=>{C(),this.submitLoading=!1}),500)}handleInventoryCheckDialogCancel(){d.inventoryCheckErrorMessage=null}handleInventoryCheckDialogConfirm(){d.inventoryCheckErrorMessage=null,this.closeDialogHandler({confirmed:!0})}async handleStripePaymentContinue(){k.hasPaymentError=!1,this.submitLoading=!0,d.inventoryCheckErrorMessage=null;try{d.inventoryCheckErrorMessage=await x()}catch(o){d.inventoryCheckErrorMessage=b("Unable to check inventory. Please try again.")}if(d.inventoryCheckErrorMessage)this.submitLoading=!1;else{try{await S(),C(),z()}catch(o){_(o),k.hasPaymentError=!0}this.submitLoading=!1}}async handleFinishClick(){if(I(),this.preview)return d.step="customer-info",void await this.init();if(u(),window.Zonos.isLegacyCheckout&&window.Zonos.cartData){const o=window.Zonos.cartData.storeBaseUrl;return void(window.location.href=o)}const o=window.location.href.split("?")[0],s=$();this.open=!1,s||(window.history.replaceState(window.history.state,document.title,o),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=L(this.appearanceSettingsOverride.theme))}handleAddressChange(){I()}componentWillLoad(){this.init(),this.isMobile=H(this.mobile),this.handleAppearanceSettingsOverrideChange(),this.onChangeLocaleListener=A("selectedLocale",(()=>{this.applyStripeTheme()})),N(`mobile: ${this.isMobile}`)}disconnectedCallback(){I(),u(),this.onChangeLocaleListener()}render(){var o;const c="finish"!==d.step&&"error"!==d.step&&!k.stripeElements||k.isFetchingSession,{colorPrimary:i,colorSecondary:r,logoUrl:a,style:h}=P(B.appearance,this.appearanceSettingsOverride),l="ENABLED"===B.appearance.zonosAttribution,u=B.appearance.theme,m=i&&F(i)?"DARK":"LIGHT",z=this.isMobile?u:m,p=this.isMobile?void 0:r,{customMessages:g}=n,f=null===(o=g.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,w=this.getCurrentLocalePageEnum(),v=g.filter((o=>o.pageName===w)),y=()=>{const o=this.preview?`${a}?timestamp=${Date.now()}`:a;return s("div",{class:"zonos--logo"},o&&s("img",{alt:`${B.organizationName} logo`,src:o}))},C=$(),x=()=>{const o=new URLSearchParams(window.location.search),e=o.get("zonosQaUrl"),t=o.get("zonosDebug");return s("zonos-v-stack",null,s("div",{class:"zonos--logo-wrapper"},y(),C&&s("zonos-badge",{badgeColor:"orange",size:"small"},b("Test mode")),"1"===t&&s("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),e&&s("zonos-badge",{badgeColor:"purple",size:"small"},e)),s("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--zonos-elements-gray-0":null}),v.map((o=>s("zonos-custom-message",{icon:Q,message:o.message}))))},S=()=>d.checkoutSessionTimeoutShow?s("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:b("Your checkout session has expired. Please reload the page to continue."),restStateTitle:b("Session timed out"),restStateType:"Warning"},s("zonos-button",{onClick:()=>this.reloadCheckoutSession(),variant:"primary"},b("Reload"))):s("div",{class:"zonos--content",style:{"--border-radius":U({overrideBorderStyle:h})}},"finish"!==d.step&&"error"!==d.step&&s(t,null,s("div",{class:"zonos--left","data-theme":z,style:{"--primary-color":this.isMobile?"":i}},!this.isMobile&&x(),"customer-info"===d.step&&s("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.defaultAddress,isMobile:this.isMobile,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:p}),"shipping"===d.step&&s("zonos-shipping",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:p}),"payment"===d.step&&s("zonos-checkout-payment",{continueLoading:this.submitLoading,onContinueClicked:async()=>{await this.handleStripePaymentContinue()},submitBtnColor:p})),s("div",{class:"zonos--right","data-theme":u},this.isMobile&&x(),!this.isLegacyCheckout&&s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{"aria-label":"Close checkout dialog",content:q}),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",{submitBtnColor:p}),s("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Q,message:f})))),s("zonos-cart-restricted-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:Q,message:f}))))),("finish"===d.step||"error"===d.step)&&s("div",{class:"zonos--done","data-theme":u},s("div",{class:"zonos--header"},y(),s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{"aria-label":"Close checkout dialog",content:q}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:u})),s("zonos-checkout-finish",{borderRadius:h,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===d.step&&d.error?Object.assign(Object.assign({},d.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),s("zonos-checkout-footer",{"data-theme":u,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return s(e,{class:E(["zonos--checkout zonos--elements",l&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?S():s("zonos-dialog",{borderStyle:h,"data-theme":u,height:"980px",isLoading:c,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},S()),s("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:b("Don't close"),dialogConfirmBtnText:b("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:b("Would you like to close checkout and return to the site?"),dialogTitle:b("Are you sure?"),onCancelClicked:()=>{this.confirmDialogOpen=!1},onConfirmClicked:()=>this.closeDialogHandler({confirmed:!0})}),s("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:b("Return to cart"),dialogIntent:"danger",dialogOpen:!!d.inventoryCheckErrorMessage,dialogSubtitle:d.inventoryCheckErrorMessage,dialogTitle:b("Couldn't place order"),dialogType:"alert",onCancelClicked:()=>{this.handleInventoryCheckDialogCancel()},onConfirmClicked:()=>this.handleInventoryCheckDialogConfirm()}))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"]}}};Y.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{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--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;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:24px;top:24px;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-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}";export{Y as zonos_checkout}
|