@zonos/elements 1.3.189 → 1.3.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cjs/{CheckoutConfig-f1442a60.js → CheckoutConfig-4afc683b.js} +2 -0
  2. package/dist/cjs/index.cjs.js +33 -8
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/zonos-address_11.cjs.entry.js +4 -18
  5. package/dist/cjs/zonos-checkout.cjs.entry.js +14 -1
  6. package/dist/cjs/zonos-elements.cjs.js +1 -1
  7. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +31 -1
  8. package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -9
  9. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -9
  10. package/dist/collection/scripts/_zonosBase.js +25 -1
  11. package/dist/collection/types/checkout/CheckoutConfig.js +1 -0
  12. package/dist/esm/{CheckoutConfig-5479d192.js → CheckoutConfig-eb7d6954.js} +2 -1
  13. package/dist/esm/index.js +33 -9
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/zonos-address_11.entry.js +4 -18
  16. package/dist/esm/zonos-checkout.entry.js +14 -1
  17. package/dist/esm/zonos-elements.js +1 -1
  18. package/dist/esm-es5/{CheckoutConfig-5479d192.js → CheckoutConfig-eb7d6954.js} +1 -1
  19. package/dist/esm-es5/index.js +1 -1
  20. package/dist/esm-es5/loader.js +1 -1
  21. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  22. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  23. package/dist/esm-es5/zonos-elements.js +1 -1
  24. package/dist/scripts/index.d.ts +13 -0
  25. package/dist/scripts/index.js +1 -1
  26. package/dist/scripts/loadZonos.js +1 -1
  27. package/dist/scripts/zonos.js +1 -1
  28. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +4 -0
  29. package/dist/types/components.d.ts +4 -0
  30. package/dist/types/scripts/_zonosBase.d.ts +9 -0
  31. package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -0
  32. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  33. package/dist/zonos-elements/index.esm.js +1 -1
  34. package/dist/zonos-elements/p-0347d209.entry.js +1 -0
  35. package/dist/zonos-elements/p-3f1a2d31.js +1 -0
  36. package/dist/zonos-elements/{p-8ee34712.system.js → p-5e1b2654.system.js} +1 -1
  37. package/dist/zonos-elements/p-682e09fc.system.entry.js +1 -0
  38. package/dist/zonos-elements/p-97e330cd.entry.js +1 -0
  39. package/dist/zonos-elements/p-bd0dc205.system.js +1 -0
  40. package/dist/zonos-elements/p-df695903.system.entry.js +1 -0
  41. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
  42. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/zonos-elements/p-0252b8e9.system.js +0 -1
  45. package/dist/zonos-elements/p-04a0e38b.system.entry.js +0 -1
  46. package/dist/zonos-elements/p-54fdf40b.entry.js +0 -1
  47. package/dist/zonos-elements/p-ddc464c4.entry.js +0 -1
  48. package/dist/zonos-elements/p-ee99cf66.system.entry.js +0 -1
  49. package/dist/zonos-elements/p-fe253cc1.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function i(e){try{a(n.next(e))}catch(e){s(e)}}function c(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?t(e.value):r(e.value).then(i,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(t=0)),t)try{if(n=1,r&&(s=c[0]&2?r["return"]:c[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;if(r=0,s)c=[c[0]&2,s.value];switch(c[0]){case 0:case 1:s=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1];s=c;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(c);break}if(s[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,s;n<r;n++){if(s||!(n in o)){if(!s)s=Array.prototype.slice.call(o,0,n);s[n]=o[n]}}return e.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,F as Fragment}from"./index-a457c60c.js";import{l as localizationStore,s as stripeStoreGetDomesticShippingSession,a as localizationStoreUpdateSelectedCountryCode,b as stripeStoreCleanupDomesticShippingSession,c as stripeStoreSaveDomesticShippingSession,i as initStripeElements,d as stripeStoreRetrievePayment,e as cartStore,f as stripeStore,g as cartStoreUpdateItems,h as cartStoreReset,j as cartStoreResetTabItems,k as cartStoreClearCheckoutInterval,m as stripeStoreInitCheckoutSession,n as stripeStoreGetPaymentIntent,o as cartStoreStartCheckoutInterval,t as trackConversionEvent,p as getCheckoutSessionBody,q as cartStoreUpdateToErrorState,r as translate,u as getZCountryUrlParam,v as cartStoreSetCheckoutSession,w as stripeStorePrefetchLandedCost,x as cartStoreNextStep,y as stripeStoreUpdateCheckoutSessionBaseCurrency,z as stripeStoreHandleInventoryCheck,A as stripeStoreConfirmPayment,B as stripeStoreHandleInventoryRefund,C as stripeStoreReset,D as localizationStoreOnUpdate,E as currencyFormat}from"./cart-f5c12be6.js";import{p as paypalStoreHasPaypalEnabled,s as submitGtag,a as paypalInitScript,b as paypalStore}from"./paypal-594f49e9.js";import{z as zonosStore,g as getZonosStoreTheme,m as mergeConfig}from"./zonosStore-1ce34e04.js";import{h as handleFetch,l as log,b as logError,s as sendErrorLog,c as getElapsedTime,d as allLogs,e as getAdditionalLogMetadata,g as getIsTestMode,j as jsonParse,a as getIsStagingMode,i as isCheckoutMobile}from"./handleFetch-621e45bc.js";import{c as classes}from"./classes-0d95c529.js";import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getBorderRadius}from"./getBorderRadius-a9a48f79.js";import{i as isDarkColor}from"./isDarkColor-62cbddb5.js";import{s as styles}from"./styles-6fc2fad9.js";import{_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-5479d192.js";import{R as RemoveIcon}from"./RemoveIcon-9dc5dd1a.js";var buildCartItemsByTempCart=function(e){var o=e.items.map((function(e){return{amount:e.amount,attributes:e.attributes||[],countryOfOrigin:e.countryOfOrigin||undefined,currencyCode:e.currencyCode,description:e.description||"",imageUrl:e.imageUrl||"",itemType:e.itemType||"PHYSICAL_GOOD",measurements:e.measurements||[],name:e.name||e.description||"",productId:e.productId||"",quantity:e.quantity||0,sku:e.sku||""}}))||[];return{adjustments:e.adjustments,cartItems:o}};var isStoreDiscountEnabled=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,handleFetch("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var isDisabledCountry=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return true}if(localizationStore.isDisabledCountry){if(e){log("Checkout: disabled country")}return true}return false};var isShippableCountry=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return false}if(!localizationStore.isShippableCountry){if(e){log("Checkout: not shippable country")}return false}return true};var watchBigcommerceDomesticCheckout=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,s,i,c;return __generator(this,(function(a){e=document.querySelector(o);r=stripeStoreGetDomesticShippingSession();if(!e&&r){s=document.createElement("button");s.style.display="none";s.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(s);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}i=document.querySelector('select[name="shippingAddress.countryCode"]');c=document.querySelector("#checkout-shipping-continue");if(!i||!c){return[2]}n.disconnect();c.addEventListener("click",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,n,r,s,c,a;return __generator(this,(function(u){n=i.value;if(!n){return[2]}localizationStoreUpdateSelectedCountryCode(n);if(!isShippableCountry(false)){stripeStoreCleanupDomesticShippingSession();return[2]}r=document.querySelector("form");if(!r){return[2]}s=new FormData(r);c=document.querySelector("input#addressLine1Input");a={address1:(o=s.get("shippingAddress.address1"))!==null&&o!==void 0?o:c&&c.value,address2:s.get("shippingAddress.address2"),city:s.get("shippingAddress.city"),countryCode:s.get("shippingAddress.countryCode"),firstName:s.get("shippingAddress.firstName"),lastName:s.get("shippingAddress.lastName"),phone:s.get("shippingAddress.phone"),postalCode:s.get("shippingAddress.postalCode"),stateOrProvince:(t=s.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:s.get("shippingAddress.stateOrProvinceCode")};if(Object.values(a).some((function(e){return e===undefined||e===null}))){logError("One or more shipping address field is missing",Object.entries(a));void sendErrorLog({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(a))],metadata:{storeId:zonosStore.storeId}});return[2]}stripeStoreSaveDomesticShippingSession({address1:a.address1,address2:a.address2,city:a.city,countryCode:a.countryCode,firstName:a.firstName,lastName:a.lastName,phone:a.phone,postalCode:a.postalCode,state:a.stateOrProvince});e.preventDefault();e.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var numberOfFailures=0;var sendBulkLoadTimeApiLog=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}log("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,handleFetch("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);numberOfFailures++;if(numberOfFailures>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var sendLoadCheckoutFacadeLog=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=getElapsedTime().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:allLogs},getAdditionalLogMetadata()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void handleFetch("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var sendLoadNativeCheckoutLog=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:allLogs},getAdditionalLogMetadata()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void handleFetch("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var getTempCartById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o,t,n,r,s;var i=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=getIsTestMode();return[4,handleFetch("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:i},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;s=!r||n.length;if(!(s&&c))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getTempCartById({cartId:i,retries:c-1})];case 3:if(s){return[2,null]}return[2,r]}}))}))};var setupCartData=function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:o=_getIsValidCartId(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getTempCartById({cartId:e,retries:5})];case 1:r=s.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var MessageIcon='<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 zonosCheckoutCss=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var ZonosCheckoutStyle0=zonosCheckoutCss;var CHECKOUT_SESSION_TIMEOUT=90*60*1e3;var ORDER_DUPLICATION_NOTIFICATION_EXPIRATION=6*60*60*1e3;var ZonosCheckout=function(){function e(e){var o=this;registerInstance(this,e);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.applyStripeTheme=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||zonosStore.appearance.theme;return[4,initStripeElements({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:paypalStoreHasPaypalEnabled()})];case 1:s.sent();return[2]}}))}))};this.handleCartExpiredCheck=function(){var e;if(getIsTestMode()){log("Not checking for cart expiration in test mode");return false}if(!zonosStore.checkoutSettings.defaultCartExpiration||!((e=window.Zonos.cartData)===null||e===void 0?void 0:e.createdAt)){return false}var t=new Date(window.Zonos.cartData.createdAt).getTime();var n=(new Date).getTime();var r=n-t;var s=Math.floor(r/1e3);log("currentTime: ".concat(n," | cartCreatedAt: ").concat(t));log("Cart has been created for ".concat(s/60," minutes"));if(zonosStore.checkoutSettings.defaultCartExpiration){if(s>zonosStore.checkoutSettings.defaultCartExpiration){o.isCartExpired=true;return true}}return false};this.checkStripePaymentIntentStatus=function(e){return __awaiter(o,[e],void 0,(function(e){var o,t,n,r,s,i,c,a,u;var l=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=l===null||l===void 0?void 0:l.matches("#".concat(checkoutHiddenBtnSelector));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");s=n.get("zonosCheckoutSessionId");if(!o){log("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}log("Payment intent exist, checking stripe payment intent status");if(!r){log("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,stripeStoreRetrievePayment({clientSecret:r})];case 1:i=e.sent(),c=i.error,a=i.status;u=new URLSearchParams(window.location.search).get("redirect_status");if(u){if(!c){log("Payment intent is succeeded or in a good state to move forward, show success screen")}else{log("Payment intent failed, show status from error")}this.open=true;cartStore.checkoutSessionId=s;stripeStore.clientSecret=r;void this.setToFinishStep(a);return[2,{shouldAllowOrder:false}]}if(!t){log("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}log("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(cartStore.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=cartStore.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(o.defaultCustomerProfileAddress.length){return o.defaultCustomerProfileAddress}if(Array.isArray(o.defaultAddress)&&o.defaultAddress.length){return o.defaultAddress}if(!Array.isArray(o.defaultAddress)&&typeof o.defaultAddress==="object"){return[o.defaultAddress]}return o.defaultAddressParams};this.appearanceSettingsOverride=undefined;this.preview=false;this.hiddenMode=false;this.mobile=false;this.overrideStagingMode=undefined;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=stripeStore.clientSecret;this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void cartStoreUpdateItems({adjustments:cartStore.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;submitGtag("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&cartStore.step==="finish"){cartStoreReset()}cartStore.step="customer-info";cartStoreResetTabItems();cartStoreClearCheckoutInterval();(t=(o=zonosStore.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,s,i,c,r,a,i,c,c,u,l,i,d;return __generator(this,(function(h){switch(h.label){case 0:if(!(typeof zonosStore.checkoutSettings.createCartId==="function"))return[3,4];log('"createCartId" is provided, start building cart');return[4,zonosStore.checkoutSettings.createCartId()];case 1:e=h.sent();o=void 0;if(typeof e==="object"){log("object detected, use cartId and prefill address from createCartId");o=e.cartId;this.useShippingDataFromCreateCartId(e.shippingData);cartStore.customerAuthenticationToken=e.customerAuthenticationToken||null}else{o=e}window.Zonos.cartId=o;return[4,setupCartData(o)];case 2:t=h.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){logError("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=this.handleCartExpiredCheck();if(r){return[2,false]}s=buildCartItemsByTempCart(n),i=s.adjustments,c=s.cartItems;return[4,cartStoreUpdateItems({adjustments:i,cartItems:c})];case 3:h.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];log("tempCartUUID is provided, start building cart");r=this.handleCartExpiredCheck();if(r){return[2,false]}a=buildCartItemsByTempCart(window.Zonos.cartData),i=a.adjustments,c=a.cartItems;return[4,cartStoreUpdateItems({adjustments:i,cartItems:c})];case 5:h.sent();return[3,9];case 6:if(!(zonosStore.checkoutSettings.buildCartDetail&&localizationStore.selectedCountryCode))return[3,9];log("build cart detail");return[4,zonosStore.checkoutSettings.buildCartDetail({countryCode:localizationStore.selectedCountryCode,currencyCode:localizationStore.targetCurrency})];case 7:c=h.sent();u=c.filter((function(e){return e.amount>=0}));l=c.filter((function(e){return e.amount<0}));i=l.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,cartStoreUpdateItems({adjustments:i,cartItems:u})];case 8:h.sent();h.label=9;case 9:if(!!cartStore.checkoutSessionId)return[3,11];return[4,stripeStoreInitCheckoutSession()];case 10:d=h.sent();log("stripeStoreInitCheckoutSession: ".concat(d));if(!d){return[2,false]}h.label=11;case 11:if(!cartStore.isStagingMode){void stripeStoreGetPaymentIntent()}return[4,this.applyStripeTheme()];case 12:h.sent();this.isRedirectAfterOrder=zonosStore.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!cartStore.externalConfirmationPageURL;return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=jsonParse(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;log("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||ORDER_DUPLICATION_NOTIFICATION_EXPIRATION;if(o>t){log("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;log("=== Showing order duplication confirmation","warn")};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!cartStore.checkoutSessionId){return}void handleFetch("/api/zonos-elements/update-checkout-session-metadata",{body:{id:cartStore.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||zonosStore.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=zonosStore.checkoutSettings.placeOrderButtonSelector;var t=zonosStore.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;log("attach checkout ".concat(o));log("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData){return}var n=[o,t,"#".concat(domesticRedirectedBtnSelector),"#".concat(checkoutHiddenBtnSelector)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}log("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,s,i,c,a,u,l,d,h,f;return __generator(this,(function(m){switch(m.label){case 0:r=performance.now();s=t&&n.matches(t);i=n.matches("#".concat(domesticRedirectedBtnSelector))||n.matches("#".concat(checkoutHiddenBtnSelector));if(!window.Zonos.isLegacyCheckout&&(!isShippableCountry()||isDisabledCountry())&&!s&&!i){return[2]}o.preventDefault();o.stopPropagation();log("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:c=m.sent().shouldAllowOrder;if(!c){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void sendBulkLoadTimeApiLog()}),2e3)}stripeStore.isFetchingSession=true;this.open=true;m.label=2;case 2:m.trys.push([2,5,,6]);return[4,this.buildCartAndInit()];case 3:a=m.sent();if(this.isCartExpired){throw new Error("This shopping cart is expired")}if(!a){throw new Error("Error building cart")}cartStoreStartCheckoutInterval({isPreview:this.preview,sessionTimeout:CHECKOUT_SESSION_TIMEOUT});submitGtag("zonos-checkout-start");u=cartStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:u,eventName:"checkout_open"});return[4,isStoreDiscountEnabled()];case 4:l=m.sent().enabled;cartStore.shouldHideDiscountInput=!l;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void sendLoadCheckoutFacadeLog()}else{d=performance.now();h=d-r;void sendLoadNativeCheckoutLog({loadTime:h})}return[3,6];case 5:f=m.sent();stripeStore.isFetchingSession=false;logError(f);if(this.isCartExpired){return[2]}void sendErrorLog({endpoint:"Error creating Checkout",errors:[f instanceof Error?f.toString():"Unknown error"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionBody:getCheckoutSessionBody(),href:window.location.href,storeBaseUrl:((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||zonosStore.onlineStoreSettings.url}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[3,6];case 6:return[2]}}))}))}),{capture:true,passive:false});if(!zonosStore.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(domesticRedirectedBtnSelector))){n.dispatchEvent(createCustomEvent("click"));stripeStoreCleanupDomesticShippingSession();n.remove()}if(n.matches("#".concat(checkoutHiddenBtnSelector))){n.dispatchEvent(createCustomEvent("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}log("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,s=e.customerEmail,i=e.customerName,c=e.customerPhone,a=e.customerState,u=e.customerZip;var l=new URLSearchParams(window.location.search);var d=r||getZCountryUrlParam(l)||localizationStore.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:d,customerEmail:s,customerName:i,customerPhone:c,customerState:a,customerZip:u})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);log("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=getZCountryUrlParam(e)||localizationStore.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var s=o("customerAddress1");var i=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var l=o("customerState");this.applyPrefillAddress({customerAddress1:s,customerAddress2:i,customerCity:n,customerCountry:t,customerEmail:r,customerName:c,customerPhone:a,customerState:l,customerZip:u})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var s=e.customerEmail||"";var i=e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!i||!c||!t){log("Missing required query params so it can not be prefilled","info",[!o&&"line1",!i&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&localizationStore.shippingZoneCountries&&!(t in localizationStore.shippingZoneCountries)){log('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:s,name:i,phone:c}];log("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){cartStore.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){stripeStore.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;cartStore.isStagingMode=getIsStagingMode();if(typeof this.overrideStagingMode!=="undefined"){cartStore.isStagingMode=this.overrideStagingMode}watchBigcommerceDomesticCheckout({domesticRedirectedBtnSelector:domesticRedirectedBtnSelector,onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){stripeStore.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){log("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}log("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){cartStore.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){cartStoreSetCheckoutSession(e);return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o;var t=this;return __generator(this,(function(n){switch(n.label){case 0:submitGtag("zonos-checkout-customer-info");e=cartStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,stripeStorePrefetchLandedCost()];case 1:n.sent();o=setInterval((function(){if(cartStore.landedCostData||!stripeStore.isFetchingLandedCost){if(cartStore.landedCostData){void paypalInitScript({currency:cartStore.currency});cartStoreNextStep()}t.submitLoading=false;clearInterval(o)}}),500);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(o){this.submitLoading=true;setTimeout((function(){cartStoreNextStep();e.submitLoading=false}),500);return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){cartStore.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:e=stripeStore.checkoutSettlementCurrency==="USD";if(e&&stripeStore.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;paypalStore.paypalErrorMessage=null;stripeStore.hasPaymentError=false;this.submitLoading=true;cartStore.inventoryCheckErrorMessage=null;return[4,stripeStoreUpdateCheckoutSessionBaseCurrency()];case 1:o=s.sent();if(!o){stripeStore.hasPaymentError=true;stripeStore.customErrorMessage=translate("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:stripeStore.checkoutSettlementCurrency});this.submitLoading=false;return[2]}s.label=2;case 2:s.trys.push([2,4,,5]);t=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 3:t.inventoryCheckErrorMessage=s.sent();return[3,5];case 4:n=s.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,5];case 5:if(cartStore.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}s.label=6;case 6:s.trys.push([6,8,,9]);return[4,stripeStoreConfirmPayment()];case 7:s.sent();cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,9];case 8:r=s.sent();logError(r);submitGtag("zonos-checkout-payment-fail");stripeStore.hasPaymentError=true;if(stripeStore.shouldInventoryRefund){void stripeStoreHandleInventoryRefund();stripeStore.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:stripeStoreReset();if(!this.preview)return[3,2];cartStore.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:cartStoreReset();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||zonosStore.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=isCheckoutMobile(this.mobile);void this.applyStripeTheme();log("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=isCheckoutMobile(this.mobile);void this.applyStripeTheme();log("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=getZonosStoreTheme(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){stripeStoreReset()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){log("No customer profile","info");this.defaultCustomerProfileAddress=[];return}log("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=stripeStore.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=stripeStore.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){log("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=isCheckoutMobile(this.mobile);this.isIframed=window.self!==window.top;log("iframed: ".concat(this.isIframed));this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=localizationStoreOnUpdate("selectedLocale",(function(){void e.applyStripeTheme()}));log("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){stripeStoreReset();cartStoreReset();this.onChangeLocaleListener()};e.prototype.render=function(){var e=this;var o,t,n,r;this.customerProfile=stripeStore.customerProfile;this.clientSecret=stripeStore.clientSecret;if(stripeStore.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}var s=cartStore.step!=="finish"&&cartStore.step!=="error"&&!stripeStore.stripeElements||stripeStore.isFetchingSession;var i=mergeConfig(zonosStore.appearance,this.appearanceSettingsOverride||null),c=i.colorPrimary,a=i.colorSecondary,u=i.logoUrl,l=i.style;var d=zonosStore.appearance.zonosAttribution==="ENABLED";var f=zonosStore.appearance.theme;var m=c&&isDarkColor(c)?"DARK":"LIGHT";var p=this.isMobile?f:m;var g=!this.isMobile?a:undefined;var v=localizationStore.customMessages;var z=(o=v.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var k=this.getCurrentLocalePageEnum();var S=v.filter((function(e){return e.pageName===k}));var w=this.getBaseCurrencySettlementInfo();var C=function(){var o=e.preview?"".concat(u,"?timestamp=").concat(Date.now()):u;return h("div",{class:"zonos--logo"},o&&h("img",{alt:"".concat(zonosStore.organizationName," logo"),src:o}))};var b=getIsTestMode();var y=function(){var o=new URLSearchParams(window.location.search);var t=o.get("zonosQaUrl");var n=o.get("zonosDebug");var r=o.get("zonosE2ETest");var s=e.overrideStagingMode||getIsStagingMode();return h("zonos-v-stack",null,h("div",{class:"zonos--logo-wrapper"},C(),b&&h("zonos-badge",{badgeColor:"orange",size:"small"},translate("Test mode")),s&&h("zonos-badge",{badgeColor:"red",size:"small"},translate("Staging mode")),n==="1"&&h("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&h("zonos-badge",{badgeColor:"purple",size:"small"},t),r&&h("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),h("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return h("zonos-custom-message",{icon:MessageIcon,message:e.message})})))};var _=function(){if(cartStore.checkoutSessionTimeoutShow){return h("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:translate("Your checkout session has expired. Please reload the page to continue."),restStateTitle:translate("Session timed out"),restStateType:"Warning"},h("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},translate("Reload")))}return h("div",{class:"zonos--content",style:{"--zonos--border-radius":getBorderRadius({overrideBorderStyle:l})}},cartStore.step!=="finish"&&cartStore.step!=="error"&&h(Fragment,null,h("div",{class:"zonos--left","data-theme":p,style:styles({"--zonos--primary-color":!e.isMobile?c:undefined})},!e.isMobile&&y(),cartStore.step==="customer-info"&&h("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:g}),cartStore.step==="shipping"&&h("zonos-shipping",{continueLoading:e.submitLoading,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:g}),cartStore.step==="payment"&&h("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:g})),h("div",{class:"zonos--right","data-theme":f},e.isMobile&&y(),h("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&h("zonos-currency-toggle",null),!e.isLegacyCheckout&&h("zonos-button",{class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),h("div",{class:"flex--wrapper"},h("div",{class:"zonos--wrapper"},h("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),h("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},h("zonos-cart-items",null),e.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-cart-subtotal",{submitBtnColor:g}),h("zonos-custom-message",{class:"zonos--checkout-default-message",icon:MessageIcon,message:z})))),h("zonos-cart-restricted-items",null),!e.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-cart-subtotal",null),h("zonos-custom-message",{class:"zonos--checkout-default-message",icon:MessageIcon,message:z}))))),(cartStore.step==="finish"||cartStore.step==="error")&&h("div",{class:"zonos--done","data-theme":f},h("div",{class:"zonos--header"},C(),!e.isRedirectAfterOrder&&h("zonos-button",{class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:f})),h("zonos-checkout-finish",{borderRadius:l,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:cartStore.step==="error"&&!!cartStore.error?Object.assign(Object.assign({},cartStore.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),h("zonos-checkout-footer",{"data-theme":f,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return h(Host,{class:classes(["zonos--checkout zonos--elements",d&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?_():h("zonos-dialog",{borderStyle:l,"data-theme":f,height:"980px",isLoading:s,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},_()),h("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:translate("Don't close"),dialogConfirmBtnText:translate("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:translate("Would you like to close checkout and return to the site?"),dialogTitle:translate("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),h("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:translate("Return to merchant site"),dialogConfirmBtnText:translate("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((t=this.placedOrderInfo)===null||t===void 0?void 0:t.zonosOrderNumber)?translate("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):translate("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((n=this.placedOrderInfo)===null||n===void 0?void 0:n.time)||null),time:this.formatTime(((r=this.placedOrderInfo)===null||r===void 0?void 0:r.time)||null)}),dialogTitle:translate("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),h("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:translate("Return to cart"),dialogIntent:"danger",dialogOpen:!!cartStore.inventoryCheckErrorMessage,dialogSubtitle:cartStore.inventoryCheckErrorMessage,dialogTitle:translate("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),w&&h("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:translate("Cancel"),dialogConfirmBtnText:translate("Pay [orderTotal]",{orderTotal:currencyFormat({amount:w.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:translate("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:translate("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),h("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:translate("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:translate("You are being sent back to the shop to re-add items to your cart."),dialogTitle:translate("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}();ZonosCheckout.style=ZonosCheckoutStyle0;export{ZonosCheckout as zonos_checkout};
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function i(e){try{a(n.next(e))}catch(e){s(e)}}function c(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?t(e.value):r(e.value).then(i,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(t=0)),t)try{if(n=1,r&&(s=c[0]&2?r["return"]:c[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;if(r=0,s)c=[c[0]&2,s.value];switch(c[0]){case 0:case 1:s=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1];s=c;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(c);break}if(s[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,s;n<r;n++){if(s||!(n in o)){if(!s)s=Array.prototype.slice.call(o,0,n);s[n]=o[n]}}return e.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,F as Fragment}from"./index-a457c60c.js";import{l as localizationStore,s as stripeStoreGetDomesticShippingSession,a as localizationStoreUpdateSelectedCountryCode,b as stripeStoreCleanupDomesticShippingSession,c as stripeStoreSaveDomesticShippingSession,i as initStripeElements,d as stripeStoreRetrievePayment,e as cartStore,f as stripeStore,g as cartStoreUpdateItems,h as cartStoreReset,j as cartStoreResetTabItems,k as cartStoreClearCheckoutInterval,m as stripeStoreInitCheckoutSession,n as stripeStoreGetPaymentIntent,o as cartStoreStartCheckoutInterval,t as trackConversionEvent,p as getCheckoutSessionBody,q as cartStoreUpdateToErrorState,r as translate,u as getZCountryUrlParam,v as cartStoreSetCheckoutSession,w as stripeStorePrefetchLandedCost,x as cartStoreNextStep,y as stripeStoreUpdateCheckoutSessionBaseCurrency,z as stripeStoreHandleInventoryCheck,A as stripeStoreConfirmPayment,B as stripeStoreHandleInventoryRefund,C as stripeStoreReset,D as localizationStoreOnUpdate,E as currencyFormat}from"./cart-f5c12be6.js";import{p as paypalStoreHasPaypalEnabled,s as submitGtag,a as paypalInitScript,b as paypalStore}from"./paypal-594f49e9.js";import{z as zonosStore,g as getZonosStoreTheme,m as mergeConfig}from"./zonosStore-1ce34e04.js";import{h as handleFetch,l as log,b as logError,s as sendErrorLog,c as getElapsedTime,d as allLogs,e as getAdditionalLogMetadata,g as getIsTestMode,j as jsonParse,a as getIsStagingMode,i as isCheckoutMobile}from"./handleFetch-621e45bc.js";import{c as classes}from"./classes-0d95c529.js";import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getBorderRadius}from"./getBorderRadius-a9a48f79.js";import{i as isDarkColor}from"./isDarkColor-62cbddb5.js";import{s as styles}from"./styles-6fc2fad9.js";import{_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-eb7d6954.js";import{R as RemoveIcon}from"./RemoveIcon-9dc5dd1a.js";var buildCartItemsByTempCart=function(e){var o=e.items.map((function(e){return{amount:e.amount,attributes:e.attributes||[],countryOfOrigin:e.countryOfOrigin||undefined,currencyCode:e.currencyCode,description:e.description||"",imageUrl:e.imageUrl||"",itemType:e.itemType||"PHYSICAL_GOOD",measurements:e.measurements||[],name:e.name||e.description||"",productId:e.productId||"",quantity:e.quantity||0,sku:e.sku||""}}))||[];return{adjustments:e.adjustments,cartItems:o}};var isStoreDiscountEnabled=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,handleFetch("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var isDisabledCountry=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return true}if(localizationStore.isDisabledCountry){if(e){log("Checkout: disabled country")}return true}return false};var isShippableCountry=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return false}if(!localizationStore.isShippableCountry){if(e){log("Checkout: not shippable country")}return false}return true};var watchBigcommerceDomesticCheckout=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,s,i,c;return __generator(this,(function(a){e=document.querySelector(o);r=stripeStoreGetDomesticShippingSession();if(!e&&r){s=document.createElement("button");s.style.display="none";s.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(s);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}i=document.querySelector('select[name="shippingAddress.countryCode"]');c=document.querySelector("#checkout-shipping-continue");if(!i||!c){return[2]}n.disconnect();c.addEventListener("click",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,n,r,s,c,a;return __generator(this,(function(u){n=i.value;if(!n){return[2]}localizationStoreUpdateSelectedCountryCode(n);if(!isShippableCountry(false)){stripeStoreCleanupDomesticShippingSession();return[2]}r=document.querySelector("form");if(!r){return[2]}s=new FormData(r);c=document.querySelector("input#addressLine1Input");a={address1:(o=s.get("shippingAddress.address1"))!==null&&o!==void 0?o:c&&c.value,address2:s.get("shippingAddress.address2"),city:s.get("shippingAddress.city"),countryCode:s.get("shippingAddress.countryCode"),firstName:s.get("shippingAddress.firstName"),lastName:s.get("shippingAddress.lastName"),phone:s.get("shippingAddress.phone"),postalCode:s.get("shippingAddress.postalCode"),stateOrProvince:(t=s.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:s.get("shippingAddress.stateOrProvinceCode")};if(Object.values(a).some((function(e){return e===undefined||e===null}))){logError("One or more shipping address field is missing",Object.entries(a));void sendErrorLog({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(a))],metadata:{storeId:zonosStore.storeId}});return[2]}stripeStoreSaveDomesticShippingSession({address1:a.address1,address2:a.address2,city:a.city,countryCode:a.countryCode,firstName:a.firstName,lastName:a.lastName,phone:a.phone,postalCode:a.postalCode,state:a.stateOrProvince});e.preventDefault();e.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var numberOfFailures=0;var sendBulkLoadTimeApiLog=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}log("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,handleFetch("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);numberOfFailures++;if(numberOfFailures>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var sendLoadCheckoutFacadeLog=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=getElapsedTime().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:allLogs},getAdditionalLogMetadata()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void handleFetch("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var sendLoadNativeCheckoutLog=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:allLogs},getAdditionalLogMetadata()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void handleFetch("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var getTempCartById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o,t,n,r,s;var i=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=getIsTestMode();return[4,handleFetch("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:i},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;s=!r||n.length;if(!(s&&c))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getTempCartById({cartId:i,retries:c-1})];case 3:if(s){return[2,null]}return[2,r]}}))}))};var setupCartData=function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:o=_getIsValidCartId(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getTempCartById({cartId:e,retries:5})];case 1:r=s.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var MessageIcon='<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 zonosCheckoutCss=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var ZonosCheckoutStyle0=zonosCheckoutCss;var CHECKOUT_SESSION_TIMEOUT=90*60*1e3;var ORDER_DUPLICATION_NOTIFICATION_EXPIRATION=6*60*60*1e3;var ZonosCheckout=function(){function e(e){var o=this;registerInstance(this,e);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.applyStripeTheme=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||zonosStore.appearance.theme;return[4,initStripeElements({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:paypalStoreHasPaypalEnabled()})];case 1:s.sent();return[2]}}))}))};this.handleCartExpiredCheck=function(){var e;if(getIsTestMode()){log("Not checking for cart expiration in test mode");return false}if(!zonosStore.checkoutSettings.defaultCartExpiration||!((e=window.Zonos.cartData)===null||e===void 0?void 0:e.createdAt)){return false}var t=new Date(window.Zonos.cartData.createdAt).getTime();var n=(new Date).getTime();var r=n-t;var s=Math.floor(r/1e3);log("currentTime: ".concat(n," | cartCreatedAt: ").concat(t));log("Cart has been created for ".concat(s/60," minutes"));if(zonosStore.checkoutSettings.defaultCartExpiration){if(s>zonosStore.checkoutSettings.defaultCartExpiration){o.isCartExpired=true;return true}}return false};this.checkStripePaymentIntentStatus=function(e){return __awaiter(o,[e],void 0,(function(e){var o,t,n,r,s,i,c,a,u;var l=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=l===null||l===void 0?void 0:l.matches("#".concat(checkoutHiddenBtnSelector));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");s=n.get("zonosCheckoutSessionId");if(!o){log("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}log("Payment intent exist, checking stripe payment intent status");if(!r){log("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,stripeStoreRetrievePayment({clientSecret:r})];case 1:i=e.sent(),c=i.error,a=i.status;u=new URLSearchParams(window.location.search).get("redirect_status");if(u){if(!c){log("Payment intent is succeeded or in a good state to move forward, show success screen")}else{log("Payment intent failed, show status from error")}this.open=true;cartStore.checkoutSessionId=s;stripeStore.clientSecret=r;void this.setToFinishStep(a);return[2,{shouldAllowOrder:false}]}if(!t){log("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}log("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(cartStore.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=cartStore.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(o.defaultCustomerProfileAddress.length){return o.defaultCustomerProfileAddress}if(Array.isArray(o.defaultAddress)&&o.defaultAddress.length){return o.defaultAddress}if(!Array.isArray(o.defaultAddress)&&typeof o.defaultAddress==="object"){return[o.defaultAddress]}return o.defaultAddressParams};this.appearanceSettingsOverride=undefined;this.preview=false;this.hiddenMode=false;this.mobile=false;this.overrideStagingMode=undefined;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=stripeStore.clientSecret;this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void cartStoreUpdateItems({adjustments:cartStore.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;submitGtag("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&cartStore.step==="finish"){cartStoreReset()}cartStore.step="customer-info";cartStoreResetTabItems();cartStoreClearCheckoutInterval();(t=(o=zonosStore.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,s,i,c,r,a,i,c,c,u,l,i,d;return __generator(this,(function(h){switch(h.label){case 0:if(!(typeof zonosStore.checkoutSettings.createCartId==="function"))return[3,4];log('"createCartId" is provided, start building cart');return[4,zonosStore.checkoutSettings.createCartId()];case 1:e=h.sent();o=void 0;if(typeof e==="object"){log("object detected, use cartId and prefill address from createCartId");o=e.cartId;this.useShippingDataFromCreateCartId(e.shippingData);cartStore.customerAuthenticationToken=e.customerAuthenticationToken||null}else{o=e}window.Zonos.cartId=o;return[4,setupCartData(o)];case 2:t=h.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){logError("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=this.handleCartExpiredCheck();if(r){return[2,false]}s=buildCartItemsByTempCart(n),i=s.adjustments,c=s.cartItems;return[4,cartStoreUpdateItems({adjustments:i,cartItems:c})];case 3:h.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];log("tempCartUUID is provided, start building cart");r=this.handleCartExpiredCheck();if(r){return[2,false]}a=buildCartItemsByTempCart(window.Zonos.cartData),i=a.adjustments,c=a.cartItems;return[4,cartStoreUpdateItems({adjustments:i,cartItems:c})];case 5:h.sent();return[3,9];case 6:if(!(zonosStore.checkoutSettings.buildCartDetail&&localizationStore.selectedCountryCode))return[3,9];log("build cart detail");return[4,zonosStore.checkoutSettings.buildCartDetail({countryCode:localizationStore.selectedCountryCode,currencyCode:localizationStore.targetCurrency})];case 7:c=h.sent();u=c.filter((function(e){return e.amount>=0}));l=c.filter((function(e){return e.amount<0}));i=l.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,cartStoreUpdateItems({adjustments:i,cartItems:u})];case 8:h.sent();h.label=9;case 9:if(!!cartStore.checkoutSessionId)return[3,11];return[4,stripeStoreInitCheckoutSession()];case 10:d=h.sent();log("stripeStoreInitCheckoutSession: ".concat(d));if(!d){return[2,false]}h.label=11;case 11:if(!cartStore.isStagingMode){void stripeStoreGetPaymentIntent()}return[4,this.applyStripeTheme()];case 12:h.sent();this.isRedirectAfterOrder=zonosStore.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!cartStore.externalConfirmationPageURL;return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=jsonParse(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;log("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||ORDER_DUPLICATION_NOTIFICATION_EXPIRATION;if(o>t){log("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;log("=== Showing order duplication confirmation","warn")};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!cartStore.checkoutSessionId){return}void handleFetch("/api/zonos-elements/update-checkout-session-metadata",{body:{id:cartStore.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||zonosStore.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=zonosStore.checkoutSettings.placeOrderButtonSelector;var t=zonosStore.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;log("attach checkout ".concat(o));log("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData){return}var n=[o,t,"#".concat(domesticRedirectedBtnSelector),"#".concat(checkoutHiddenBtnSelector),"#".concat(checkoutHiddenInternationalBtnSelector)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}log("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,s,i,c,a,u,l,d,h,f,m;return __generator(this,(function(p){switch(p.label){case 0:r=performance.now();s=t&&n.matches(t);i=n.matches("#".concat(checkoutHiddenInternationalBtnSelector));c=n.matches("#".concat(domesticRedirectedBtnSelector))||n.matches("#".concat(checkoutHiddenBtnSelector));if(!window.Zonos.isLegacyCheckout&&(!isShippableCountry()||isDisabledCountry())&&!s&&!i&&!c){return[2]}o.preventDefault();o.stopPropagation();log("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:a=p.sent().shouldAllowOrder;if(!a){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void sendBulkLoadTimeApiLog()}),2e3)}stripeStore.isFetchingSession=true;this.open=true;p.label=2;case 2:p.trys.push([2,5,,6]);return[4,this.buildCartAndInit()];case 3:u=p.sent();if(this.isCartExpired){throw new Error("This shopping cart is expired")}if(!u){throw new Error("Error building cart")}cartStoreStartCheckoutInterval({isPreview:this.preview,sessionTimeout:CHECKOUT_SESSION_TIMEOUT});submitGtag("zonos-checkout-start");l=cartStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:l,eventName:"checkout_open"});return[4,isStoreDiscountEnabled()];case 4:d=p.sent().enabled;cartStore.shouldHideDiscountInput=!d;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void sendLoadCheckoutFacadeLog()}else{h=performance.now();f=h-r;void sendLoadNativeCheckoutLog({loadTime:f})}return[3,6];case 5:m=p.sent();stripeStore.isFetchingSession=false;logError(m);if(this.isCartExpired){return[2]}void sendErrorLog({endpoint:"Error creating Checkout",errors:[m instanceof Error?m.toString():"Unknown error"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionBody:getCheckoutSessionBody(),href:window.location.href,storeBaseUrl:((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||zonosStore.onlineStoreSettings.url}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[3,6];case 6:return[2]}}))}))}),{capture:true,passive:false});if(!zonosStore.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(domesticRedirectedBtnSelector))){n.dispatchEvent(createCustomEvent("click"));stripeStoreCleanupDomesticShippingSession();n.remove()}if(n.matches("#".concat(checkoutHiddenBtnSelector))){n.dispatchEvent(createCustomEvent("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}log("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,s=e.customerEmail,i=e.customerName,c=e.customerPhone,a=e.customerState,u=e.customerZip;var l=new URLSearchParams(window.location.search);var d=r||getZCountryUrlParam(l)||localizationStore.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:d,customerEmail:s,customerName:i,customerPhone:c,customerState:a,customerZip:u})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);log("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=getZCountryUrlParam(e)||localizationStore.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var s=o("customerAddress1");var i=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var l=o("customerState");this.applyPrefillAddress({customerAddress1:s,customerAddress2:i,customerCity:n,customerCountry:t,customerEmail:r,customerName:c,customerPhone:a,customerState:l,customerZip:u})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var s=e.customerEmail||"";var i=e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!i||!c||!t){log("Missing required query params so it can not be prefilled","info",[!o&&"line1",!i&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&localizationStore.shippingZoneCountries&&!(t in localizationStore.shippingZoneCountries)){log('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:s,name:i,phone:c}];log("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){cartStore.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){stripeStore.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;cartStore.isStagingMode=getIsStagingMode();if(typeof this.overrideStagingMode!=="undefined"){cartStore.isStagingMode=this.overrideStagingMode}watchBigcommerceDomesticCheckout({domesticRedirectedBtnSelector:domesticRedirectedBtnSelector,onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){stripeStore.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){log("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}log("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){cartStore.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){cartStoreSetCheckoutSession(e);return[2]}))}))};e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));if(e){e.dispatchEvent(createCustomEvent("click"))}return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o;var t=this;return __generator(this,(function(n){switch(n.label){case 0:submitGtag("zonos-checkout-customer-info");e=cartStore.checkoutSessionId;void trackConversionEvent({checkoutSessionId:e,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,stripeStorePrefetchLandedCost()];case 1:n.sent();o=setInterval((function(){if(cartStore.landedCostData||!stripeStore.isFetchingLandedCost){if(cartStore.landedCostData){void paypalInitScript({currency:cartStore.currency});cartStoreNextStep()}t.submitLoading=false;clearInterval(o)}}),500);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(o){this.submitLoading=true;setTimeout((function(){cartStoreNextStep();e.submitLoading=false}),500);return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){cartStore.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(s){switch(s.label){case 0:e=stripeStore.checkoutSettlementCurrency==="USD";if(e&&stripeStore.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;paypalStore.paypalErrorMessage=null;stripeStore.hasPaymentError=false;this.submitLoading=true;cartStore.inventoryCheckErrorMessage=null;return[4,stripeStoreUpdateCheckoutSessionBaseCurrency()];case 1:o=s.sent();if(!o){stripeStore.hasPaymentError=true;stripeStore.customErrorMessage=translate("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:stripeStore.checkoutSettlementCurrency});this.submitLoading=false;return[2]}s.label=2;case 2:s.trys.push([2,4,,5]);t=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 3:t.inventoryCheckErrorMessage=s.sent();return[3,5];case 4:n=s.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,5];case 5:if(cartStore.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}s.label=6;case 6:s.trys.push([6,8,,9]);return[4,stripeStoreConfirmPayment()];case 7:s.sent();cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,9];case 8:r=s.sent();logError(r);submitGtag("zonos-checkout-payment-fail");stripeStore.hasPaymentError=true;if(stripeStore.shouldInventoryRefund){void stripeStoreHandleInventoryRefund();stripeStore.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:stripeStoreReset();if(!this.preview)return[3,2];cartStore.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:cartStoreReset();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||zonosStore.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=isCheckoutMobile(this.mobile);void this.applyStripeTheme();log("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=isCheckoutMobile(this.mobile);void this.applyStripeTheme();log("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=getZonosStoreTheme(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){stripeStoreReset()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){log("No customer profile","info");this.defaultCustomerProfileAddress=[];return}log("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=stripeStore.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=stripeStore.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){log("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=isCheckoutMobile(this.mobile);this.isIframed=window.self!==window.top;log("iframed: ".concat(this.isIframed));this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=localizationStoreOnUpdate("selectedLocale",(function(){void e.applyStripeTheme()}));log("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){stripeStoreReset();cartStoreReset();this.onChangeLocaleListener()};e.prototype.render=function(){var e=this;var o,t,n,r;this.customerProfile=stripeStore.customerProfile;this.clientSecret=stripeStore.clientSecret;if(stripeStore.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=stripeStore.stripeCustomerSessionClientSecret}var s=cartStore.step!=="finish"&&cartStore.step!=="error"&&!stripeStore.stripeElements||stripeStore.isFetchingSession;var i=mergeConfig(zonosStore.appearance,this.appearanceSettingsOverride||null),c=i.colorPrimary,a=i.colorSecondary,u=i.logoUrl,l=i.style;var d=zonosStore.appearance.zonosAttribution==="ENABLED";var f=zonosStore.appearance.theme;var m=c&&isDarkColor(c)?"DARK":"LIGHT";var p=this.isMobile?f:m;var g=!this.isMobile?a:undefined;var v=localizationStore.customMessages;var z=(o=v.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var k=this.getCurrentLocalePageEnum();var S=v.filter((function(e){return e.pageName===k}));var w=this.getBaseCurrencySettlementInfo();var C=function(){var o=e.preview?"".concat(u,"?timestamp=").concat(Date.now()):u;return h("div",{class:"zonos--logo"},o&&h("img",{alt:"".concat(zonosStore.organizationName," logo"),src:o}))};var b=getIsTestMode();var y=function(){var o=new URLSearchParams(window.location.search);var t=o.get("zonosQaUrl");var n=o.get("zonosDebug");var r=o.get("zonosE2ETest");var s=e.overrideStagingMode||getIsStagingMode();return h("zonos-v-stack",null,h("div",{class:"zonos--logo-wrapper"},C(),b&&h("zonos-badge",{badgeColor:"orange",size:"small"},translate("Test mode")),s&&h("zonos-badge",{badgeColor:"red",size:"small"},translate("Staging mode")),n==="1"&&h("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&h("zonos-badge",{badgeColor:"purple",size:"small"},t),r&&h("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),h("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),S.map((function(e){return h("zonos-custom-message",{icon:MessageIcon,message:e.message})})))};var _=function(){if(cartStore.checkoutSessionTimeoutShow){return h("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:translate("Your checkout session has expired. Please reload the page to continue."),restStateTitle:translate("Session timed out"),restStateType:"Warning"},h("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},translate("Reload")))}return h("div",{class:"zonos--content",style:{"--zonos--border-radius":getBorderRadius({overrideBorderStyle:l})}},cartStore.step!=="finish"&&cartStore.step!=="error"&&h(Fragment,null,h("div",{class:"zonos--left","data-theme":p,style:styles({"--zonos--primary-color":!e.isMobile?c:undefined})},!e.isMobile&&y(),cartStore.step==="customer-info"&&h("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:g}),cartStore.step==="shipping"&&h("zonos-shipping",{continueLoading:e.submitLoading,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:g}),cartStore.step==="payment"&&h("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:g})),h("div",{class:"zonos--right","data-theme":f},e.isMobile&&y(),h("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&h("zonos-currency-toggle",null),!e.isLegacyCheckout&&h("zonos-button",{class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),h("div",{class:"flex--wrapper"},h("div",{class:"zonos--wrapper"},h("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),h("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},h("zonos-cart-items",null),e.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-cart-subtotal",{submitBtnColor:g}),h("zonos-custom-message",{class:"zonos--checkout-default-message",icon:MessageIcon,message:z})))),h("zonos-cart-restricted-items",null),!e.isMobile&&h("zonos-v-stack",{spacing:16},h("zonos-cart-subtotal",null),h("zonos-custom-message",{class:"zonos--checkout-default-message",icon:MessageIcon,message:z}))))),(cartStore.step==="finish"||cartStore.step==="error")&&h("div",{class:"zonos--done","data-theme":f},h("div",{class:"zonos--header"},C(),!e.isRedirectAfterOrder&&h("zonos-button",{class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:f})),h("zonos-checkout-finish",{borderRadius:l,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:cartStore.step==="error"&&!!cartStore.error?Object.assign(Object.assign({},cartStore.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),h("zonos-checkout-footer",{"data-theme":f,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return h(Host,{class:classes(["zonos--checkout zonos--elements",d&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?_():h("zonos-dialog",{borderStyle:l,"data-theme":f,height:"980px",isLoading:s,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},_()),h("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:translate("Don't close"),dialogConfirmBtnText:translate("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:translate("Would you like to close checkout and return to the site?"),dialogTitle:translate("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),h("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:translate("Return to merchant site"),dialogConfirmBtnText:translate("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((t=this.placedOrderInfo)===null||t===void 0?void 0:t.zonosOrderNumber)?translate("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):translate("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((n=this.placedOrderInfo)===null||n===void 0?void 0:n.time)||null),time:this.formatTime(((r=this.placedOrderInfo)===null||r===void 0?void 0:r.time)||null)}),dialogTitle:translate("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),h("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:translate("Return to cart"),dialogIntent:"danger",dialogOpen:!!cartStore.inventoryCheckErrorMessage,dialogSubtitle:cartStore.inventoryCheckErrorMessage,dialogTitle:translate("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),w&&h("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:translate("Cancel"),dialogConfirmBtnText:translate("Pay [orderTotal]",{orderTotal:currencyFormat({amount:w.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:translate("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:translate("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),h("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:translate("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:translate("You are being sent back to the shop to re-add items to your cart."),dialogTitle:translate("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}();ZonosCheckout.style=ZonosCheckoutStyle0;export{ZonosCheckout as zonos_checkout};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,i){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((i=i.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){t.label=a[1];break}if(a[0]===6&&t.label<r[1]){t.label=r[1];r=a;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(a);break}if(r[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{p as promiseResolve,b as bootstrapLazy}from"./index-a457c60c.js";export{s as setNonce}from"./index-a457c60c.js";import{g as globalScripts}from"./app-globals-0f993ce5.js";var patchBrowser=function(){var e=import.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return promiseResolve(o)};patchBrowser().then((function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,globalScripts()];case 1:o.sent();return[2,bootstrapLazy(JSON.parse('[["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"hiddenMode":[4,"hidden-mode"],"mobile":[4],"overrideStagingMode":[4,"override-staging-mode"],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"defaultAddressParams":[32],"defaultCustomerProfileAddress":[32],"customerProfile":[32],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"isIframed":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"isCartExpired":[32],"payInUsdConfirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"placedOrderInfo":[32],"clientSecret":[32],"stripeCustomerSessionClientSecret":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64],"mockCheckoutSession":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"overrideStagingMode":["overrideStagingModeChanged"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"],"customerProfile":["handleCustomerProfileChange"],"clientSecret":["handleClientSecretChange"],"stripeCustomerSessionClientSecret":["handleClientSecretChange"],"open":["handleOpenChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-tooltip",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-badge",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"loading":[4],"dismissHandler":[16]}]]],["zonos-shipping-rich-radio",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[16]}]]],["zonos-toggle",[[1,"zonos-toggle",{"options":[16],"value":[1]}]]],["zonos-collapse",[[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-card",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-stripe-input",[[2,"zonos-stripe-input",{"name":[1],"autoComplete":[1,"auto-complete"],"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"inputPlaceholder":[1,"input-placeholder"],"value":[1025],"required":[4],"internalValue":[32]},null,{"inputValue":["onInputValueChange"],"value":["onValueChange"]}]]],["zonos-input",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-empty-state-payment_4",[[1,"zonos-empty-state-payment",{"emptyStateText":[1,"empty-state-text"],"theme":[1]}],[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32],"isPaymentInfoFilled":[32]},null,{"isPaymentInfoFilled":["watchIsPaymentInfoFilled"],"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-button_3",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"bold":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-country-select_4",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-address_11",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-custom-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"isAddressLine1Entered":[32],"addressSuggestions":[32],"countryField":[32],"startGooglePlaceSuggestions":[32],"shipToCountries":[32],"shippingZones":[32],"city":[32],"country":[32],"firstName":[32],"lastName":[32],"line1":[32],"line2":[32],"phone":[32],"postalCode":[32],"state":[32],"cityError":[32],"stateError":[32],"postalCodeError":[32],"phoneError":[32],"firstNameError":[32],"lastNameError":[32],"isFirstInitialization":[32],"addressService":[32],"checkoutSessionId":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"defaultAddress":["defaultAddressChanged"],"line1":["line1Changed"],"city":["formFieldsChanged"],"country":["formFieldsChanged"],"firstName":["formFieldsChanged"],"lastName":["formFieldsChanged"],"line2":["formFieldsChanged"],"phone":["formFieldsChanged"],"postalCode":["formFieldsChanged"],"state":["formFieldsChanged"],"addressService":["shouldEnabledCustomAddressChanged"],"shippingZones":["shippingZonesChanged"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"checkoutSessionId":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"stripe":["watchInitStripe"],"defaultAddress":["defaultAddressChanged"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"isEmailError":[4,"is-email-error"],"stripe":[32],"isStagingMode":[32],"clientSecret":[32]},null,{"isStagingMode":["watchIsStagingMode"],"stripe":["watchInitStripe"],"clientSecret":["watchInitStripe"],"defaultEmail":["watchDefaultEmail"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[1,"zonos-address-suggestions",{"type":[1],"suggestions":[16],"selectedSuggestionId":[32],"localSuggestions":[32],"lastHoveredSuggestionId":[32]},null,{"suggestions":["suggestionsChanged"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[2,"zonos-stripe-phone-input",{"autoComplete":[1,"auto-complete"],"countryOptions":[16],"disabled":[4],"error":[1],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"inputValue":[1,"input-value"],"countryCode":[1,"country-code"],"minWidth":[1,"min-width"],"selectedCountry":[32],"phoneNumber":[32],"isFocused":[32],"isSelectOpen":[32]},null,{"countryOptions":["onCountryOptionsChange"],"selectedCountry":["onSelectedCountryChange"],"inputValue":["onPhoneNumberChange"]}],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-stripe-select",{"name":[1],"selectedValue":[1,"selected-value"],"selectLabel":[1,"select-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"selectPlaceholder":[1,"select-placeholder"],"options":[16],"autoComplete":[1,"auto-complete"],"value":[1025],"required":[4],"isClearable":[4,"is-clearable"],"minWidth":[1,"min-width"],"internalValue":[32],"internalOptions":[32]},null,{"options":["onOptionsChange"],"selectedValue":["onSelectedValueChange"],"value":["onValueChange"]}]]],["zonos-cart-items_13",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"shouldUseCustomAddressFormOverride":[4,"should-use-custom-address-form-override"],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"taxIdErrorMessage":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32],"shouldEnabledCustomAddress":[32],"isEmailError":[32],"recordedFormTypeUsed":[32]},null,{"showErrorBanner":["watchShowErrorBanner"]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"overridePrimaryColor":[1,"override-primary-color"],"showErrorBanner":[32],"hasStripePaymentError":[32],"stagingOrderCreateErrorMessage":[32],"internalContinueLoading":[32]},null,{"continueLoading":["continueLoadingWatcher"],"hasStripePaymentError":["stripePaymentErrorWatcher"]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"collapsedDAPOptions":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevelsDDP":[32],"serviceLevelsDAP":[32],"serviceLevelsOther":[32],"serviceLevelsAll":[32],"displayBaseCurrency":[32]}],[1,"zonos-cart-subtotal",{"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"loading":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32],"isWaitingToRedirect":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogWidth":[2,"dialog-width"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-currency-toggle",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]]'),e)]}}))}))}));
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,i){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((i=i.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){t.label=a[1];break}if(a[0]===6&&t.label<r[1]){t.label=r[1];r=a;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(a);break}if(r[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{p as promiseResolve,b as bootstrapLazy}from"./index-a457c60c.js";export{s as setNonce}from"./index-a457c60c.js";import{g as globalScripts}from"./app-globals-0f993ce5.js";var patchBrowser=function(){var e=import.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return promiseResolve(o)};patchBrowser().then((function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,globalScripts()];case 1:o.sent();return[2,bootstrapLazy(JSON.parse('[["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"hiddenMode":[4,"hidden-mode"],"mobile":[4],"overrideStagingMode":[4,"override-staging-mode"],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"defaultAddressParams":[32],"defaultCustomerProfileAddress":[32],"customerProfile":[32],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"isIframed":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"isCartExpired":[32],"payInUsdConfirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"placedOrderInfo":[32],"clientSecret":[32],"stripeCustomerSessionClientSecret":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64],"mockCheckoutSession":[64],"triggerCheckoutInternational":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"overrideStagingMode":["overrideStagingModeChanged"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"],"customerProfile":["handleCustomerProfileChange"],"clientSecret":["handleClientSecretChange"],"stripeCustomerSessionClientSecret":["handleClientSecretChange"],"open":["handleOpenChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-tooltip",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-badge",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"loading":[4],"dismissHandler":[16]}]]],["zonos-shipping-rich-radio",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[16]}]]],["zonos-toggle",[[1,"zonos-toggle",{"options":[16],"value":[1]}]]],["zonos-collapse",[[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-card",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-stripe-input",[[2,"zonos-stripe-input",{"name":[1],"autoComplete":[1,"auto-complete"],"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"inputPlaceholder":[1,"input-placeholder"],"value":[1025],"required":[4],"internalValue":[32]},null,{"inputValue":["onInputValueChange"],"value":["onValueChange"]}]]],["zonos-input",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-empty-state-payment_4",[[1,"zonos-empty-state-payment",{"emptyStateText":[1,"empty-state-text"],"theme":[1]}],[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32],"isPaymentInfoFilled":[32]},null,{"isPaymentInfoFilled":["watchIsPaymentInfoFilled"],"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-button_3",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"bold":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-country-select_4",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-address_11",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-custom-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"isAddressLine1Entered":[32],"addressSuggestions":[32],"countryField":[32],"startGooglePlaceSuggestions":[32],"shipToCountries":[32],"shippingZones":[32],"city":[32],"country":[32],"firstName":[32],"lastName":[32],"line1":[32],"line2":[32],"phone":[32],"postalCode":[32],"state":[32],"cityError":[32],"stateError":[32],"postalCodeError":[32],"phoneError":[32],"firstNameError":[32],"lastNameError":[32],"isFirstInitialization":[32],"addressService":[32],"checkoutSessionId":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"defaultAddress":["defaultAddressChanged"],"line1":["line1Changed"],"city":["formFieldsChanged"],"country":["formFieldsChanged"],"firstName":["formFieldsChanged"],"lastName":["formFieldsChanged"],"line2":["formFieldsChanged"],"phone":["formFieldsChanged"],"postalCode":["formFieldsChanged"],"state":["formFieldsChanged"],"addressService":["shouldEnabledCustomAddressChanged"],"shippingZones":["shippingZonesChanged"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"checkoutSessionId":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"stripe":["watchInitStripe"],"defaultAddress":["defaultAddressChanged"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"isEmailError":[4,"is-email-error"],"stripe":[32],"isStagingMode":[32],"clientSecret":[32]},null,{"isStagingMode":["watchIsStagingMode"],"stripe":["watchInitStripe"],"clientSecret":["watchInitStripe"],"defaultEmail":["watchDefaultEmail"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[1,"zonos-address-suggestions",{"type":[1],"suggestions":[16],"selectedSuggestionId":[32],"localSuggestions":[32],"lastHoveredSuggestionId":[32]},null,{"suggestions":["suggestionsChanged"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[2,"zonos-stripe-phone-input",{"autoComplete":[1,"auto-complete"],"countryOptions":[16],"disabled":[4],"error":[1],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"inputValue":[1,"input-value"],"countryCode":[1,"country-code"],"minWidth":[1,"min-width"],"selectedCountry":[32],"phoneNumber":[32],"isFocused":[32],"isSelectOpen":[32]},null,{"countryOptions":["onCountryOptionsChange"],"selectedCountry":["onSelectedCountryChange"],"inputValue":["onPhoneNumberChange"]}],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-stripe-select",{"name":[1],"selectedValue":[1,"selected-value"],"selectLabel":[1,"select-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"selectPlaceholder":[1,"select-placeholder"],"options":[16],"autoComplete":[1,"auto-complete"],"value":[1025],"required":[4],"isClearable":[4,"is-clearable"],"minWidth":[1,"min-width"],"internalValue":[32],"internalOptions":[32]},null,{"options":["onOptionsChange"],"selectedValue":["onSelectedValueChange"],"value":["onValueChange"]}]]],["zonos-cart-items_13",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"shouldUseCustomAddressFormOverride":[4,"should-use-custom-address-form-override"],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"taxIdErrorMessage":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32],"shouldEnabledCustomAddress":[32],"isEmailError":[32],"recordedFormTypeUsed":[32]},null,{"showErrorBanner":["watchShowErrorBanner"]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"overridePrimaryColor":[1,"override-primary-color"],"showErrorBanner":[32],"hasStripePaymentError":[32],"stagingOrderCreateErrorMessage":[32],"internalContinueLoading":[32]},null,{"continueLoading":["continueLoadingWatcher"],"hasStripePaymentError":["stripePaymentErrorWatcher"]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"collapsedDAPOptions":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevelsDDP":[32],"serviceLevelsDAP":[32],"serviceLevelsOther":[32],"serviceLevelsAll":[32],"displayBaseCurrency":[32]}],[1,"zonos-cart-subtotal",{"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"loading":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32],"isWaitingToRedirect":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogWidth":[2,"dialog-width"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-currency-toggle",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]]'),e)]}}))}))}));
@@ -2381,6 +2381,10 @@ declare namespace Components {
2381
2381
  * For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
2382
2382
  */
2383
2383
  "setToFinishStep": (forcePaymentStatus?: PaymentIntent["status"]) => Promise<void>;
2384
+ /**
2385
+ * Trigger the checkout international button
2386
+ */
2387
+ "triggerCheckoutInternational": () => Promise<void>;
2384
2388
  }
2385
2389
  interface ZonosCheckoutFinish {
2386
2390
  /**
@@ -5700,6 +5704,10 @@ interface Zonos {
5700
5704
  openHelloDialog: (state?: boolean) => void;
5701
5705
  setupGoogleFont: (fontFamily: string) => void;
5702
5706
  showNotification: (props: NotificationInit) => void;
5707
+ /**
5708
+ * Trigger the checkout international button, always trigger Checkout even user are not in shipping zone
5709
+ */
5710
+ triggerCheckoutInternational: () => void;
5703
5711
  updateOrganizationName: (organizationName: string) => void;
5704
5712
  }
5705
5713
  declare abstract class Zonos {
@@ -5737,8 +5745,13 @@ declare abstract class Zonos {
5737
5745
  static loadTimeApiInfoList: LoadTimeApiLogInfo[];
5738
5746
  static logIntervalId: NodeJS.Timeout | null;
5739
5747
  static init: (params: LoadZonosParams) => Promise<void>;
5748
+ /**
5749
+ * Inject the hidden international checkout button to trigger checkout regardless of shipping zones
5750
+ */
5751
+ private static injectCheckoutInternationalButton;
5740
5752
  private static injectCustomScriptForHostedCheckout;
5741
5753
  static displayCurrency: () => void;
5754
+ static triggerCheckoutInternational: () => Promise<void>;
5742
5755
  static openHelloDialog: (value?: boolean) => void;
5743
5756
  static showNotification: (notification: NotificationInit) => void;
5744
5757
  static updateOrganizationName: (organizationName: string) => void;
@@ -1 +1 @@
1
- (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...l));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}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 a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},z=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const C=y(i),O=!!d.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),j=C&&O;return O&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{if(r("sendErrorLog","warn",e,t,o),n){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:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:C,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${C}`),z({basePathType:C,options:o,path:t})):Object.assign({errors:d,response:c},p)},C=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:a||m,options:i,path:e})},O=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.189.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),n},j="https://js.stripe.com/v3",Z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,k="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let A=null;const I=e=>(null!==A||(A=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(k),window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${j}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&Z.test(t.src))return t}return null})();n&&e?console.warn(k):n||(n=(e=>{const o=document.createElement("script");o.src=`${j}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),A),E=Promise.resolve().then((()=>I(null)));let T=!1;E.catch((e=>{T||console.warn(e)}));const L=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await C(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),d=!a||i.length;return d&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),L({cartId:e,retries:o-1})):d?null:Object.assign(Object.assign({},a),{zonosMode:l})},P=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${P.source}$`),U=new RegExp(`^cart_${P.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,F=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await L({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var R;const M=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=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=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),x="https://v1.3.189.js.zonos.com",B=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.189",q="https://fonts.googleapis.com",W=/^https:\/\/fonts\.googleapis\.com/;class K{}R=K,K.doneInit=!1,K.cartSettings=null,K.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),K.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),K._paypalMockResponse=null,K.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,K.isBigCommerce=!1,K.releaseDate="1745853376635",K.isLegacyCheckout=!1,K.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",K.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),K.overrideUseCustomAddressForm=!1,K.isNpm=!0,K.zonosQaUrl=null,K.zonosQaUrlApi=null,K.trackEventLogs=[],K.version="v1.3.189",K.modeAlerted=!1,K.cartData=null,K.paypal=null,K.zonosMode=null,K.IframeService=o,K.getCurrentTimestamp=()=>(new Date).getTime(),K.zonosController=null,K.loadTimeApiInfoList=[],K.logIntervalId=null,K.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=u,R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=O();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await F(R.cartId);if(!e)return void s("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await C("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(R.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.cartData||!!m){r("Cart data or stripe client secret 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)}r("init zonos"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),R.doneInit=!0},K.injectCustomScriptForHostedCheckout=()=>{const e=R.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},K.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},K.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},K.showNotification=e=>{var o;null===(o=R.zonosController)||void 0===o||o.showNotification(e)},K.updateOrganizationName=e=>{var o;null===(o=R.zonosController)||void 0===o||o.updateOrganizationName(e)},K.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},K.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},K.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=R.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{T=!0;const o=Date.now();return E.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);t?(window.Zonos.stripe=t,n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),R.zonosController=n,r("Zonos controller injected!")},K.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${R.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&R.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},K.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return B;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.189";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.189";case"vercel":return x}};if(R.isNpm){return O()||o()}return o()},K.injectZonosCdn=()=>{R.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},K.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=R.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${x}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&R.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},K.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},K.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${q}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!W.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=q,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${q}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},K.setupGoogleFont=e=>{var o;null===(o=R.zonosController)||void 0===o||o.setupGoogleFont(e)},K.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${q}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=q,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=K})();
1
+ (function(){"use strict";const e=({id:e,payload:t,target:o,type:n})=>{var r;o instanceof HTMLIFrameElement?null===(r=o.contentWindow)||void 0===r||r.postMessage({id:e,payload:t,type:n},"*"):o.postMessage({id:e,payload:t,type:n},"*")};class t{constructor(t,o){this.targetElement=t,this.targetId=o,this.sendMessage=(t,o)=>{e({id:this.targetId,payload:o,target:this.targetElement,type:t})}}}t.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},t.sendMessage=e,t.injectPrivateIframe=({id:e,onload:t,src:o})=>{const n=document.createElement("iframe");return n.src=o,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>t(n),document.body.appendChild(n),n};const o=performance.now(),n=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"}},r=(e,t,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-o,t=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...l));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(t){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...t)=>{r(e,"error",...t)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const t=i.indexOf(e);return i[t+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const t=p.indexOf(e),o=p[t+1];return o||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,t=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,t="mozConnection"in window.navigator?window.navigator.mozConnection:null,o="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||t||o})();return{connectionDownlink:null==t?void 0:t.downlink,connectionEffectiveType:null==t?void 0:t.effectiveType,connectionRtt:null==t?void 0:t.rtt,connectionSaveData:null==t?void 0:t.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{const t=await e.text(),o=g(t);if(!o)throw new Error(`Failed to parse content: ${t}`);return o}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+o),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));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 a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const t=e.errors;return{baseUrl:r,errors:t.map((e=>"string"==typeof e?{message:e,type:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:t,path:o})=>{var n,s;const i=o.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:t,path:o}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${o} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:t,loadTimeInternal:o,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-o;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:t,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:o,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:o,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),j=!!d.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),O=z&&j;return j&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(r("sendErrorLog","warn",e,o,t),n){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,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},o)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=y();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+o,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==t?void 0:t.headers,requestPayload:g(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.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}),O?(r(`=== "${o}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:t,path:o})):Object.assign({errors:d,response:c},p)},z=async(e,t)=>{const o=u(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},o.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},j=()=>{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),o="https://v1.3.191.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 n=`https://${t}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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})),n},O="https://js.stripe.com/v3",k=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Z="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let I=null;const A=e=>(null!==I||(I=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Z),window.Stripe)t(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${O}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&k.test(o.src))return o}return null})();n&&e?console.warn(Z):n||(n=(e=>{const t=document.createElement("script");t.src=`${O}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),I),E=Promise.resolve().then((()=>A(null)));let T=!1;E.catch((e=>{T||console.warn(e)}));const L=async({cartId:e,retries:t})=>{const o=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await z(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:o,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),d=!a||i.length;return d&&t?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,500))),L({cartId:e,retries:t-1})):d?null:Object.assign(Object.assign({},a),{zonosMode:l})},$=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${$.source}$`),U=new RegExp(`^cart_${$.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,F=async e=>{const{isDgsCartId:t,isLegacyCartId:o}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!o&&!t)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await L({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var M;const x=(()=>{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})(),B="https://v1.3.191.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.191",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}M=G,G.doneInit=!1,G.cartSettings=null,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.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1745941476799",G.isLegacyCheckout=!1,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.191",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=t,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:t,checkoutSettings:o,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(M.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),M.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${M.version}) ======`),M.zonosApiKey=p,M.storeId=u,M.isNpm){r("====== ZONOS LOADING FROM NPM ======");const t=j();if(t&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${t} ======`,"info");const o=document.createElement("script");return o.src=`${t}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=M.isNpm,window.Zonos.isBigCommerce=M.isBigCommerce,window.Zonos.isLegacyCheckout=M.isLegacyCheckout,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${t}`)})),void(window.isZonosPreview=!0)}if(!p&&!M.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!M.cartData&&M.cartId){r("Initialize cart data");const e=await F(M.cartId);if(!e)return void s("Failed to get cart data");M.cartData=e.cartData,M.zonosApiKey=e.zonosApiKey,M.cartSettings=e.settings}const o=await(async()=>{const e=c(),t=d();if(!e&&!t||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:n}=await z("/api/get-test-public-credential");if(o.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(M.zonosApiKey=o)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(M.cartId&&M.cartData||!!m){r("Cart data or stripe client secret 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)}r("init zonos"),M.restoreNativeBrowserFunctions(),M.injectCustomScriptForHostedCheckout(),M.injectZonosCdn(),M.injectZonosCss(),M.injectFonts(),M.injectCheckoutInternationalButton(),M.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),M.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=M.cartData,t=(null==e?void 0:e.metadata)||[],o=t.find((e=>"customHeaderScript"===e.key)),n=t.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||n)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout((()=>{var t;e&&e.dispatchEvent(new CustomEvent("click",{detail:t}))}),10)},G.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},G.showNotification=e=>{var t;null===(t=M.zonosController)||void 0===t||t.showNotification(e)},G.updateOrganizationName=e=>{var t;null===(t=M.zonosController)||void 0===t||t.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const t="zonos---native-browser";let o=document.querySelector(`iframe#${t}`);o||(o=document.createElement("iframe"),o.id=t,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const n=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(o)},G.injectController=({config:e})=>{var t,o;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const t=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=M.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;r("loading Stripe");const o=await(async(...e)=>{T=!0;const t=Date.now();return E.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);o?(window.Zonos.stripe=o,n.initCheckoutElement(o)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),M.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:t,theRestUrl:o})=>{const n=`${M.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&M.injectScript({cdnType:n,isModule:t,theRestUrl:o})},i.appendChild(a)},G.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.191";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.191";case"vercel":return B}};if(M.isNpm){return j()||t()}return t()},G.injectZonosCdn=()=>{M.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),M.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=M.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${o}/${t}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const o=l(e);o&&M.injectStylesheet({cdnType:o,theRestUrl:t})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(M.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!K.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=W,e.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},G.setupGoogleFont=e=>{var t;null===(t=M.zonosController)||void 0===t||t.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var t;r(`[FONT] injecting ${e}`);const o=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${o} font injected!`)},exports.Zonos=G})();