@zonos/elements 1.3.107 → 1.3.108

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 (87) hide show
  1. package/dist/cjs/{cart-9f3864db.js → cart-d25b699a.js} +4 -2
  2. package/dist/cjs/{createCustomEvent-7a156d77.js → createCustomEvent-4ea7b6dc.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{paypal-610cccad.js → paypal-fd423375.js} +7 -1
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +3 -3
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +4 -3
  8. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  15. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -1
  16. package/dist/collection/components/store/checkout/paypal.js +3 -1
  17. package/dist/collection/components/store/checkout/stripe.js +4 -2
  18. package/dist/collection/utils/generateCloudflareDeployUrl.js +2 -1
  19. package/dist/esm/{cart-4ba1878f.js → cart-911ba5dd.js} +4 -2
  20. package/dist/esm/{createCustomEvent-5fdd75bf.js → createCustomEvent-6ba5bcde.js} +1 -1
  21. package/dist/esm/index.js +7 -7
  22. package/dist/esm/{paypal-3d7d0148.js → paypal-04a10fc2.js} +7 -2
  23. package/dist/esm/zonos-address_7.entry.js +1 -1
  24. package/dist/esm/zonos-cart-items_13.entry.js +3 -3
  25. package/dist/esm/zonos-checkout.entry.js +4 -3
  26. package/dist/esm/zonos-controller.entry.js +1 -1
  27. package/dist/esm/zonos-country-flag.entry.js +1 -1
  28. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  29. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  30. package/dist/esm/zonos-hello.entry.js +1 -1
  31. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  32. package/dist/esm/zonos-notification_3.entry.js +2 -2
  33. package/dist/esm-es5/cart-911ba5dd.js +1 -0
  34. package/dist/esm-es5/{createCustomEvent-5fdd75bf.js → createCustomEvent-6ba5bcde.js} +1 -1
  35. package/dist/esm-es5/index.js +1 -1
  36. package/dist/esm-es5/{paypal-3d7d0148.js → paypal-04a10fc2.js} +2 -2
  37. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  38. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  39. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  40. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  41. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  42. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  43. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  44. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  45. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  46. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  47. package/dist/scripts/index.js +1 -1
  48. package/dist/scripts/loadZonos.js +1 -1
  49. package/dist/scripts/zonos.js +1 -1
  50. package/dist/types/components/store/checkout/stripe.d.ts +1 -0
  51. package/dist/zonos-elements/index.esm.js +1 -1
  52. package/dist/zonos-elements/p-018a4b36.js +1 -0
  53. package/dist/zonos-elements/{p-b0e0271d.system.entry.js → p-123cabaa.system.entry.js} +1 -1
  54. package/dist/zonos-elements/{p-7ef9b1e9.system.js → p-14de27ff.system.js} +1 -1
  55. package/dist/zonos-elements/{p-db824268.entry.js → p-1e1397fe.entry.js} +1 -1
  56. package/dist/zonos-elements/{p-43df09ad.system.entry.js → p-24813754.system.entry.js} +1 -1
  57. package/dist/zonos-elements/{p-fce4ea2c.system.entry.js → p-27188a22.system.entry.js} +1 -1
  58. package/dist/zonos-elements/p-39c09f18.system.entry.js +1 -0
  59. package/dist/zonos-elements/{p-62d88537.system.entry.js → p-45323a2f.system.entry.js} +1 -1
  60. package/dist/zonos-elements/{p-99d3ecd4.js → p-60303c84.js} +1 -1
  61. package/dist/zonos-elements/{p-c3167f3c.system.js → p-631570f0.system.js} +1 -1
  62. package/dist/zonos-elements/{p-bac9279b.system.entry.js → p-6927d227.system.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-2a522e2f.system.entry.js → p-76a4a647.system.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-db0c6041.entry.js → p-8632c8f1.entry.js} +1 -1
  65. package/dist/zonos-elements/{p-b2a3e0f0.entry.js → p-8b0feb0e.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-250f5e67.entry.js → p-8d98fed0.entry.js} +1 -1
  67. package/dist/zonos-elements/{p-a84da418.entry.js → p-a0af6dc1.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-b9f595e2.entry.js → p-adbcf21c.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-d65d7206.entry.js → p-ba3d2965.entry.js} +1 -1
  70. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  71. package/dist/zonos-elements/{p-6b58734c.system.entry.js → p-c9e8f159.system.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-bfab2cf6.entry.js → p-d6de8661.entry.js} +1 -1
  73. package/dist/zonos-elements/p-e2fa7600.entry.js +1 -0
  74. package/dist/zonos-elements/{p-7f543fa7.system.entry.js → p-e5d1d031.system.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-09faf6e8.system.js → p-e880ab28.system.js} +2 -2
  76. package/dist/zonos-elements/p-e9771827.system.js +1 -0
  77. package/dist/zonos-elements/{p-5d7606f0.entry.js → p-eaf09ccb.entry.js} +1 -1
  78. package/dist/zonos-elements/{p-6fb1434f.system.entry.js → p-ee14ba06.system.entry.js} +1 -1
  79. package/dist/zonos-elements/p-ef9d6106.js +17 -0
  80. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  81. package/package.json +1 -1
  82. package/dist/esm-es5/cart-4ba1878f.js +0 -1
  83. package/dist/zonos-elements/p-61489a67.js +0 -17
  84. package/dist/zonos-elements/p-9c89dadf.system.js +0 -1
  85. package/dist/zonos-elements/p-9d7eb65e.system.entry.js +0 -1
  86. package/dist/zonos-elements/p-d9752dd6.js +0 -1
  87. package/dist/zonos-elements/p-ec46325e.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,o){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,i){function a(t){try{u(o.next(t))}catch(t){i(t)}}function c(t){try{u(o["throw"](t))}catch(t){i(t)}}function u(t){t.done?e(t.value):r(t.value).then(a,c)}u((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(t){return function(n){return u([t,n])}}function u(c){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(e=0)),e)try{if(o=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:e.label++;return{value:c[1],done:false};case 5:e.label++;r=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){e.label=c[1];break}if(c[0]===6&&e.label<i[1]){e.label=i[1];i=c;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(c);break}if(i[2])e.ops.pop();e.trys.pop();continue}c=n.call(t,e)}catch(t){c=[6,t];r=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{d as cartStore,l as localizationStore}from"./cart-4ba1878f.js";import{z as zonosStore}from"./zonosStore-7798ac16.js";import{h as handleFetch}from"./handleFetch-3dea7d46.js";var trackConversionEvent=function(t,n){return __awaiter(void 0,void 0,void 0,(function(){var e,o,r,i,a,c,u;return __generator(this,(function(s){switch(s.label){case 0:r=window.location.href.includes("zonos.com")||!!((e=window.Zonos)===null||e===void 0?void 0:e.zonosQaUrl)||!!((o=window.Zonos)===null||o===void 0?void 0:o.debug);if(r&&!window.Zonos.zonosConversionTest){return[2]}i=localizationStore.selectedCountryCode;a=zonosStore.organizationId;c=cartStore.checkoutSessionId;if(!c){return[2]}u={checkoutSessionId:c,countryCode:i,eventName:t,metadata:n,organizationId:a};return[4,handleFetch("/api/zonos-elements/track-conversion-event",{body:u,method:"POST"})];case 1:s.sent();return[2]}}))}))};var getIsTestMode=function(){var t;return(t=window.Zonos.zonosApiKey)===null||t===void 0?void 0:t.includes("test")};var createCustomEvent=function(t,n){return new CustomEvent(t,{detail:n})};export{createCustomEvent as c,getIsTestMode as g,trackConversionEvent as t};
1
+ var __awaiter=this&&this.__awaiter||function(t,n,e,o){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,i){function a(t){try{u(o.next(t))}catch(t){i(t)}}function c(t){try{u(o["throw"](t))}catch(t){i(t)}}function u(t){t.done?e(t.value):r(t.value).then(a,c)}u((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(t){return function(n){return u([t,n])}}function u(c){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(e=0)),e)try{if(o=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:e.label++;return{value:c[1],done:false};case 5:e.label++;r=c[1];c=[0];continue;case 7:c=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){e.label=c[1];break}if(c[0]===6&&e.label<i[1]){e.label=i[1];i=c;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(c);break}if(i[2])e.ops.pop();e.trys.pop();continue}c=n.call(t,e)}catch(t){c=[6,t];r=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{d as cartStore,l as localizationStore}from"./cart-911ba5dd.js";import{z as zonosStore}from"./zonosStore-7798ac16.js";import{h as handleFetch}from"./handleFetch-3dea7d46.js";var trackConversionEvent=function(t,n){return __awaiter(void 0,void 0,void 0,(function(){var e,o,r,i,a,c,u;return __generator(this,(function(s){switch(s.label){case 0:r=window.location.href.includes("zonos.com")||!!((e=window.Zonos)===null||e===void 0?void 0:e.zonosQaUrl)||!!((o=window.Zonos)===null||o===void 0?void 0:o.debug);if(r&&!window.Zonos.zonosConversionTest){return[2]}i=localizationStore.selectedCountryCode;a=zonosStore.organizationId;c=cartStore.checkoutSessionId;if(!c){return[2]}u={checkoutSessionId:c,countryCode:i,eventName:t,metadata:n,organizationId:a};return[4,handleFetch("/api/zonos-elements/track-conversion-event",{body:u,method:"POST"})];case 1:s.sent();return[2]}}))}))};var getIsTestMode=function(){var t;return(t=window.Zonos.zonosApiKey)===null||t===void 0?void 0:t.includes("test")};var createCustomEvent=function(t,n){return new CustomEvent(t,{detail:n})};export{createCustomEvent as c,getIsTestMode as g,trackConversionEvent as t};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,e,o,r){function t(n){return n instanceof o?n:new o((function(e){e(n)}))}return new(o||(o=Promise))((function(o,i){function a(n){try{u(r.next(n))}catch(n){i(n)}}function s(n){try{u(r["throw"](n))}catch(n){i(n)}}function u(n){n.done?o(n.value):t(n.value).then(a,s)}u((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,t,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(n){return function(e){return u([n,e])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(r=1,t&&(i=s[0]&2?t["return"]:s[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,s[1])).done)return i;if(t=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;t=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=e.call(n,o)}catch(n){s=[6,n];t=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{l as log,a as logError}from"./handleFetch-3dea7d46.js";import{s as setupCartData,c as checkoutHiddenBtnSelector}from"./CheckoutConfig-4d2a508c.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-4d2a508c.js";var checkIfLoadVersionDomain=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var t=new URL(e).origin;var i=o.some((function(n){return t.includes(n)}));var a=r.some((function(n){return t.includes(n)}));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(n){var e=fallbackList.indexOf(n);var o=fallbackList[e+1];return o||null};var extractZonosQaUrl=function(n){if(!n){return null}var e=new URL(n).searchParams;var o=e.get("zonosQaUrl");if(!o){return null}var r=/[^a-zA-Z0-9-_]+/.test(o);if(!!r){return null}return o};var getZonosQaUrl=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=extractZonosQaUrl(window.location.href);var o="https://v1.3.107.js.zonos.com";if(!e&&(o.includes("test.")||o.includes("test-"))){return o}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var t="https://".concat(e,".").concat(r);log("[ZONOS-WARNING] using '".concat(t,"' for loading elements script"),"warn");void fetch(t).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(t,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var o="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return t};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var n=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(e);var r=document.head||document.body;if(!r){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(o);return o};var zonosStripeLoadScript=function(n){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(e,o){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){e(window.Stripe);return}try{var r=zonosStripeFindScript();if(r&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!r){r=injectScript(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(n){o(n);return}}));return stripePromise$1};var registerWrapper=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var initStripe=function(n,e,o){if(n===null){return null}var r=n.apply(undefined,e);registerWrapper(r,o);return r};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(n){if(!loadCalled){console.warn(n)}}));var zonosLoadStripe=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(o){loadCalled=true;e=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,n,e)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var n=new URLSearchParams(window.location.search);var e=n.get(TEMP_CART_ID_QUERY_PARAM);return e};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=checkIfLoadVersionDomain({loadScriptSrc:n===null||n===void 0?void 0:n.src}),o=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return o}return null}();var ZONOS_URL="https://v1.3.107.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.107";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.107";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.107";var INTER_FONT_URL="https://rsms.me";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var INTER_FONT_REGEX=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var Zonos=function(){function n(){}return n}();_a=Zonos;Zonos.doneInit=false;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.isBigCommerce=false;Zonos.releaseDate="1729719030640";Zonos.isLegacyCheckout=false;Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.version="v".concat("1.3.107");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.init=function(n){return __awaiter(void 0,[n],void 0,(function(n){var e,o;var r=n.appearance,t=n.checkoutSettings,i=n.currencyConverter,a=n.helloSettings,s=n.onCountryChange,u=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;return __generator(this,(function(n){switch(n.label){case 0:_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=l;_a.storeId=c;if(!_a.isNpm)return[3,2];log("====== ZONOS LOADING FROM NPM ======");if(!l&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartData(_a.cartId)];case 1:e=n.sent();if(!e){logError("Failed to get cart data");return[2]}_a.cartData=e.cartData;_a.zonosApiKey=e.zonosApiKey;n.label=2;case 2:if(_a.cartId&&_a.cartData){log("Cart data is available, inject hidden button and trigger checkout");o=document.createElement("button");o.style.display="none";o.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(o)}log("init zonos");_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectController({config:{appearance:r,checkoutSettings:t,currencyConverter:i,helloSettings:a,onCountryChange:s,overrideCurrencyFormat:u}});_a.doneInit=true;return[2]}}))}))};Zonos.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};Zonos.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};Zonos.showNotification=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.showNotification(n))};Zonos.updateOrganizationName=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};Zonos.disablePlaceOrderButtons=function(n){var e=n.autoEnable,o=e===void 0?true:e,r=n.config,t=n.disable,i=n.placeOrderButtonSelector;var a;if((a=r.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var u=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};s.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(t){n.setAttribute("disabled","true");n.addEventListener("click",u)}else{n.removeAttribute("disabled");n.removeEventListener("click",u)}}));if(o&&t){setTimeout((function(){s.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",u)}))}),5e3)}}};Zonos.injectController=function(n){var e=n.config;var o;if(document.querySelector("zonos-controller")){return}if((o=e.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=e.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:r});var t=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:r})}));t.observe(document.body,{childList:true,subtree:true})}var i=document.createElement("zonos-controller");i.config=e;i.zonosApiKey=_a.zonosApiKey||"";i.addEventListener("stripeInitEvent",(function(n){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;log("loading Stripe");return[4,zonosLoadStripe(e.publishableKey)];case 1:o=r.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;void i.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(i);_a.zonosController=i;log("Zonos controller injected!")};Zonos.injectScript=function(n){var e=n.cdnType,o=n.isModule,r=n.theRestUrl;var t=_a.getZonosUrl(e);var i="".concat(t,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var u=document.createElement("script");if(!!o){u.type="module"}else{u.noModule=true}u.src=i;u.crossOrigin="anonymous";u.onerror=function(){logError("Failed to load ".concat(u.src));var n=getNextFallbackUrl(e);if(!n){return}_a.injectScript({cdnType:n,isModule:o,theRestUrl:r})};s.appendChild(u)};Zonos.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||e()}return e()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(n){var e=n.cdnType,o=n.theRestUrl;var r=_a.getZonosUrl(e);var t=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");t.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(r,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var n=getNextFallbackUrl(e);if(!n){return}_a.injectStylesheet({cdnType:n,theRestUrl:o})};t.appendChild(a)};Zonos.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(INTER_FONT_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(INTER_FONT_REGEX.test(o.href)){continue}return o}return null};if(n()){log("Inter font already injected","warn");return}var e=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=INTER_FONT_URL;e.appendChild(o);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(INTER_FONT_URL,"/inter/inter.css");e.appendChild(r);log("Zonos font injected!")};Zonos.setupGoogleFont=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};Zonos.injectSupportGoogleFont=function(n){var e;log("[FONT] injecting ".concat(n));var o=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;r.appendChild(t)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);log("[FONT] ".concat(o," font injected!"))};export{Zonos};
1
+ var __awaiter=this&&this.__awaiter||function(n,e,o,r){function t(n){return n instanceof o?n:new o((function(e){e(n)}))}return new(o||(o=Promise))((function(o,i){function a(n){try{u(r.next(n))}catch(n){i(n)}}function s(n){try{u(r["throw"](n))}catch(n){i(n)}}function u(n){n.done?o(n.value):t(n.value).then(a,s)}u((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,t,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(n){return function(e){return u([n,e])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(r=1,t&&(i=s[0]&2?t["return"]:s[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,s[1])).done)return i;if(t=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;t=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=e.call(n,o)}catch(n){s=[6,n];t=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{l as log,a as logError}from"./handleFetch-3dea7d46.js";import{s as setupCartData,c as checkoutHiddenBtnSelector}from"./CheckoutConfig-4d2a508c.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-4d2a508c.js";var checkIfLoadVersionDomain=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var t=new URL(e).origin;var i=o.some((function(n){return t.includes(n)}));var a=r.some((function(n){return t.includes(n)}));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(n){var e=fallbackList.indexOf(n);var o=fallbackList[e+1];return o||null};var extractZonosQaUrl=function(n){if(!n){return null}var e=new URL(n).searchParams;var o=e.get("zonosQaUrl");if(!o){return null}var r=/[^a-zA-Z0-9-_]+/.test(o);if(!!r){return null}return o};var getZonosQaUrl=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=extractZonosQaUrl(window.location.href);var o="https://v1.3.108.js.zonos.com";if(!e&&(o.includes("test.")||o.includes("test-"))){return o}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var t="https://".concat(e,".").concat(r);log("[ZONOS-WARNING] using '".concat(t,"' for loading elements script"),"warn");void fetch(t).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(t,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var o="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return t};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var n=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(e);var r=document.head||document.body;if(!r){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(o);return o};var zonosStripeLoadScript=function(n){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(e,o){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){e(window.Stripe);return}try{var r=zonosStripeFindScript();if(r&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!r){r=injectScript(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(n){o(n);return}}));return stripePromise$1};var registerWrapper=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var initStripe=function(n,e,o){if(n===null){return null}var r=n.apply(undefined,e);registerWrapper(r,o);return r};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(n){if(!loadCalled){console.warn(n)}}));var zonosLoadStripe=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(o){loadCalled=true;e=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,n,e)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var n=new URLSearchParams(window.location.search);var e=n.get(TEMP_CART_ID_QUERY_PARAM);return e};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=checkIfLoadVersionDomain({loadScriptSrc:n===null||n===void 0?void 0:n.src}),o=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return o}return null}();var ZONOS_URL="https://v1.3.108.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.108";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.108";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.108";var INTER_FONT_URL="https://rsms.me";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var INTER_FONT_REGEX=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var Zonos=function(){function n(){}return n}();_a=Zonos;Zonos.doneInit=false;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.isBigCommerce=false;Zonos.releaseDate="1729779914092";Zonos.isLegacyCheckout=false;Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.version="v".concat("1.3.108");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.init=function(n){return __awaiter(void 0,[n],void 0,(function(n){var e,o;var r=n.appearance,t=n.checkoutSettings,i=n.currencyConverter,a=n.helloSettings,s=n.onCountryChange,u=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;return __generator(this,(function(n){switch(n.label){case 0:_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=l;_a.storeId=c;if(!_a.isNpm)return[3,2];log("====== ZONOS LOADING FROM NPM ======");if(!l&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartData(_a.cartId)];case 1:e=n.sent();if(!e){logError("Failed to get cart data");return[2]}_a.cartData=e.cartData;_a.zonosApiKey=e.zonosApiKey;n.label=2;case 2:if(_a.cartId&&_a.cartData){log("Cart data is available, inject hidden button and trigger checkout");o=document.createElement("button");o.style.display="none";o.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(o)}log("init zonos");_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectController({config:{appearance:r,checkoutSettings:t,currencyConverter:i,helloSettings:a,onCountryChange:s,overrideCurrencyFormat:u}});_a.doneInit=true;return[2]}}))}))};Zonos.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};Zonos.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};Zonos.showNotification=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.showNotification(n))};Zonos.updateOrganizationName=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};Zonos.disablePlaceOrderButtons=function(n){var e=n.autoEnable,o=e===void 0?true:e,r=n.config,t=n.disable,i=n.placeOrderButtonSelector;var a;if((a=r.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var u=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};s.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(t){n.setAttribute("disabled","true");n.addEventListener("click",u)}else{n.removeAttribute("disabled");n.removeEventListener("click",u)}}));if(o&&t){setTimeout((function(){s.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",u)}))}),5e3)}}};Zonos.injectController=function(n){var e=n.config;var o;if(document.querySelector("zonos-controller")){return}if((o=e.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=e.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:r});var t=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:r})}));t.observe(document.body,{childList:true,subtree:true})}var i=document.createElement("zonos-controller");i.config=e;i.zonosApiKey=_a.zonosApiKey||"";i.addEventListener("stripeInitEvent",(function(n){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;log("loading Stripe");return[4,zonosLoadStripe(e.publishableKey)];case 1:o=r.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;void i.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(i);_a.zonosController=i;log("Zonos controller injected!")};Zonos.injectScript=function(n){var e=n.cdnType,o=n.isModule,r=n.theRestUrl;var t=_a.getZonosUrl(e);var i="".concat(t,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var u=document.createElement("script");if(!!o){u.type="module"}else{u.noModule=true}u.src=i;u.crossOrigin="anonymous";u.onerror=function(){logError("Failed to load ".concat(u.src));var n=getNextFallbackUrl(e);if(!n){return}_a.injectScript({cdnType:n,isModule:o,theRestUrl:r})};s.appendChild(u)};Zonos.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||e()}return e()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(n){var e=n.cdnType,o=n.theRestUrl;var r=_a.getZonosUrl(e);var t=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");t.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(r,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var n=getNextFallbackUrl(e);if(!n){return}_a.injectStylesheet({cdnType:n,theRestUrl:o})};t.appendChild(a)};Zonos.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(INTER_FONT_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(INTER_FONT_REGEX.test(o.href)){continue}return o}return null};if(n()){log("Inter font already injected","warn");return}var e=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=INTER_FONT_URL;e.appendChild(o);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(INTER_FONT_URL,"/inter/inter.css");e.appendChild(r);log("Zonos font injected!")};Zonos.setupGoogleFont=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};Zonos.injectSupportGoogleFont=function(n){var e;log("[FONT] injecting ".concat(n));var o=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;r.appendChild(t)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);log("[FONT] ".concat(o," font injected!"))};export{Zonos};
@@ -1,4 +1,4 @@
1
- var __awaiter=this&&this.__awaiter||function(r,e,t,n){function o(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(n.next(r))}catch(r){a(r)}}function u(r){try{c(n["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):o(r.value).then(i,u)}c((n=n.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(n=1,o&&(a=u[0]&2?o["return"]:u[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,u[1])).done)return a;if(o=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;o=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];o=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-7798ac16.js";import{d as cartStore,u as stripeStoreHandleInventoryCheck,t as translate,r as cartStoreNextStep,h as cartStoreClearCheckoutInterval}from"./cart-4ba1878f.js";import{h as handleFetch,l as log,a as logError,j as jsonParse}from"./handleFetch-3dea7d46.js";import{t as tinycolor}from"./isDarkColor-4261bc3c.js";
1
+ var __awaiter=this&&this.__awaiter||function(r,e,t,n){function o(r){return r instanceof t?r:new t((function(e){e(r)}))}return new(t||(t=Promise))((function(t,a){function i(r){try{c(n.next(r))}catch(r){a(r)}}function u(r){try{c(n["throw"](r))}catch(r){a(r)}}function c(r){r.done?t(r.value):o(r.value).then(i,u)}c((n=n.apply(r,e||[])).next())}))};var __generator=this&&this.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(r){return function(e){return c([r,e])}}function c(u){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(n=1,o&&(a=u[0]&2?o["return"]:u[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,u[1])).done)return a;if(o=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;o=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=e.call(r,t)}catch(r){u=[6,r];o=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{z as zonosStore,c as createStore}from"./zonosStore-7798ac16.js";import{d as cartStore,u as stripeStoreHandleInventoryCheck,t as translate,r as cartStoreNextStep,h as cartStoreClearCheckoutInterval}from"./cart-911ba5dd.js";import{h as handleFetch,l as log,a as logError,j as jsonParse}from"./handleFetch-3dea7d46.js";import{t as tinycolor}from"./isDarkColor-4261bc3c.js";
2
2
  /*!
3
3
  * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
4
  * Copyright 2020-present, PayPal, Inc. All rights reserved.
@@ -14,4 +14,4 @@ var __awaiter=this&&this.__awaiter||function(r,e,t,n){function o(r){return r ins
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var n=createScriptElement(r,e);var o=t.cloneNode();delete o.dataset.uidAuto;if(Object.keys(o.dataset).length!==Object.keys(n.dataset).length){return null}var a=true;Object.keys(o.dataset).forEach((function(r){if(o.dataset[r]!==n.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,n=r.onSuccess,o=r.onError;var a=createScriptElement(e,t);a.onerror=o;a.onload=n;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var n=r;var o=Object.keys(n).filter((function(r){return typeof n[r]!=="undefined"&&n[r]!==null&&n[r]!==""})).reduce((function(r,e){var t=n[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),n=t.url,o=t.attributes;var a=o["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!o["data-js-sdk-library"]){o["data-js-sdk-library"]="paypal-js"}if(findScript(n,o)&&i){return e.resolve(i)}return loadCustomScript({url:n,attributes:o},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,n=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof n!=="undefined"&&typeof n!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:n,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n;var o=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,n=e.json;return[2,{errors:t,json:n}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n;var o=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"})];case 1:e=r.sent(),t=e.errors,n=e.json;return[2,{errors:t,json:n}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var n=tinycolor.readability(e,t);return n>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a,i;var u=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCreateOrder({checkoutSessionId:u})];case 1:n=r.sent(),o=n.errors,a=n.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(o.length||!i){throw new Error(((t=o.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,i]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:new URL(window.location.href);return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:n=r.sent(),o=n.errors,a=n.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(o.length||!i){throw new Error(((t=o.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var n=jsonParse(e.message);var o=(t=n===null||n===void 0?void 0:n.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(o===null||o===void 0?void 0:o.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,n=r.onPaypalSessionDone,o=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,n,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,6,,7]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;i.label=1;case 1:i.trys.push([1,3,,4]);r=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 2:r.inventoryCheckErrorMessage=i.sent();return[3,4];case 3:n=i.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,4];case 4:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 5:o=i.sent();return[2,o];case 6:a=i.sent();logError("Failed to create paypal order",a);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");t===null||t===void 0?void 0:t();return[2,""];case 7:return[2]}}))}))},onApprove:function(r,o){return __awaiter(void 0,void 0,void 0,(function(){var r,o;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;n===null||n===void 0?void 0:n({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:o=a.sent();logError("==== Failed to capture paypal order",o);if(o instanceof Error){return[2,paypalErrorHandler({error:o})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:o==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a;var i=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}n=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!n){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}o=zonosStore.zonosMode==="production"&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=window.Zonos;return[4,loadScript({clientId:n.token,currency:i,environment:o})];case 1:a.paypal=r.sent();log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var n=cartStore.checkoutSessionId;if(!n){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var o=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=o.map((function(e){var o;var a=null;try{a=((o=t.Buttons)===null||o===void 0?void 0:o.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:n,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};export{paypalStore as a,paypalStoreReset as b,paypalStoreInitButtons as c,isContrastColor as i,paypalInitScript as p,submitGtag as s};
17
+ */function findScript(r,e){var t=document.querySelector('script[src="'.concat(r,'"]'));if(t===null)return null;var n=createScriptElement(r,e);var o=t.cloneNode();delete o.dataset.uidAuto;if(Object.keys(o.dataset).length!==Object.keys(n.dataset).length){return null}var a=true;Object.keys(o.dataset).forEach((function(r){if(o.dataset[r]!==n.dataset[r]){a=false}}));return a?t:null}function insertScriptElement(r){var e=r.url,t=r.attributes,n=r.onSuccess,o=r.onError;var a=createScriptElement(e,t);a.onerror=o;a.onload=n;document.head.insertBefore(a,document.head.firstElementChild)}function processOptions(r){var e=r.environment;var t=e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete r.environment;if(r.sdkBaseUrl){t=r.sdkBaseUrl;delete r.sdkBaseUrl}var n=r;var o=Object.keys(n).filter((function(r){return typeof n[r]!=="undefined"&&n[r]!==null&&n[r]!==""})).reduce((function(r,e){var t=n[e].toString();e=camelCaseToKebabCase(e);if(e.substring(0,4)==="data"||e==="crossorigin"){r.attributes[e]=t}else{r.queryParams[e]=t}return r}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;if(a["merchant-id"]&&a["merchant-id"].indexOf(",")!==-1){i["data-merchant-id"]=a["merchant-id"];a["merchant-id"]="*"}return{url:"".concat(t,"?").concat(objectToQueryString(a)),attributes:i}}function camelCaseToKebabCase(r){var e=function(r,e){return(e?"-":"")+r.toLowerCase()};return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,e)}function objectToQueryString(r){var e="";Object.keys(r).forEach((function(t){if(e.length!==0)e+="&";e+=t+"="+r[t]}));return e}function createScriptElement(r,e){if(e===void 0){e={}}var t=document.createElement("script");t.src=r;Object.keys(e).forEach((function(r){t.setAttribute(r,e[r]);if(r==="data-csp-nonce"){t.setAttribute("nonce",e["data-csp-nonce"])}}));return t}function loadScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);if(typeof document==="undefined")return e.resolve(null);var t=processOptions(r),n=t.url,o=t.attributes;var a=o["data-namespace"]||"paypal";var i=getPayPalWindowNamespace(a);if(!o["data-js-sdk-library"]){o["data-js-sdk-library"]="paypal-js"}if(findScript(n,o)&&i){return e.resolve(i)}return loadCustomScript({url:n,attributes:o},e).then((function(){var r=getPayPalWindowNamespace(a);if(r){return r}throw new Error("The window.".concat(a," global variable is not available."))}))}function loadCustomScript(r,e){if(e===void 0){e=Promise}validateArguments(r,e);var t=r.url,n=r.attributes;if(typeof t!=="string"||t.length===0){throw new Error("Invalid url.")}if(typeof n!=="undefined"&&typeof n!=="object"){throw new Error("Expected attributes to be an object.")}return new e((function(r,e){if(typeof document==="undefined")return r();insertScriptElement({url:t,attributes:n,onSuccess:function(){return r()},onError:function(){var r=new Error('The script "'.concat(t,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(r)}})}))}function getPayPalWindowNamespace(r){return window[r]}function validateArguments(r,e){if(typeof r!=="object"||r===null){throw new Error("Expected an options object.")}var t=r.environment;if(t&&t!=="production"&&t!=="sandbox"){throw new Error('The `environment` option must be either "production" or "sandbox".')}if(typeof e!=="undefined"&&typeof e!=="function"){throw new Error("Expected PromisePonyfill to be a function.")}}var paypalCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n;var o=r.checkoutSessionId,a=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:a},method:"POST"})];case 1:e=r.sent(),t=e.errors,n=e.json;return[2,{errors:t,json:n}]}}))}))};var paypalCreateOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n;var o=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:return[4,handleFetch("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"})];case 1:e=r.sent(),t=e.errors,n=e.json;return[2,{errors:t,json:n}]}}))}))};var isContrastColor=function(r){var e=r.backgroundColor1,t=r.backgroundColor2;var n=tinycolor.readability(e,t);return n>2.5};var submitGtag=function(r){var e=zonosStore.checkoutSettings.analyticsProviders.find((function(r){return r.type==="GOOGLE_ANALYTICS"}));if(!e||(e===null||e===void 0?void 0:e.status)==="DISABLED"){return}if(typeof window.gtag==="function"){log("Zonos submits gtag event","log",r);window.gtag("event",r,{})}};var _c=createStore((function(){return{orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}})),paypalStoreReset=_c.reset,paypalStore=_c.state;var paypalStoreCreaterOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a,i;var u=r.checkoutSessionId;return __generator(this,(function(r){switch(r.label){case 0:return[4,paypalCreateOrder({checkoutSessionId:u})];case 1:n=r.sent(),o=n.errors,a=n.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCreate)===null||e===void 0?void 0:e.paypalOrderId;if(o.length||!i){throw new Error(((t=o.find(Boolean))===null||t===void 0?void 0:t.message)||"An unexpected error occurred when creating paypal order.")}return[2,i]}}))}))};var paypalStoreCaptureOrder=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a,i;var u=r.checkoutSessionId,c=r.paypalMockResponse;return __generator(this,(function(r){switch(r.label){case 0:new URL(window.location.href);return[4,paypalCaptureOrder({checkoutSessionId:u,paypalMockResponse:c})];case 1:n=r.sent(),o=n.errors,a=n.json;i=(e=a===null||a===void 0?void 0:a.paypalOrderCapture.order)===null||e===void 0?void 0:e.id;if(o.length||!i){throw new Error(((t=o.find(Boolean))===null||t===void 0?void 0:t.message)||translate("An unexpected error occurred when processing PayPal order."))}return[2,i]}}))}))};var paypalErrorHandler=function(r){var e=r.error;var t;var n=jsonParse(e.message);var o=(t=n===null||n===void 0?void 0:n.errors.find(Boolean))===null||t===void 0?void 0:t.message;var a=(o===null||o===void 0?void 0:o.match(/\[(.*?)\] (.*)/i))||[];if(!a){paypalStore.paypalErrorMessage=translate("An unexpected error occurred when processing PayPal order.")}var i=a[2]||translate("An unexpected error occurred when processing PayPal order.");paypalStore.paypalErrorMessage=i};var paypalButtonOptions=function(r){var e=r.checkoutSessionId,t=r.onPaypalFail,n=r.onPaypalSessionDone,o=r.overrideBorderRaidus,a=r.overridePrimaryColor;var i=a||zonosStore.appearance.colorPrimary;var u="#ffc33a";var c=isContrastColor({backgroundColor1:u,backgroundColor2:i||""});return{createOrder:function(){return __awaiter(void 0,void 0,void 0,(function(){var r,n,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,6,,7]);paypalStore.paypalErrorMessage=null;cartStore.inventoryCheckErrorMessage=null;i.label=1;case 1:i.trys.push([1,3,,4]);r=cartStore;return[4,stripeStoreHandleInventoryCheck()];case 2:r.inventoryCheckErrorMessage=i.sent();return[3,4];case 3:n=i.sent();cartStore.inventoryCheckErrorMessage=translate("Unable to check inventory. Please try again.");return[3,4];case 4:if(cartStore.inventoryCheckErrorMessage){return[2,""]}return[4,paypalStoreCreaterOrder({checkoutSessionId:e})];case 5:o=i.sent();return[2,o];case 6:a=i.sent();logError("Failed to create paypal order",a);paypalStore.paypalErrorMessage=translate("Failed to create PayPal order. Please try again, or consider using an alternative method.");t===null||t===void 0?void 0:t();return[2,""];case 7:return[2]}}))}))},onApprove:function(r,o){return __awaiter(void 0,void 0,void 0,(function(){var r,o;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);paypalStore.paypalErrorMessage=null;submitGtag("zonos-checkout-payment-info");return[4,paypalStoreCaptureOrder({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse})];case 1:r=a.sent();paypalStore.orderIdCreated=r;n===null||n===void 0?void 0:n({orderId:r});cartStoreNextStep();cartStoreClearCheckoutInterval();return[3,3];case 2:o=a.sent();logError("==== Failed to capture paypal order",o);if(o instanceof Error){return[2,paypalErrorHandler({error:o})]}t===null||t===void 0?void 0:t();return[3,3];case 3:return[2]}}))}))},style:{borderRadius:o==="SHARP"?0:10,color:c?"gold":"blue",shape:"rect"}}};var paypalStoreResetButtons=function(){if(!paypalStore.paypalButtons.length){return}paypalStore.paypalButtons.forEach((function(r){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,r.close()];case 1:e.sent();return[2]}}))}))}));paypalStore.paypalButtons=[]};var paypalInitScript=function(r){return __awaiter(void 0,[r],void 0,(function(r){var e,t,n,o,a;var i=r.currency;return __generator(this,(function(r){switch(r.label){case 0:t=!!((e=zonosStore.checkoutSettings.externalPaymentMethods)===null||e===void 0?void 0:e.find((function(r){return r.type==="PAYPAL"&&r.status==="ENABLED"})));if(!t){log("=== Paypal is disabled for this store","warn");return[2]}n=zonosStore.checkoutSettings.externalServiceTokens.find((function(r){return r.type==="PAYPAL_CLIENT_ID"}));if(!n){log("Failed to load paypal -- missing paypal publishable key","warn");return[2]}o=zonosStore.zonosMode==="production"&&zonosStore.checkoutSettings.mode==="LIVE"?"production":"sandbox";a=window.Zonos;return[4,loadScript({clientId:n.token,currency:i,environment:o})];case 1:a.paypal=r.sent();log("==== Paypal script loaded");return[2]}}))}))};var paypalStoreInitButtons=function(r){var e;var t=window.Zonos.paypal;if(!t){log("Paypal is not available");return null}var n=cartStore.checkoutSessionId;if(!n){log("Paypal is not available due to checkoutSessionId is not available");return null}log("==== Loading Paypal buttons");paypalStoreResetButtons();var o=[(e=t.FUNDING)===null||e===void 0?void 0:e.PAYPAL].filter(Boolean);paypalStore.paypalButtons=o.map((function(e){var o;var a=null;try{a=((o=t.Buttons)===null||o===void 0?void 0:o.call(t,Object.assign(Object.assign({},paypalButtonOptions(Object.assign({checkoutSessionId:n,fundingSource:e},r))),{fundingSource:e})))||null}catch(r){log("===== Failed to load paypal's \"".concat(e,'" button'),"warn",r)}if(a===null||a===void 0?void 0:a.isEligible()){log("==== Paypal button ".concat(e," loaded"));return a}return null})).filter(Boolean);return paypalStore.paypalButtons};var paypalStoreHasPaypalEnabled=function(){var r,e;var t=((e=(r=zonosStore.checkoutSettings.externalPaymentMethods)===null||r===void 0?void 0:r.find((function(r){return r.type==="PAYPAL"})))===null||e===void 0?void 0:e.status)==="ENABLED";return t||!!paypalStore.paypalButtons.length};export{paypalInitScript as a,paypalStore as b,paypalStoreReset as c,paypalStoreInitButtons as d,isContrastColor as i,paypalStoreHasPaypalEnabled as p,submitGtag as s};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,s,t){function n(e){return e instanceof s?e:new s((function(o){o(e)}))}return new(s||(s=Promise))((function(s,i){function a(e){try{d(t.next(e))}catch(e){i(e)}}function r(e){try{d(t["throw"](e))}catch(e){i(e)}}function d(e){e.done?s(e.value):n(e.value).then(a,r)}d((t=t.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,n,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(e){return function(o){return d([e,o])}}function d(r){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(s=0)),s)try{if(t=1,n&&(i=r[0]&2?n["return"]:r[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;if(n=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:false};case 5:s.label++;n=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){s=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(r[0]===6&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}if(i[2])s.ops.pop();s.trys.pop();continue}r=o.call(e,s)}catch(e){r=[6,e];n=0}finally{t=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,d as getElement}from"./index-86b8247e.js";import{j as stripeStore,P as getFallbackDefaultCountryCode,l as localizationStore,t as translate}from"./cart-4ba1878f.js";import{i as isCheckoutMobile}from"./isCheckoutMobile-8846dccb.js";import{a as logError,l as log}from"./handleFetch-3dea7d46.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-2d8810c3.js";import{z as zonosStore,d as zonosStoreFontFamily}from"./zonosStore-7798ac16.js";import{c as classes}from"./classes-0d95c529.js";import{R as RemoveIcon$1}from"./RemoveIcon-9dc5dd1a.js";import{g as getBorderRadius}from"./getBorderRadius-e55a9df1.js";import{i as isDarkColor}from"./isDarkColor-4261bc3c.js";var zonosAddressCss=".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";var ZonosAddressStyle0=zonosAddressCss;var ZonosAddress=function(){function e(e){registerInstance(this,e);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe;this.isDirtyAddress=false}e.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};e.prototype.updateAddressEventData=function(e){var o=e.event,s=e.type;switch(s){case"billing":stripeStore.stripeBillingAddressEventData=o;break;default:stripeStore.stripeAddressEventData=o;break}};e.prototype.updateAddressElement=function(e){var o=e.stripeAddressElement,s=e.type;if(s==="shipping"){stripeStore.stripeAddressElement=o;return}stripeStore.stripeBillingAddressElement=o};e.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,s,t,n,i,a,r,d,l,c;var h=this;return __generator(this,(function(f){this.stripe=window.Zonos.stripe;s=this.getStripeAddressInstance(),t=s.stripeAddressEventData,n=s.stripeElements;if(!this.stripe||!n){logError("Stripe is not initialized. Couldn't load stripe element.");return[2]}i=(e=this.defaultAddress)===null||e===void 0?void 0:e.phone;if(!i){(o=this.defaultAddress)===null||o===void 0?true:delete o.phone}a=localizationStore.shippingZoneCountries;r=a?Object.values(a).map((function(e){return e.code})):[];d=this.type==="shipping"?r:[];l=(t===null||t===void 0?void 0:t.value.address.country)||getFallbackDefaultCountryCode(d);log("Stripe country code: ".concat(l),"info");c=n.create("address",{allowedCountries:d,contacts:this.defaultAddress&&!t?[this.defaultAddress]:[],defaultValues:{address:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.value.address),{country:l}),firstName:t===null||t===void 0?void 0:t.value.firstName,lastName:t===null||t===void 0?void 0:t.value.lastName,phone:t===null||t===void 0?void 0:t.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});c.mount(this.el.querySelector(".zonos--address-component"));c.on("change",(function(e){var o=e.value;if(!h.isDirtyAddress&&o.address.line1.length>=3){h.isDirtyAddress=true;setTimeout((function(){if(isCheckoutMobile()){h.el.scrollIntoView({behavior:"smooth",block:"end"})}else{var e=h.type==="shipping"?100:600;var o=h.el.closest(".zonos--group");var s=h.el.getBoundingClientRect().top+e;o===null||o===void 0?void 0:o.scrollTo({behavior:"smooth",top:s})}}),600)}h.updateAddressEventData({event:Object.assign(Object.assign({},e),{elementMode:h.type,elementType:"address",value:Object.assign(Object.assign({},o),{firstName:o.firstName||o.name.split(" ")[0],lastName:o.lastName||o.name.split(" ")[1]})}),type:h.type})}));this.updateAddressElement({stripeAddressElement:c,type:this.type});return[2]}))}))};e.prototype.disconnectedCallback=function(){var e=this.getStripeAddressInstance().stripeAddressElement;e===null||e===void 0?void 0:e.destroy()};e.prototype.componentDidLoad=function(){var e=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!e&&e.value.address.line1.length>0;void this.watchInitStripe()};e.prototype.render=function(){return h(Host,{key:"23c06d9f7740b43f58f946f92a5357931e6fe256",class:"zonos--address zonos--elements"},h("zonos-text",{key:"7eed670aa6fbb3eba5a25394f7e02d9cb7aa3bd8",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"61e461713bebb42c8f989a7e08e7bc62a572ace8",class:"zonos--address-component"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return e}();ZonosAddress.style=ZonosAddressStyle0;var zonosAddressDisplayCss=':host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}';var ZonosAddressDisplayStyle0=zonosAddressDisplayCss;var ZonosAddressDisplay=function(){function e(e){registerInstance(this,e);this.currentAddress=undefined;this.addressType=undefined}e.prototype.render=function(){var e;var o=this.currentAddress,s=o.city,t=o.country,n=o.email,i=o.line1,a=o.line2,r=o.name,d=o.phone,l=o.postal_code,c=o.state;var f=(e=localizationStore.shippingZoneCountries)===null||e===void 0?void 0:e[t];var u=function(e){var o=e.bold,s=e.content;var t=isTextContainsNonLatinChars(s)?"red-600":"gray-1000";return h("zonos-text",{textColor:t,type:o?"boldLabel":"body"},s)};return h(Host,{class:"zonos--address-form zonos--elements"},h("div",{class:"zonos--title"},h("zonos-text",{textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{class:"zonos--address-group"},r&&h("div",{class:"zonos--address-line"},u({bold:true,content:r})),n&&h("div",{class:"zonos--address-line"},u({content:n})),d&&h("div",{class:"zonos--address-line"},u({content:d})),i&&h("div",{class:"zonos--address-line"},u({content:i})),a&&h("div",{class:"zonos--address-line"},u({content:a})),h("div",{class:"zonos--address-line"},s&&u({content:s}),c&&u({content:c}),l&&u({content:l})),f&&h("div",{class:"zonos--address-line"},h("zonos-country-flag",{class:"zonos--country-flag",countryCode:f.code})," ",u({content:f.displayName}))))};return e}();ZonosAddressDisplay.style=ZonosAddressDisplayStyle0;var zonosAddressFormCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";var ZonosAddressFormStyle0=zonosAddressFormCss;var ZonosAddressForm=function(){function e(e){var o=this;registerInstance(this,e);this.addressChange=createEvent(this,"addressChange",7);this.onInputChange=function(e){var s;var t=e.key,n=e.value;o.addressChange.emit(Object.assign(Object.assign({},o.localAddress),(s={},s[t]=n,s)))};this.currentAddress=undefined;this.translatedAddress=undefined;this.addressType=undefined;this.localAddress=this.currentAddress}e.prototype.watchCurrentAddress=function(){var e,o,s,t,n,i;var a=this.currentAddress,r=a.city,d=a.line1,l=a.line2,c=a.name,h=a.postal_code,f=a.state;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((e=this.translatedAddress.city)===null||e===void 0?void 0:e[r])||r,line1:((o=this.translatedAddress.line1)===null||o===void 0?void 0:o[d])||d,line2:((s=this.translatedAddress.line2)===null||s===void 0?void 0:s[l])||l,name:((t=this.translatedAddress.name)===null||t===void 0?void 0:t[c])||c,postal_code:((n=this.translatedAddress.postal_code)===null||n===void 0?void 0:n[h])||h,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[f])||f})};e.prototype.componentWillLoad=function(){this.watchCurrentAddress()};e.prototype.render=function(){var e=this;var o=this.localAddress,s=o.city,t=o.country,n=o.line1,i=o.line2,a=o.name,r=o.phone,d=o.postal_code,l=o.state;var c=a.split(" ")[0]||"";var f=a.split(" ").slice(1).join(" ")||"";return h(Host,{key:"8b578737e33203a23563be7e9be0778deec99bbf",class:"zonos--address-form zonos--elements"},h("div",{key:"793675a1348547bf3f781788956befe325191011",class:"zonos--title"},h("zonos-text",{key:"13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"2c5de5b5283fb99ee5f8b61d7a217177986fc2db",class:"zonos--address-group"},h("div",{key:"23bf3c893071000d5995a5f175867bab11929193",class:"zonos--contact"},h("zonos-text",{key:"7cdfe2a84ebad89ba5b16498d75def99cf392384",type:"label"},translate("Contact")),h("zonos-input",{key:"1c39c38767fd306c5eb1164cdc989b8291209cf0",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"cbdf61217125e22b1a6cec9a340ef0aca2c75670",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"360c99e7b2c6caa64580d5768b5bb53368927275",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(o){return e.onInputChange({key:"name",value:"".concat(o.detail," ").concat(f)})}}),h("zonos-input",{key:"8ce5fa5c15c6f7928339ea10009ce0e68954a91f",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:f,isError:isTextContainsNonLatinChars(f),onInputChange:function(o){return e.onInputChange({key:"name",value:"".concat(c," ").concat(o.detail)})}}))),h("div",{key:"7b4fa2d3baa6cb257e7688e5ba6777123898b3fd",class:"zonos--address"},h("zonos-text",{key:"9d5782331b2642755a755aeb7f98c9f4d87f9a20",type:"label"},translate("Address")),h("zonos-input",{key:"a622025924ca86bdbf1d3c04b79e6dee172b4c42",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:t,isDisabled:true}),h("zonos-input",{key:"f99b3a74db09ab5730878e80705b9aeac76bf800",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:n,isError:isTextContainsNonLatinChars(n),onInputChange:function(o){return e.onInputChange({key:"line1",value:o.detail})}}),h("zonos-input",{key:"5d16aefa45a78045c87d166aaaec0255606e455e",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(o){return e.onInputChange({key:"line2",value:o.detail})}}),h("div",{key:"dc166be9381142835d72e731cb38a718522a068a",class:"zonos--address-row"},h("zonos-input",{key:"4f1a98f9d10ce0cff3ef18a3037a12382552b31d",class:"zonos--form-city",inputLabel:translate("City"),inputValue:s,isError:isTextContainsNonLatinChars(s),onInputChange:function(o){return e.onInputChange({key:"city",value:o.detail})}}),h("zonos-input",{key:"d4f97900b5fe2e1619950a52d1d1f716a8bc19ff",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:l,isError:isTextContainsNonLatinChars(l),onInputChange:function(o){return e.onInputChange({key:"state",value:o.detail})}})),h("zonos-input",{key:"cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:d,isError:isTextContainsNonLatinChars(d),onInputChange:function(o){return e.onInputChange({key:"postal_code",value:o.detail})}}),h("zonos-input",{key:"7421c82847eded6bdbcce49ef8196124d8e50c1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:r,onInputChange:function(o){return e.onInputChange({key:"phone",value:o.detail})}}))))};Object.defineProperty(e,"watchers",{get:function(){return{translatedAddress:["watchCurrentAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressForm.style=ZonosAddressFormStyle0;var zonosAddressUpdateDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";var ZonosAddressUpdateDialogStyle0=zonosAddressUpdateDialogCss;var ZonosAddressUpdateDialog=function(){function e(e){var o=this;registerInstance(this,e);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);this.closeUpdateDialogHandler=function(){o.closeUpdateDialog.emit()};this.getTranslatedAddress=function(e){var o=e.currentAddress,s=e.translatedAddress;var t,n,i,a,r,d;var l=o.city,c=o.line1,h=o.line2,f=o.name,u=o.postal_code,b=o.state;return{city:((t=s.city)===null||t===void 0?void 0:t[l])||l,line1:((n=s.line1)===null||n===void 0?void 0:n[c])||c,line2:((i=s.line2)===null||i===void 0?void 0:i[h])||h,name:((a=s.name)===null||a===void 0?void 0:a[f])||f,postal_code:((r=s.postal_code)===null||r===void 0?void 0:r[u])||u,state:((d=s.state)===null||d===void 0?void 0:d[b])||b}};this.continueClickHandler=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,s,t,n,i,a,r,d,l,c,h,f;return __generator(this,(function(u){this.continueLoading=true;t=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.shippingAddress.country}));a=t&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},t),{country:this.billingAddress.country}));r=!!Object.keys(i).length;d=!!a&&!!Object.keys(a).length;if(r||d){l=(e=this.el.shadowRoot)===null||e===void 0?void 0:e.querySelectorAll("zonos-address-form");c=l===null||l===void 0?void 0:l[0];h=l===null||l===void 0?void 0:l[1];f=((o=c===null||c===void 0?void 0:c.shadowRoot)===null||o===void 0?void 0:o.querySelector(".has-error"))||((s=h===null||h===void 0?void 0:h.shadowRoot)===null||s===void 0?void 0:s.querySelector(".has-error"));if(f){f.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2]}this.continueClicked.emit({billingAddress:t,shippingAddress:n});return[2]}))}))};this.buildTranslateAddressState=function(e){var o,s,t,n,i,a;var r=e.currentAddress,d=e.translatedAddress;var l=r.city,c=r.line1,h=r.line2,f=r.name,u=r.postal_code,b=r.state;return{city:(o={},o[l]=d.city,o),line1:(s={},s[c]=d.line1,s),line2:(t={},t[h]=d.line2,t),name:(n={},n[f]=d.name,n),postal_code:(i={},i[u]=d.postal_code,i),state:(a={},a[b]=d.state,a)}};this.continueLoading=false;this.dialogLoading=undefined;this.dialogOpen=false;this.submitBtnType=undefined;this.submitBtnColor=undefined;this.isMobile=false;this.shippingAddress=undefined;this.billingAddress=undefined;this.translatedShippingAddress=undefined;this.translatedBillingAddress=undefined;this.showErrorBanner=false;this.translatedShippingAddressState={};this.translatedBillingAddressState={}}e.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};e.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};e.prototype.componentWillLoad=function(){this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};e.prototype.render=function(){var e=this;var o=this.submitBtnColor||zonosStore.appearance.colorSecondary;var s=o==="#ffffff"?"outline":this.submitBtnType||"standard";var t=this.billingAddress;var n=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"66abf7b74045e68e84e631298504236d32ca9c4e",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeUpdateDialogHandler()}})),h("zonos-text",{key:"ffb3d8f169867d5f6dff269e1becd99c98c5a7da"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"2cb61f06ce174e2317870decfdd337c67c5cf128",class:"zonos--group"},h("zonos-text",{key:"a616c540984120b468e52bccfb380ea3974ced22",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"6ac8f9c14472370c501af1b0d50bd8f8746b7694",class:"zonos--address-display-group"},h("zonos-address-display",{key:"ea2c67a7bba51c99f80be968e448beeffcf1f863",addressType:"shipping",currentAddress:n}),t&&h("zonos-address-display",{key:"7ea1683dc04a292810e04ed6550d86086f25186f",addressType:"billing",currentAddress:t})),h("div",{key:"4d1cd9096943518b8b4e267608a5e1542befb6a9",class:"zonos--address-form-section"},h("zonos-text",{key:"e4184a2cc618d26d43979fa8cfe06070cf8b5af8",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"c55d9d3c658565ceb7c7b879f444e3937b9f7ad6",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:function(o){var s=o.detail;e.translatedShippingAddressState=e.buildTranslateAddressState({currentAddress:n,translatedAddress:s})},translatedAddress:this.translatedShippingAddressState}),t&&h("zonos-address-form",{key:"c3facc295b1322bb00baa6081f343dcea4f10777",addressType:"billing",class:"zonos--billing-address-form",currentAddress:t,onAddressChange:function(o){var s=o.detail;e.translatedBillingAddressState=e.buildTranslateAddressState({currentAddress:t,translatedAddress:s})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"1c89c9604ba0dece40275fcfac97e7f93706b430",class:"zonos--group-btn"},h("div",{key:"e47d393940b094b4e123864e4070daa87f0616f0",class:"zonos--button-wrapper"},h("zonos-button",{key:"216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6",class:"zonos--cancel-btn",onClick:function(){return e.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"acbacb92cedb325b46843d8f3aff13f4e7c86ab5",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return e.continueClickHandler()},size:"sm",variant:s},translate("Update address")))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressUpdateDialog.style=ZonosAddressUpdateDialogStyle0;var colorPrefixes=["blue","cyan","green","orange","purple","red","gray","glass"];var zonosCheckboxCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--size);width:var(--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--background-color);border-radius:var(--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";var ZonosCheckboxStyle0=zonosCheckboxCss;var ZonosCheckbox=function(){function e(e){registerInstance(this,e);this.checkboxSelected=createEvent(this,"checkboxSelected",7);this.backgroundColor="blue";this.label=undefined;this.isChecked=false;this.isDisabled=false;this.size=12;this.fontSize="base";this.borderStyle=undefined}e.prototype.onClick=function(){if(this.isDisabled){return}this.checkboxSelected.emit(!this.isChecked)};e.prototype.render=function(){var e=this;var o=colorPrefixes.includes(this.backgroundColor);var s=o?"var(--zonos-elements-".concat(this.backgroundColor,"-600)"):this.backgroundColor;var t=o?"var(--zonos-elements-".concat(this.backgroundColor,"-200)"):!isDarkColor(s)?"var(--zonos-elements-gray-800)":"var(--zonos-elements-gray-0)";var n=getBorderRadius({customRoundRadius:"4px",overrideBorderStyle:this.borderStyle});return h(Host,{key:"8613d885c639d01671743dbdb0583c390718c732",class:classes(["zonos--elements zonos--checkbox"]),style:{"--background-color":s,"--border-radius":n,"--font-family":zonosStoreFontFamily(),"--size":"".concat(this.size,"px")}},h("label",{key:"803434d7a63e1735bf0ef15a9e4c7fb515bfff41",class:classes([this.isDisabled&&"disabled"])},h("input",{key:"a19a46a896597f4c47d4ec790a21b5133c13b952",checked:this.isChecked,disabled:this.isDisabled,hidden:true,onChange:function(o){e.checkboxSelected.emit(o.target.checked)},type:"checkbox"}),h("span",{key:"7f4b933f9626bc05f052d79fa25a0c46ee16f492",class:"checkmark-container"},h("svg",{key:"775d0b011a1430f712e8f633e2850d6f6e193f36",class:"checkmark",color:t,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},h("path",{key:"eef97178731ac1bf9885d5cfd57afa514c20df5f","clip-rule":"evenodd",d:"M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z",fill:"currentColor","fill-rule":"evenodd"}))),this.label&&h("zonos-text",{key:"0f72347f0b21817cd176393219374008a056b590",size:this.fontSize},this.label)))};return e}();ZonosCheckbox.style=ZonosCheckboxStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--min-height, auto);height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";var ZonosDialogStyle0=zonosDialogCss;var ZonosDialog=function(){function e(e){var o=this;registerInstance(this,e);this.closeDialog=createEvent(this,"closeDialog",3);this.isMobileMode=function(){return o.mobile||window.innerWidth<=768};this.closeButtonHandler=function(){if(!o.open){return}o.closeDialog.emit()};this.clickOutsideDialogHandler=function(e){if(e.target===e.currentTarget&&!o.noClickOutside){o.closeDialog.emit()}};this.open=false;this.headerText="";this.width="460px";this.height=undefined;this.minHeight=undefined;this.noHeader=false;this.noBodyPadding=false;this.noBorder=false;this.borderStyle=undefined;this.noCloseButton=false;this.noClickOutside=false;this.mobile=false;this.isLoading=true;this.isMobile=false}e.prototype.handleWindowResize=function(){this.isMobile=this.isMobileMode()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.closeButtonHandler()}};e.prototype.componentDidLoad=function(){this.isMobile=this.isMobileMode()};e.prototype.render=function(){if(this.open){document.body.style.overflow="hidden"}else{document.body.style.overflow="auto"}var e=getBorderRadius({overrideBorderStyle:this.borderStyle});return h(Host,{key:"0ba21daff1a07b91701cec30ff80c0b10a8f5344",class:classes(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--border-radius":e,"--font-family":zonosStoreFontFamily(),"--height":this.height||"initial","--min-height":this.minHeight||"500px","--width":this.width}},h("div",{key:"84c2c67ff9b89cf28cd7864a79e76daf9d0c5093",class:"zonos--backdrop"}),h("div",{key:"c621463f2ca3721aacfdf666b0dd5a4749dd385a",class:"zonos--dialog-layout",inert:!this.open,onClick:this.clickOutsideDialogHandler},h("div",{key:"61bf1362b55f4a7e515f3ab1b4fd9a0e1e1794b2",class:"zonos--dialog"},this.isLoading&&h("div",{key:"c84edec7ec322fc6a7eaf17ed54aeffd23dd4480",class:"zonos--loading"},h("zonos-spinner",{key:"4f8e004e7286d053f195f9eea578dc416ff1d142",size:30})),(this.headerText||!this.noCloseButton)&&h("div",{key:"196316fc1ec1e099b87ea36829d334c45c3a6a24",class:"zonos--header"},this.headerText&&h("h3",{key:"452ba8e853ffe1fc278e4cb48dbdcc407d5257e6",class:"zonos--header-text"},this.headerText),!this.noCloseButton&&h("zonos-button",{key:"40933095b20bf1a993e142d58df10b50c0359b23",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close dialog",content:RemoveIcon}),noBackground:true,onClick:this.closeButtonHandler,variant:"subtle"})),h("div",{key:"69a696e723483aafa595176dace2ed8bc3274836",class:classes(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},h("slot",{key:"53f5ea4e4bab900f4ddf720e3589862a40e3e91f"})),h("slot",{key:"1f7628b5749261e4e5ad703a78b5c9b276ad18e9",name:"dialog-footer"}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosDialog.style=ZonosDialogStyle0;var zonosLinkAuthenticationCss=".sc-zonos-link-authentication-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}";var ZonosLinkAuthenticationStyle0=zonosLinkAuthenticationCss;var ZonosLinkAuthentication=function(){function e(e){registerInstance(this,e);this.titleText=undefined;this.defaultEmail=null;this.stripe=stripeStore.stripe}e.prototype.watchInitStripe=function(){if(!this.stripe||!stripeStore.stripeElements){return}var e=this.defaultEmail?{email:this.defaultEmail}:undefined;var o=stripeStore.stripeLinkElement||stripeStore.stripeElements.create("linkAuthentication",{defaultValues:e||undefined});var s=this.el.querySelector(".zonos--link-authentication-component");if(!s){logError("Cannot find container element for linkAuthenticationElement");return}o.mount(s);o.on("change",(function(e){stripeStore.stripeLinkEventData=e}));stripeStore.stripeLinkElement=o};e.prototype.componentDidLoad=function(){this.watchInitStripe()};e.prototype.render=function(){return h(Host,{key:"0aaba985027ef855e981049783641b38ec1b1afd",class:"zonos--link-authentication zonos--elements"},h("zonos-text",{key:"8fbb7a2f95c02d975f4b94c70e68be764d53d76e",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"adc585cf1fa7ea763e9c5ae4e5be623b2d8f6627",class:"zonos--link-authentication-component"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return e}();ZonosLinkAuthentication.style=ZonosLinkAuthenticationStyle0;export{ZonosAddress as zonos_address,ZonosAddressDisplay as zonos_address_display,ZonosAddressForm as zonos_address_form,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosCheckbox as zonos_checkbox,ZonosDialog as zonos_dialog,ZonosLinkAuthentication as zonos_link_authentication};
1
+ var __awaiter=this&&this.__awaiter||function(e,o,s,t){function n(e){return e instanceof s?e:new s((function(o){o(e)}))}return new(s||(s=Promise))((function(s,i){function a(e){try{d(t.next(e))}catch(e){i(e)}}function r(e){try{d(t["throw"](e))}catch(e){i(e)}}function d(e){e.done?s(e.value):n(e.value).then(a,r)}d((t=t.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,n,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(e){return function(o){return d([e,o])}}function d(r){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(s=0)),s)try{if(t=1,n&&(i=r[0]&2?n["return"]:r[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;if(n=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:false};case 5:s.label++;n=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){s=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(r[0]===6&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}if(i[2])s.ops.pop();s.trys.pop();continue}r=o.call(e,s)}catch(e){r=[6,e];n=0}finally{t=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,d as getElement}from"./index-86b8247e.js";import{j as stripeStore,P as getFallbackDefaultCountryCode,l as localizationStore,t as translate}from"./cart-911ba5dd.js";import{i as isCheckoutMobile}from"./isCheckoutMobile-8846dccb.js";import{a as logError,l as log}from"./handleFetch-3dea7d46.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-2d8810c3.js";import{z as zonosStore,d as zonosStoreFontFamily}from"./zonosStore-7798ac16.js";import{c as classes}from"./classes-0d95c529.js";import{R as RemoveIcon$1}from"./RemoveIcon-9dc5dd1a.js";import{g as getBorderRadius}from"./getBorderRadius-e55a9df1.js";import{i as isDarkColor}from"./isDarkColor-4261bc3c.js";var zonosAddressCss=".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";var ZonosAddressStyle0=zonosAddressCss;var ZonosAddress=function(){function e(e){registerInstance(this,e);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe;this.isDirtyAddress=false}e.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};e.prototype.updateAddressEventData=function(e){var o=e.event,s=e.type;switch(s){case"billing":stripeStore.stripeBillingAddressEventData=o;break;default:stripeStore.stripeAddressEventData=o;break}};e.prototype.updateAddressElement=function(e){var o=e.stripeAddressElement,s=e.type;if(s==="shipping"){stripeStore.stripeAddressElement=o;return}stripeStore.stripeBillingAddressElement=o};e.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,s,t,n,i,a,r,d,l,c;var h=this;return __generator(this,(function(f){this.stripe=window.Zonos.stripe;s=this.getStripeAddressInstance(),t=s.stripeAddressEventData,n=s.stripeElements;if(!this.stripe||!n){logError("Stripe is not initialized. Couldn't load stripe element.");return[2]}i=(e=this.defaultAddress)===null||e===void 0?void 0:e.phone;if(!i){(o=this.defaultAddress)===null||o===void 0?true:delete o.phone}a=localizationStore.shippingZoneCountries;r=a?Object.values(a).map((function(e){return e.code})):[];d=this.type==="shipping"?r:[];l=(t===null||t===void 0?void 0:t.value.address.country)||getFallbackDefaultCountryCode(d);log("Stripe country code: ".concat(l),"info");c=n.create("address",{allowedCountries:d,contacts:this.defaultAddress&&!t?[this.defaultAddress]:[],defaultValues:{address:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.value.address),{country:l}),firstName:t===null||t===void 0?void 0:t.value.firstName,lastName:t===null||t===void 0?void 0:t.value.lastName,phone:t===null||t===void 0?void 0:t.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});c.mount(this.el.querySelector(".zonos--address-component"));c.on("change",(function(e){var o=e.value;if(!h.isDirtyAddress&&o.address.line1.length>=3){h.isDirtyAddress=true;setTimeout((function(){if(isCheckoutMobile()){h.el.scrollIntoView({behavior:"smooth",block:"end"})}else{var e=h.type==="shipping"?100:600;var o=h.el.closest(".zonos--group");var s=h.el.getBoundingClientRect().top+e;o===null||o===void 0?void 0:o.scrollTo({behavior:"smooth",top:s})}}),600)}h.updateAddressEventData({event:Object.assign(Object.assign({},e),{elementMode:h.type,elementType:"address",value:Object.assign(Object.assign({},o),{firstName:o.firstName||o.name.split(" ")[0],lastName:o.lastName||o.name.split(" ")[1]})}),type:h.type})}));this.updateAddressElement({stripeAddressElement:c,type:this.type});return[2]}))}))};e.prototype.disconnectedCallback=function(){var e=this.getStripeAddressInstance().stripeAddressElement;e===null||e===void 0?void 0:e.destroy()};e.prototype.componentDidLoad=function(){var e=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!e&&e.value.address.line1.length>0;void this.watchInitStripe()};e.prototype.render=function(){return h(Host,{key:"23c06d9f7740b43f58f946f92a5357931e6fe256",class:"zonos--address zonos--elements"},h("zonos-text",{key:"7eed670aa6fbb3eba5a25394f7e02d9cb7aa3bd8",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"61e461713bebb42c8f989a7e08e7bc62a572ace8",class:"zonos--address-component"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return e}();ZonosAddress.style=ZonosAddressStyle0;var zonosAddressDisplayCss=':host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}';var ZonosAddressDisplayStyle0=zonosAddressDisplayCss;var ZonosAddressDisplay=function(){function e(e){registerInstance(this,e);this.currentAddress=undefined;this.addressType=undefined}e.prototype.render=function(){var e;var o=this.currentAddress,s=o.city,t=o.country,n=o.email,i=o.line1,a=o.line2,r=o.name,d=o.phone,l=o.postal_code,c=o.state;var f=(e=localizationStore.shippingZoneCountries)===null||e===void 0?void 0:e[t];var u=function(e){var o=e.bold,s=e.content;var t=isTextContainsNonLatinChars(s)?"red-600":"gray-1000";return h("zonos-text",{textColor:t,type:o?"boldLabel":"body"},s)};return h(Host,{class:"zonos--address-form zonos--elements"},h("div",{class:"zonos--title"},h("zonos-text",{textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{class:"zonos--address-group"},r&&h("div",{class:"zonos--address-line"},u({bold:true,content:r})),n&&h("div",{class:"zonos--address-line"},u({content:n})),d&&h("div",{class:"zonos--address-line"},u({content:d})),i&&h("div",{class:"zonos--address-line"},u({content:i})),a&&h("div",{class:"zonos--address-line"},u({content:a})),h("div",{class:"zonos--address-line"},s&&u({content:s}),c&&u({content:c}),l&&u({content:l})),f&&h("div",{class:"zonos--address-line"},h("zonos-country-flag",{class:"zonos--country-flag",countryCode:f.code})," ",u({content:f.displayName}))))};return e}();ZonosAddressDisplay.style=ZonosAddressDisplayStyle0;var zonosAddressFormCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";var ZonosAddressFormStyle0=zonosAddressFormCss;var ZonosAddressForm=function(){function e(e){var o=this;registerInstance(this,e);this.addressChange=createEvent(this,"addressChange",7);this.onInputChange=function(e){var s;var t=e.key,n=e.value;o.addressChange.emit(Object.assign(Object.assign({},o.localAddress),(s={},s[t]=n,s)))};this.currentAddress=undefined;this.translatedAddress=undefined;this.addressType=undefined;this.localAddress=this.currentAddress}e.prototype.watchCurrentAddress=function(){var e,o,s,t,n,i;var a=this.currentAddress,r=a.city,d=a.line1,l=a.line2,c=a.name,h=a.postal_code,f=a.state;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((e=this.translatedAddress.city)===null||e===void 0?void 0:e[r])||r,line1:((o=this.translatedAddress.line1)===null||o===void 0?void 0:o[d])||d,line2:((s=this.translatedAddress.line2)===null||s===void 0?void 0:s[l])||l,name:((t=this.translatedAddress.name)===null||t===void 0?void 0:t[c])||c,postal_code:((n=this.translatedAddress.postal_code)===null||n===void 0?void 0:n[h])||h,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[f])||f})};e.prototype.componentWillLoad=function(){this.watchCurrentAddress()};e.prototype.render=function(){var e=this;var o=this.localAddress,s=o.city,t=o.country,n=o.line1,i=o.line2,a=o.name,r=o.phone,d=o.postal_code,l=o.state;var c=a.split(" ")[0]||"";var f=a.split(" ").slice(1).join(" ")||"";return h(Host,{key:"8b578737e33203a23563be7e9be0778deec99bbf",class:"zonos--address-form zonos--elements"},h("div",{key:"793675a1348547bf3f781788956befe325191011",class:"zonos--title"},h("zonos-text",{key:"13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"2c5de5b5283fb99ee5f8b61d7a217177986fc2db",class:"zonos--address-group"},h("div",{key:"23bf3c893071000d5995a5f175867bab11929193",class:"zonos--contact"},h("zonos-text",{key:"7cdfe2a84ebad89ba5b16498d75def99cf392384",type:"label"},translate("Contact")),h("zonos-input",{key:"1c39c38767fd306c5eb1164cdc989b8291209cf0",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"cbdf61217125e22b1a6cec9a340ef0aca2c75670",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"360c99e7b2c6caa64580d5768b5bb53368927275",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(o){return e.onInputChange({key:"name",value:"".concat(o.detail," ").concat(f)})}}),h("zonos-input",{key:"8ce5fa5c15c6f7928339ea10009ce0e68954a91f",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:f,isError:isTextContainsNonLatinChars(f),onInputChange:function(o){return e.onInputChange({key:"name",value:"".concat(c," ").concat(o.detail)})}}))),h("div",{key:"7b4fa2d3baa6cb257e7688e5ba6777123898b3fd",class:"zonos--address"},h("zonos-text",{key:"9d5782331b2642755a755aeb7f98c9f4d87f9a20",type:"label"},translate("Address")),h("zonos-input",{key:"a622025924ca86bdbf1d3c04b79e6dee172b4c42",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:t,isDisabled:true}),h("zonos-input",{key:"f99b3a74db09ab5730878e80705b9aeac76bf800",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:n,isError:isTextContainsNonLatinChars(n),onInputChange:function(o){return e.onInputChange({key:"line1",value:o.detail})}}),h("zonos-input",{key:"5d16aefa45a78045c87d166aaaec0255606e455e",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(o){return e.onInputChange({key:"line2",value:o.detail})}}),h("div",{key:"dc166be9381142835d72e731cb38a718522a068a",class:"zonos--address-row"},h("zonos-input",{key:"4f1a98f9d10ce0cff3ef18a3037a12382552b31d",class:"zonos--form-city",inputLabel:translate("City"),inputValue:s,isError:isTextContainsNonLatinChars(s),onInputChange:function(o){return e.onInputChange({key:"city",value:o.detail})}}),h("zonos-input",{key:"d4f97900b5fe2e1619950a52d1d1f716a8bc19ff",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:l,isError:isTextContainsNonLatinChars(l),onInputChange:function(o){return e.onInputChange({key:"state",value:o.detail})}})),h("zonos-input",{key:"cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:d,isError:isTextContainsNonLatinChars(d),onInputChange:function(o){return e.onInputChange({key:"postal_code",value:o.detail})}}),h("zonos-input",{key:"7421c82847eded6bdbcce49ef8196124d8e50c1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:r,onInputChange:function(o){return e.onInputChange({key:"phone",value:o.detail})}}))))};Object.defineProperty(e,"watchers",{get:function(){return{translatedAddress:["watchCurrentAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressForm.style=ZonosAddressFormStyle0;var zonosAddressUpdateDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";var ZonosAddressUpdateDialogStyle0=zonosAddressUpdateDialogCss;var ZonosAddressUpdateDialog=function(){function e(e){var o=this;registerInstance(this,e);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);this.closeUpdateDialogHandler=function(){o.closeUpdateDialog.emit()};this.getTranslatedAddress=function(e){var o=e.currentAddress,s=e.translatedAddress;var t,n,i,a,r,d;var l=o.city,c=o.line1,h=o.line2,f=o.name,u=o.postal_code,b=o.state;return{city:((t=s.city)===null||t===void 0?void 0:t[l])||l,line1:((n=s.line1)===null||n===void 0?void 0:n[c])||c,line2:((i=s.line2)===null||i===void 0?void 0:i[h])||h,name:((a=s.name)===null||a===void 0?void 0:a[f])||f,postal_code:((r=s.postal_code)===null||r===void 0?void 0:r[u])||u,state:((d=s.state)===null||d===void 0?void 0:d[b])||b}};this.continueClickHandler=function(){return __awaiter(o,void 0,void 0,(function(){var e,o,s,t,n,i,a,r,d,l,c,h,f;return __generator(this,(function(u){this.continueLoading=true;t=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.shippingAddress.country}));a=t&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},t),{country:this.billingAddress.country}));r=!!Object.keys(i).length;d=!!a&&!!Object.keys(a).length;if(r||d){l=(e=this.el.shadowRoot)===null||e===void 0?void 0:e.querySelectorAll("zonos-address-form");c=l===null||l===void 0?void 0:l[0];h=l===null||l===void 0?void 0:l[1];f=((o=c===null||c===void 0?void 0:c.shadowRoot)===null||o===void 0?void 0:o.querySelector(".has-error"))||((s=h===null||h===void 0?void 0:h.shadowRoot)===null||s===void 0?void 0:s.querySelector(".has-error"));if(f){f.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2]}this.continueClicked.emit({billingAddress:t,shippingAddress:n});return[2]}))}))};this.buildTranslateAddressState=function(e){var o,s,t,n,i,a;var r=e.currentAddress,d=e.translatedAddress;var l=r.city,c=r.line1,h=r.line2,f=r.name,u=r.postal_code,b=r.state;return{city:(o={},o[l]=d.city,o),line1:(s={},s[c]=d.line1,s),line2:(t={},t[h]=d.line2,t),name:(n={},n[f]=d.name,n),postal_code:(i={},i[u]=d.postal_code,i),state:(a={},a[b]=d.state,a)}};this.continueLoading=false;this.dialogLoading=undefined;this.dialogOpen=false;this.submitBtnType=undefined;this.submitBtnColor=undefined;this.isMobile=false;this.shippingAddress=undefined;this.billingAddress=undefined;this.translatedShippingAddress=undefined;this.translatedBillingAddress=undefined;this.showErrorBanner=false;this.translatedShippingAddressState={};this.translatedBillingAddressState={}}e.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};e.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};e.prototype.componentWillLoad=function(){this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};e.prototype.render=function(){var e=this;var o=this.submitBtnColor||zonosStore.appearance.colorSecondary;var s=o==="#ffffff"?"outline":this.submitBtnType||"standard";var t=this.billingAddress;var n=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"66abf7b74045e68e84e631298504236d32ca9c4e",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return e.closeUpdateDialogHandler()}})),h("zonos-text",{key:"ffb3d8f169867d5f6dff269e1becd99c98c5a7da"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"2cb61f06ce174e2317870decfdd337c67c5cf128",class:"zonos--group"},h("zonos-text",{key:"a616c540984120b468e52bccfb380ea3974ced22",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"6ac8f9c14472370c501af1b0d50bd8f8746b7694",class:"zonos--address-display-group"},h("zonos-address-display",{key:"ea2c67a7bba51c99f80be968e448beeffcf1f863",addressType:"shipping",currentAddress:n}),t&&h("zonos-address-display",{key:"7ea1683dc04a292810e04ed6550d86086f25186f",addressType:"billing",currentAddress:t})),h("div",{key:"4d1cd9096943518b8b4e267608a5e1542befb6a9",class:"zonos--address-form-section"},h("zonos-text",{key:"e4184a2cc618d26d43979fa8cfe06070cf8b5af8",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"c55d9d3c658565ceb7c7b879f444e3937b9f7ad6",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:function(o){var s=o.detail;e.translatedShippingAddressState=e.buildTranslateAddressState({currentAddress:n,translatedAddress:s})},translatedAddress:this.translatedShippingAddressState}),t&&h("zonos-address-form",{key:"c3facc295b1322bb00baa6081f343dcea4f10777",addressType:"billing",class:"zonos--billing-address-form",currentAddress:t,onAddressChange:function(o){var s=o.detail;e.translatedBillingAddressState=e.buildTranslateAddressState({currentAddress:t,translatedAddress:s})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"1c89c9604ba0dece40275fcfac97e7f93706b430",class:"zonos--group-btn"},h("div",{key:"e47d393940b094b4e123864e4070daa87f0616f0",class:"zonos--button-wrapper"},h("zonos-button",{key:"216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6",class:"zonos--cancel-btn",onClick:function(){return e.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"acbacb92cedb325b46843d8f3aff13f4e7c86ab5",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return e.continueClickHandler()},size:"sm",variant:s},translate("Update address")))))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}},enumerable:false,configurable:true});return e}();ZonosAddressUpdateDialog.style=ZonosAddressUpdateDialogStyle0;var colorPrefixes=["blue","cyan","green","orange","purple","red","gray","glass"];var zonosCheckboxCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--size);width:var(--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--background-color);border-radius:var(--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";var ZonosCheckboxStyle0=zonosCheckboxCss;var ZonosCheckbox=function(){function e(e){registerInstance(this,e);this.checkboxSelected=createEvent(this,"checkboxSelected",7);this.backgroundColor="blue";this.label=undefined;this.isChecked=false;this.isDisabled=false;this.size=12;this.fontSize="base";this.borderStyle=undefined}e.prototype.onClick=function(){if(this.isDisabled){return}this.checkboxSelected.emit(!this.isChecked)};e.prototype.render=function(){var e=this;var o=colorPrefixes.includes(this.backgroundColor);var s=o?"var(--zonos-elements-".concat(this.backgroundColor,"-600)"):this.backgroundColor;var t=o?"var(--zonos-elements-".concat(this.backgroundColor,"-200)"):!isDarkColor(s)?"var(--zonos-elements-gray-800)":"var(--zonos-elements-gray-0)";var n=getBorderRadius({customRoundRadius:"4px",overrideBorderStyle:this.borderStyle});return h(Host,{key:"8613d885c639d01671743dbdb0583c390718c732",class:classes(["zonos--elements zonos--checkbox"]),style:{"--background-color":s,"--border-radius":n,"--font-family":zonosStoreFontFamily(),"--size":"".concat(this.size,"px")}},h("label",{key:"803434d7a63e1735bf0ef15a9e4c7fb515bfff41",class:classes([this.isDisabled&&"disabled"])},h("input",{key:"a19a46a896597f4c47d4ec790a21b5133c13b952",checked:this.isChecked,disabled:this.isDisabled,hidden:true,onChange:function(o){e.checkboxSelected.emit(o.target.checked)},type:"checkbox"}),h("span",{key:"7f4b933f9626bc05f052d79fa25a0c46ee16f492",class:"checkmark-container"},h("svg",{key:"775d0b011a1430f712e8f633e2850d6f6e193f36",class:"checkmark",color:t,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},h("path",{key:"eef97178731ac1bf9885d5cfd57afa514c20df5f","clip-rule":"evenodd",d:"M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z",fill:"currentColor","fill-rule":"evenodd"}))),this.label&&h("zonos-text",{key:"0f72347f0b21817cd176393219374008a056b590",size:this.fontSize},this.label)))};return e}();ZonosCheckbox.style=ZonosCheckboxStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--min-height, auto);height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";var ZonosDialogStyle0=zonosDialogCss;var ZonosDialog=function(){function e(e){var o=this;registerInstance(this,e);this.closeDialog=createEvent(this,"closeDialog",3);this.isMobileMode=function(){return o.mobile||window.innerWidth<=768};this.closeButtonHandler=function(){if(!o.open){return}o.closeDialog.emit()};this.clickOutsideDialogHandler=function(e){if(e.target===e.currentTarget&&!o.noClickOutside){o.closeDialog.emit()}};this.open=false;this.headerText="";this.width="460px";this.height=undefined;this.minHeight=undefined;this.noHeader=false;this.noBodyPadding=false;this.noBorder=false;this.borderStyle=undefined;this.noCloseButton=false;this.noClickOutside=false;this.mobile=false;this.isLoading=true;this.isMobile=false}e.prototype.handleWindowResize=function(){this.isMobile=this.isMobileMode()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.closeButtonHandler()}};e.prototype.componentDidLoad=function(){this.isMobile=this.isMobileMode()};e.prototype.render=function(){if(this.open){document.body.style.overflow="hidden"}else{document.body.style.overflow="auto"}var e=getBorderRadius({overrideBorderStyle:this.borderStyle});return h(Host,{key:"0ba21daff1a07b91701cec30ff80c0b10a8f5344",class:classes(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--border-radius":e,"--font-family":zonosStoreFontFamily(),"--height":this.height||"initial","--min-height":this.minHeight||"500px","--width":this.width}},h("div",{key:"84c2c67ff9b89cf28cd7864a79e76daf9d0c5093",class:"zonos--backdrop"}),h("div",{key:"c621463f2ca3721aacfdf666b0dd5a4749dd385a",class:"zonos--dialog-layout",inert:!this.open,onClick:this.clickOutsideDialogHandler},h("div",{key:"61bf1362b55f4a7e515f3ab1b4fd9a0e1e1794b2",class:"zonos--dialog"},this.isLoading&&h("div",{key:"c84edec7ec322fc6a7eaf17ed54aeffd23dd4480",class:"zonos--loading"},h("zonos-spinner",{key:"4f8e004e7286d053f195f9eea578dc416ff1d142",size:30})),(this.headerText||!this.noCloseButton)&&h("div",{key:"196316fc1ec1e099b87ea36829d334c45c3a6a24",class:"zonos--header"},this.headerText&&h("h3",{key:"452ba8e853ffe1fc278e4cb48dbdcc407d5257e6",class:"zonos--header-text"},this.headerText),!this.noCloseButton&&h("zonos-button",{key:"40933095b20bf1a993e142d58df10b50c0359b23",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close dialog",content:RemoveIcon}),noBackground:true,onClick:this.closeButtonHandler,variant:"subtle"})),h("div",{key:"69a696e723483aafa595176dace2ed8bc3274836",class:classes(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},h("slot",{key:"53f5ea4e4bab900f4ddf720e3589862a40e3e91f"})),h("slot",{key:"1f7628b5749261e4e5ad703a78b5c9b276ad18e9",name:"dialog-footer"}))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return e}();ZonosDialog.style=ZonosDialogStyle0;var zonosLinkAuthenticationCss=".sc-zonos-link-authentication-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}";var ZonosLinkAuthenticationStyle0=zonosLinkAuthenticationCss;var ZonosLinkAuthentication=function(){function e(e){registerInstance(this,e);this.titleText=undefined;this.defaultEmail=null;this.stripe=stripeStore.stripe}e.prototype.watchInitStripe=function(){if(!this.stripe||!stripeStore.stripeElements){return}var e=this.defaultEmail?{email:this.defaultEmail}:undefined;var o=stripeStore.stripeLinkElement||stripeStore.stripeElements.create("linkAuthentication",{defaultValues:e||undefined});var s=this.el.querySelector(".zonos--link-authentication-component");if(!s){logError("Cannot find container element for linkAuthenticationElement");return}o.mount(s);o.on("change",(function(e){stripeStore.stripeLinkEventData=e}));stripeStore.stripeLinkElement=o};e.prototype.componentDidLoad=function(){this.watchInitStripe()};e.prototype.render=function(){return h(Host,{key:"0aaba985027ef855e981049783641b38ec1b1afd",class:"zonos--link-authentication zonos--elements"},h("zonos-text",{key:"8fbb7a2f95c02d975f4b94c70e68be764d53d76e",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"adc585cf1fa7ea763e9c5ae4e5be623b2d8f6627",class:"zonos--link-authentication-component"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return e}();ZonosLinkAuthentication.style=ZonosLinkAuthenticationStyle0;export{ZonosAddress as zonos_address,ZonosAddressDisplay as zonos_address_display,ZonosAddressForm as zonos_address_form,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosCheckbox as zonos_checkbox,ZonosDialog as zonos_dialog,ZonosLinkAuthentication as zonos_link_authentication};