@zonos/elements 1.3.284 → 1.3.286

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 (146) hide show
  1. package/dist/cjs/{cart-94908542.js → cart-0cf8897b.js} +26 -3
  2. package/dist/cjs/{collect-0c05e2b4.js → collect-79131e52.js} +1 -1
  3. package/dist/cjs/{getMissingRequiredShippingFields-124b3f20.js → getMissingRequiredShippingFields-a8f04267.js} +1 -1
  4. package/dist/cjs/index.cjs.js +7 -7
  5. package/dist/cjs/{invoice-205fb5bc.js → invoice-254ae23b.js} +1 -1
  6. package/dist/cjs/{paypal-45ca5301.js → paypal-8ca67278.js} +1 -1
  7. package/dist/cjs/{placeTestOrder-302b6862.js → placeTestOrder-12b63822.js} +1 -1
  8. package/dist/cjs/{renderCheckoutCurrency-1b0cd5f2.js → renderCheckoutCurrency-a1f71587.js} +1 -1
  9. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +2 -2
  10. package/dist/cjs/zonos-address_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +21 -9
  14. package/dist/cjs/zonos-checkout.cjs.entry.js +103 -5
  15. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +5 -5
  17. package/dist/cjs/zonos-collect.cjs.entry.js +3 -3
  18. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
  20. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +5 -5
  21. package/dist/cjs/zonos-invoice.cjs.entry.js +3 -3
  22. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +2 -2
  23. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -5
  24. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +104 -5
  25. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
  26. package/dist/collection/components/main/zonos-controller.js +1 -1
  27. package/dist/collection/components/store/checkout/cart.js +14 -1
  28. package/dist/collection/components/utils/validateCheckoutSession.js +11 -3
  29. package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
  30. package/dist/collection/types/generated/graphql.internal.types.js +128 -6
  31. package/dist/esm/{cart-2e407f7b.js → cart-d04742f5.js} +25 -4
  32. package/dist/esm/{collect-19428e18.js → collect-4c310a16.js} +1 -1
  33. package/dist/esm/{getMissingRequiredShippingFields-719b206f.js → getMissingRequiredShippingFields-f0878e32.js} +1 -1
  34. package/dist/esm/index.js +7 -7
  35. package/dist/esm/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
  36. package/dist/esm/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
  37. package/dist/esm/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
  38. package/dist/esm/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
  39. package/dist/esm/zonos-address-completion-dialog_7.entry.js +2 -2
  40. package/dist/esm/zonos-address_4.entry.js +1 -1
  41. package/dist/esm/zonos-airwallex-payment.entry.js +2 -2
  42. package/dist/esm/zonos-card_5.entry.js +2 -2
  43. package/dist/esm/zonos-cart-items_12.entry.js +21 -9
  44. package/dist/esm/zonos-checkout.entry.js +103 -5
  45. package/dist/esm/zonos-collect-cart-items_3.entry.js +1 -1
  46. package/dist/esm/zonos-collect-finish_6.entry.js +5 -5
  47. package/dist/esm/zonos-collect.entry.js +3 -3
  48. package/dist/esm/zonos-controller.entry.js +1 -1
  49. package/dist/esm/zonos-invoice-cart-items_2.entry.js +3 -3
  50. package/dist/esm/zonos-invoice-finish_5.entry.js +5 -5
  51. package/dist/esm/zonos-invoice.entry.js +3 -3
  52. package/dist/esm/zonos-policy-consent_2.entry.js +2 -2
  53. package/dist/esm-es5/cart-d04742f5.js +1 -0
  54. package/dist/esm-es5/{collect-19428e18.js → collect-4c310a16.js} +1 -1
  55. package/dist/esm-es5/getMissingRequiredShippingFields-f0878e32.js +1 -0
  56. package/dist/esm-es5/index.js +1 -1
  57. package/dist/esm-es5/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
  58. package/dist/esm-es5/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
  59. package/dist/esm-es5/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
  60. package/dist/esm-es5/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
  61. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
  62. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  63. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  64. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  65. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  66. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  67. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  68. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  69. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  70. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  71. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  72. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  73. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  74. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  75. package/dist/scripts/index.d.ts +4 -0
  76. package/dist/scripts/index.js +1 -1
  77. package/dist/scripts/loadZonos.js +1 -1
  78. package/dist/scripts/zonos.js +1 -1
  79. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +14 -0
  80. package/dist/types/components/store/checkout/cart.d.ts +10 -1
  81. package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
  82. package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
  83. package/dist/types/types/generated/graphql.internal.types.d.ts +162 -7
  84. package/dist/types/types/generated/graphql.internal.types.ts +201 -9
  85. package/dist/zonos-elements/index.esm.js +1 -1
  86. package/dist/zonos-elements/{p-dd3c00d6.system.entry.js → p-0c327a57.system.entry.js} +1 -1
  87. package/dist/zonos-elements/{p-e32ee011.system.entry.js → p-117953db.system.entry.js} +1 -1
  88. package/dist/zonos-elements/{p-260ad739.system.entry.js → p-1cfb5c2a.system.entry.js} +1 -1
  89. package/dist/zonos-elements/{p-f4acce01.js → p-277b77e3.js} +1 -1
  90. package/dist/zonos-elements/{p-ae0de3e4.entry.js → p-278abdcf.entry.js} +1 -1
  91. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  92. package/dist/zonos-elements/{p-e5c76a9b.js → p-344a6278.js} +2 -2
  93. package/dist/zonos-elements/{p-f59a0129.system.entry.js → p-3a26e5e7.system.entry.js} +1 -1
  94. package/dist/zonos-elements/{p-94722bf6.system.entry.js → p-40af92a1.system.entry.js} +1 -1
  95. package/dist/zonos-elements/{p-e8587f9f.system.entry.js → p-41f1697a.system.entry.js} +1 -1
  96. package/dist/zonos-elements/{p-e2b4c082.system.entry.js → p-490d7fec.system.entry.js} +1 -1
  97. package/dist/zonos-elements/{p-1277abac.system.entry.js → p-4941c096.system.entry.js} +1 -1
  98. package/dist/zonos-elements/{p-d20fe2c2.system.entry.js → p-50d088f7.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-8311edc7.entry.js → p-5227aa69.entry.js} +1 -1
  100. package/dist/zonos-elements/{p-bced320e.entry.js → p-5d110c2b.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-b1e95f95.entry.js → p-6de2f9c9.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-6dde1e85.system.entry.js → p-6eaf7c9e.system.entry.js} +1 -1
  103. package/dist/zonos-elements/p-7352abe9.js +1 -0
  104. package/dist/zonos-elements/{p-fe5f05fc.system.js → p-74230da8.system.js} +1 -1
  105. package/dist/zonos-elements/{p-22e10b7d.entry.js → p-77993ba1.entry.js} +1 -1
  106. package/dist/zonos-elements/p-78f8e594.entry.js +1 -0
  107. package/dist/zonos-elements/p-7b525c75.system.js +1 -0
  108. package/dist/zonos-elements/p-7f688485.system.entry.js +1 -0
  109. package/dist/zonos-elements/p-8861d47e.js +1 -0
  110. package/dist/zonos-elements/p-8d14cb66.entry.js +1 -0
  111. package/dist/zonos-elements/{p-a07e5011.entry.js → p-944c1fb3.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-cb49dcfe.entry.js → p-96ab529e.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-eb5f3451.system.js → p-998975a3.system.js} +1 -1
  114. package/dist/zonos-elements/p-a4c7ee17.js +1 -0
  115. package/dist/zonos-elements/{p-3a13e58c.system.js → p-c0af11fe.system.js} +1 -1
  116. package/dist/zonos-elements/p-c112fa12.system.entry.js +1 -0
  117. package/dist/zonos-elements/{p-2b8c96e3.system.js → p-c4321a1a.system.js} +1 -1
  118. package/dist/zonos-elements/{p-aecb5d61.entry.js → p-c7329333.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-2989da12.system.js → p-c756a59d.system.js} +1 -1
  120. package/dist/zonos-elements/p-d1a51fac.js +1 -0
  121. package/dist/zonos-elements/{p-d42bd250.system.entry.js → p-d75726e5.system.entry.js} +1 -1
  122. package/dist/zonos-elements/p-dd866ca3.system.entry.js +1 -0
  123. package/dist/zonos-elements/{p-8bfe5b2b.entry.js → p-dd8a7bf4.entry.js} +1 -1
  124. package/dist/zonos-elements/p-e4dc24e1.system.js +1 -0
  125. package/dist/zonos-elements/{p-60a6b71d.system.js → p-e5865ad9.system.js} +1 -1
  126. package/dist/zonos-elements/{p-65c1f51e.entry.js → p-e7d7afda.entry.js} +1 -1
  127. package/dist/zonos-elements/p-f9346f1c.entry.js +1 -0
  128. package/dist/zonos-elements/{p-0c9fec73.js → p-fc5f6113.js} +1 -1
  129. package/dist/zonos-elements/p-fe28dbe6.entry.js +1 -0
  130. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  131. package/package.json +1 -1
  132. package/dist/esm-es5/cart-2e407f7b.js +0 -1
  133. package/dist/esm-es5/getMissingRequiredShippingFields-719b206f.js +0 -1
  134. package/dist/zonos-elements/p-2c2afed4.entry.js +0 -1
  135. package/dist/zonos-elements/p-2cdd1b49.system.entry.js +0 -1
  136. package/dist/zonos-elements/p-46cd14e5.js +0 -1
  137. package/dist/zonos-elements/p-4a20893e.system.js +0 -1
  138. package/dist/zonos-elements/p-5a491f28.js +0 -1
  139. package/dist/zonos-elements/p-5ebb7ae6.entry.js +0 -1
  140. package/dist/zonos-elements/p-62f6a757.entry.js +0 -1
  141. package/dist/zonos-elements/p-8b298971.system.entry.js +0 -1
  142. package/dist/zonos-elements/p-a9ad74e5.system.entry.js +0 -1
  143. package/dist/zonos-elements/p-c1631c9c.js +0 -1
  144. package/dist/zonos-elements/p-cb4cb5a3.system.js +0 -1
  145. package/dist/zonos-elements/p-dc80cb87.js +0 -1
  146. package/dist/zonos-elements/p-ff4e6811.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function u(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?t(e.value):o(e.value).then(u,a)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(n){return s([e,n])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=n.call(e,t)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var r=0,o=n.length,i;r<o;r++){if(i||!(r in n)){if(!i)i=Array.prototype.slice.call(n,0,r);i[r]=n[r]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-40a4c8a2.system.js","./p-655ec440.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var n,t,r,o,i,u,a,s,c,d,l,f;return{setters:[function(e){n=e.c},function(e){t=e.g;r=e.I},function(n){o=n.l;e("availableTestKeys",n.a)},function(e){i=e.g;u=e.a;a=e.h;s=e.l},function(n){c=n.g;d=n._;l=n.c;f=n.a;var t={};t.checkoutHiddenBtnSelector=n.c;t.checkoutHiddenInternationalBtnSelector=n.a;t.domesticRedirectedBtnSelector=n.d;e(t)},function(n){e("countryRequireShortAddressCode",n.c)},function(n){var t={};t.countryRequireTaxId=n.c;t.euCountryCodes=n.e;t.shipToTaxIdLabels=n.s;e(t)}],execute:function(){var v=this;var w=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["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 o=new URL(n).origin;var i=t.some((function(e){return o.includes(e)}));var u=r.some((function(e){return o.includes(e)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var p="jsdelivr";var h=function(e){var n=m.indexOf(e);var t=m[n+1];return t||null};var y=function(){return __awaiter(v,void 0,void 0,(function(){var e,n,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:e=i();n=u();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}o("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){o("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}o("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var O=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=O(window.location.href);var t="https://v1.3.284.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var i="https://".concat(n,".").concat(r);o("[ZONOS-WARNING] using '".concat(i,"' for loading elements script"),"warn");void fetch(i).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(i,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return i};var S="https://js.stripe.com/v3";var b=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var _="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var z=function(){var e=document.querySelectorAll('script[src^="'.concat(S,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!b.test(t.src)){continue}return t}return null};var j=null;var k=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(S).concat(n);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var N=function(e){if(j!==null){return j}j=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(_)}if(window.Stripe){n(window.Stripe);return}try{var r=z();if(r&&e){console.warn(_)}else if(!r){r=k(e)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return j};var A=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var I=function(e,n,t){if(e===null){return null}var r=e.apply(undefined,n);A(r,t);return r};var Z=function(){var e,n;return typeof window!=="undefined"&&(typeof((e=window.Zonos)===null||e===void 0?void 0:e.createCartId)==="function"||typeof((n=window.Zonos)===null||n===void 0?void 0:n.buildCartDetail)==="function")};var R=Promise.resolve().then((function(){if(!Z()){return null}return N(null)}));var T=false;R.catch((function(e){if(!T){console.warn(e)}}));var E=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(v,void 0,void 0,(function(){var n,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:T=true;t=Date.now();return[4,R];case 1:if(!((n=i.sent())!==null&&n!==void 0))return[3,2];o=n;return[3,4];case 2:return[4,N(null)];case 3:o=i.sent();i.label=4;case 4:r=o;return[2,I(r,e,t)]}}))}))};var U="tempCartUUID";var L=function(){var e=new URLSearchParams(window.location.search);var n=e.get(U);return n};var P=function(e){return __awaiter(v,[e],void 0,(function(e){var n,r,u,s,d,l,f,v,w;var m=e.cartId,p=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=i();r=t();u=c()||undefined;s=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){s.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(s.toString()),{body:{isTestMode:n,renewCartExpirationToken:u,tempCartUUID:m},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:d=e.sent(),l=d.errors,f=d.json,v=d.zonosMode;w=!f||l.length;if(!(w&&p))return[3,3];o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:p});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,P({cartId:m,retries:p-1})];case 3:if(w){return[2,null]}return[2,Object.assign(Object.assign({},f),{zonosMode:v})]}}))}))};var C=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,i;return __generator(this,(function(u){switch(u.label){case 0:n=d(e),t=n.isDgsCartId,r=n.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,P({cartId:e,retries:5})];case 1:i=u.sent();o("[ZONOS - loadZonos] getting temp cart data","info",i);if(!i){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=i.cartData.storeId;window.Zonos.zonosApiKey=i.cartData.credentialToken;window.Zonos.zonosMode=i.zonosMode;return[2,{cartData:i.cartData,settings:i.settings,storeFavicon:i.storeFaviconUrl,storeId:i.cartData.storeId,storeLogo:i.storeLogoUrl,zonosApiKey:i.cartData.credentialToken}]}}))}))};var F;var D=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=w({loadScriptSrc:e===null||e===void 0?void 0:e.src}),t=n.currentLoadScriptUrl,r=n.isWhiteListed;if(r){return t}return null}();var M=Date.now();var x="https://v1.3.284.js.zonos.com";var G=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.284";var K="https://unpkg.com/@zonos/elements@1.3.284";var B="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.284";var V="https://fonts.googleapis.com";var W=/^https:\/\/fonts\.googleapis\.com/;var q=function(){function e(){}return e}();e("Zonos",q);F=q;q.doneInit=false;q.cartSettings=null;q.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);q.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);q._paypalMockResponse=null;q.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;q.isBigCommerce=false;q.releaseDate="1787002350863";q.isLegacyCheckout=false;q.googleAnalyticId=null;q.googleAnalyticReady=false;q.facebookPixelId=null;q.facebookPixelReady=false;q.startLoadTime=M;q.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";q.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");q.overrideUseCustomAddressForm=false;q.isCollect=false;q.isInvoice=false;q.isNpm=true;q.zonosQaUrl=null;q.zonosQaUrlApi=null;q.trackEventLogs=[];q.version="v".concat("1.3.284");q.modeAlerted=false;q.cartData=null;q.paypal=null;q.zonosMode=null;q.IframeService=r;q.getCurrentTimestamp=function(){return(new Date).getTime()};q.zonosController=null;q.loadTimeApiInfoList=[];q.logIntervalId=null;q.init=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,i,u,a,c,d,f,v,w,m,p,h,O;return __generator(this,(function(S){switch(S.label){case 0:n=e.appearance,t=e.checkoutSettings,r=e.currencyConverter,i=e.helloSettings,u=e.onCountryChange,a=e.overrideCurrencyFormat,c=e.storeId,d=e.zonosApiKey;F.cartId=L();F.createCartId=t===null||t===void 0?void 0:t.createCartId;F.buildCartDetail=t===null||t===void 0?void 0:t.buildCartDetail;if(F.doneInit){return[2]}o("====== ZONOS DEBUG MODE: on (".concat(F.version,") ======"));F.zonosApiKey=d;F.storeId=c;if(typeof window!=="undefined"&&window.parent===window){F.googleAnalyticReady=true;F.facebookPixelReady=true}if(!F.isNpm)return[3,4];o("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){o('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=F.isNpm;window.Zonos.isBigCommerce=F.isBigCommerce;window.Zonos.isLegacyCheckout=F.isLegacyCheckout;window.Zonos.zonosMode=F.zonosMode;void window.Zonos.init(e)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!d&&!F.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!F.cartData&&F.cartId))return[3,2];o("Initialize cart data");return[4,C(F.cartId)];case 1:w=S.sent();if(!w){s("Failed to get cart data");return[2]}F.cartData=w.cartData;F.zonosApiKey=w.zonosApiKey;F.cartSettings=w.settings;S.label=2;case 2:return[4,y()];case 3:m=S.sent();if(m){F.zonosApiKey=m}S.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");h=F.cartId&&F.cartData||!!p;if(h){o("Cart data or stripe client secret is available, inject hidden button and trigger checkout");O=document.createElement("button");O.style.display="none";O.id="".concat(l);document.body.appendChild(O)}o("init zonos");F.restoreNativeBrowserFunctions();F.injectCustomScriptForHostedCheckout();F.injectZonosCdn();F.injectZonosCss();F.injectFonts();F.injectCheckoutInternationalButton();F.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:r,helloSettings:i,onCountryChange:u,overrideCurrencyFormat:a}});F.doneInit=true;return[2]}}))}))};q.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(f))){var e=document.createElement("button");e.id=f;e.style.display="none";document.body.appendChild(e)}};q.injectCustomScriptForHostedCheckout=function(){var e=F.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var r=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){o("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){o("Injecting custom header script");var i=document.createElement("script");i.textContent=t.value;document.head.appendChild(i)}if(r){o("Injecting custom footer script");var i=document.createElement("script");i.textContent=r.value;document.body.appendChild(i)}};q.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};q.triggerCheckoutInternational=function(){return __awaiter(v,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.querySelector("#".concat(f));setTimeout((function(){if(e){e.dispatchEvent(n("click"))}}),10);return[2]}))}))};q.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};q.showNotification=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.showNotification(e))};q.updateOrganizationName=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};q.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,r=e.config,o=e.disable,i=e.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};a.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(o){e.setAttribute("disabled","true");e.addEventListener("click",s)}else{e.removeAttribute("disabled");e.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",s)}))}),5e3)}}};q.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((e=r.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};q.injectController=function(e){var n=e.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var i=n.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:i});var u=new MutationObserver((function(){F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:i})}));u.observe(document.body,{childList:true,subtree:true})}if((r=n.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var u=new MutationObserver((function(){F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));u.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=n;c.zonosApiKey=F.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(e){return __awaiter(v,void 0,void 0,(function(){var n,t;return __generator(this,(function(r){switch(r.label){case 0:n=e.detail;o("loading Stripe");return[4,E(n.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;if(window.Zonos.isCollect){void c.initCollectElement(t)}else if(window.Zonos.isInvoice){void c.initInvoiceElement(t)}else{void c.initCheckoutElement(t)}return[2]}}))}))}));document.body.appendChild(c);F.zonosController=c;o("Zonos controller injected!")};q.injectScript=function(e){var n=e.cdnType,t=e.isModule,r=e.theRestUrl;var i=F.getZonosUrl(n);var u="".concat(i,"/").concat(r);var a=function(){var e=document.querySelector('script[src="'.concat(u,'"]'));return!!e};if(a()){o('Zonos script "'.concat(u,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=u;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var e=h(n);if(!e){return}F.injectScript({cdnType:e,isModule:t,theRestUrl:r})};c.appendChild(d)};q.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return G;case"unpkg":return K;case"cdnjs":return B;case"vercel":return x}};if(F.isNpm){var t=g();return t||n()}return n()};q.injectZonosCdn=function(){F.injectScript({cdnType:p,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});F.injectScript({cdnType:p,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});o("Zonos cdn script injected!")};q.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var r=F.getZonosUrl(n);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(x,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var e=h(n);if(!e){return}F.injectStylesheet({cdnType:e,theRestUrl:t})};o.appendChild(u)};q.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){o("Zonos style links already injected","warn");return}F.injectStylesheet({cdnType:p,theRestUrl:"dist/zonos-elements/zonos-elements.css"});o("Zonos style css injected!")};q.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){o("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(V,'"]'));for(var t=0;t<n.length;t++){var r=n[t];if(!r){continue}if(W.test(r.href)){continue}return r}return null};if(e()){o("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=V;n.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(V,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(r);o("Zonos font injected!")};q.setupGoogleFont=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};q.injectSupportGoogleFont=function(e){var n;o("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(V,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=V;r.appendChild(i)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){o("[FONT] ".concat(t," font already injected"),"warn");return}var u=document.createElement("link");u.rel="stylesheet";u.href=e;r.appendChild(u);o("[FONT] ".concat(t," font injected!"))};var H=e("checkoutSessionMutableAttributeKeys",["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"]);var Q=e("checkoutSessionImmutableAttributeKeys",["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"]);var Y=e("checkoutSessionAttributeKeys",__spreadArray(__spreadArray([],H,true),Q,true))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,i){function u(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?t(e.value):o(e.value).then(u,a)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(n){return s([e,n])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=n.call(e,t)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,t){if(t||arguments.length===2)for(var r=0,o=n.length,i;r<o;r++){if(i||!(r in n)){if(!i)i=Array.prototype.slice.call(n,0,r);i[r]=n[r]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-40a4c8a2.system.js","./p-655ec440.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var n,t,r,o,i,u,a,s,c,d,l,f;return{setters:[function(e){n=e.c},function(e){t=e.g;r=e.I},function(n){o=n.l;e("availableTestKeys",n.a)},function(e){i=e.g;u=e.a;a=e.h;s=e.l},function(n){c=n.g;d=n._;l=n.c;f=n.a;var t={};t.checkoutHiddenBtnSelector=n.c;t.checkoutHiddenInternationalBtnSelector=n.a;t.domesticRedirectedBtnSelector=n.d;e(t)},function(n){e("countryRequireShortAddressCode",n.c)},function(n){var t={};t.countryRequireTaxId=n.c;t.euCountryCodes=n.e;t.shipToTaxIdLabels=n.s;e(t)}],execute:function(){var v=this;var w=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["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 o=new URL(n).origin;var i=t.some((function(e){return o.includes(e)}));var u=r.some((function(e){return o.includes(e)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var p="jsdelivr";var h=function(e){var n=m.indexOf(e);var t=m[n+1];return t||null};var y=function(){return __awaiter(v,void 0,void 0,(function(){var e,n,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:e=i();n=u();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}o("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){o("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}o("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var O=function(e){if(!e){return null}var n=new URL(e).searchParams;var t=n.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=O(window.location.href);var t="https://v1.3.286.js.zonos.com";if(!n&&(t.includes("test.")||t.includes("test-"))){return t}if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var i="https://".concat(n,".").concat(r);o("[ZONOS-WARNING] using '".concat(i,"' for loading elements script"),"warn");void fetch(i).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(i,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var t="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return i};var S="https://js.stripe.com/v3";var b=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var _="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var z=function(){var e=document.querySelectorAll('script[src^="'.concat(S,'"]'));for(var n=0;n<e.length;n++){var t=e[n];if(!t){continue}if(!b.test(t.src)){continue}return t}return null};var j=null;var k=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(S).concat(n);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var N=function(e){if(j!==null){return j}j=new Promise((function(n,t){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(_)}if(window.Stripe){n(window.Stripe);return}try{var r=z();if(r&&e){console.warn(_)}else if(!r){r=k(e)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){t(e);return}}));return j};var A=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var I=function(e,n,t){if(e===null){return null}var r=e.apply(undefined,n);A(r,t);return r};var Z=function(){var e,n;return typeof window!=="undefined"&&(typeof((e=window.Zonos)===null||e===void 0?void 0:e.createCartId)==="function"||typeof((n=window.Zonos)===null||n===void 0?void 0:n.buildCartDetail)==="function")};var R=Promise.resolve().then((function(){if(!Z()){return null}return N(null)}));var T=false;R.catch((function(e){if(!T){console.warn(e)}}));var E=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(v,void 0,void 0,(function(){var n,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:T=true;t=Date.now();return[4,R];case 1:if(!((n=i.sent())!==null&&n!==void 0))return[3,2];o=n;return[3,4];case 2:return[4,N(null)];case 3:o=i.sent();i.label=4;case 4:r=o;return[2,I(r,e,t)]}}))}))};var U="tempCartUUID";var L=function(){var e=new URLSearchParams(window.location.search);var n=e.get(U);return n};var P=function(e){return __awaiter(v,[e],void 0,(function(e){var n,r,u,s,d,l,f,v,w;var m=e.cartId,p=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=i();r=t();u=c()||undefined;s=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){s.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(s.toString()),{body:{isTestMode:n,renewCartExpirationToken:u,tempCartUUID:m},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:d=e.sent(),l=d.errors,f=d.json,v=d.zonosMode;w=!f||l.length;if(!(w&&p))return[3,3];o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:p});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,P({cartId:m,retries:p-1})];case 3:if(w){return[2,null]}return[2,Object.assign(Object.assign({},f),{zonosMode:v})]}}))}))};var C=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,i;return __generator(this,(function(u){switch(u.label){case 0:n=d(e),t=n.isDgsCartId,r=n.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,P({cartId:e,retries:5})];case 1:i=u.sent();o("[ZONOS - loadZonos] getting temp cart data","info",i);if(!i){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=i.cartData.storeId;window.Zonos.zonosApiKey=i.cartData.credentialToken;window.Zonos.zonosMode=i.zonosMode;return[2,{cartData:i.cartData,settings:i.settings,storeFavicon:i.storeFaviconUrl,storeId:i.cartData.storeId,storeLogo:i.storeLogoUrl,zonosApiKey:i.cartData.credentialToken}]}}))}))};var F;var D=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=w({loadScriptSrc:e===null||e===void 0?void 0:e.src}),t=n.currentLoadScriptUrl,r=n.isWhiteListed;if(r){return t}return null}();var M=Date.now();var x="https://v1.3.286.js.zonos.com";var G=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.286";var K="https://unpkg.com/@zonos/elements@1.3.286";var B="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.286";var V="https://fonts.googleapis.com";var W=/^https:\/\/fonts\.googleapis\.com/;var q=function(){function e(){}return e}();e("Zonos",q);F=q;q.doneInit=false;q.cartSettings=null;q.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);q.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);q._paypalMockResponse=null;q.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;q.isBigCommerce=false;q.releaseDate="1788207564864";q.isLegacyCheckout=false;q.googleAnalyticId=null;q.googleAnalyticReady=false;q.facebookPixelId=null;q.facebookPixelReady=false;q.startLoadTime=M;q.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";q.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");q.overrideUseCustomAddressForm=false;q.isCollect=false;q.isInvoice=false;q.isNpm=true;q.zonosQaUrl=null;q.zonosQaUrlApi=null;q.trackEventLogs=[];q.version="v".concat("1.3.286");q.modeAlerted=false;q.cartData=null;q.paypal=null;q.zonosMode=null;q.IframeService=r;q.getCurrentTimestamp=function(){return(new Date).getTime()};q.zonosController=null;q.loadTimeApiInfoList=[];q.logIntervalId=null;q.init=function(e){return __awaiter(v,void 0,void 0,(function(){var n,t,r,i,u,a,c,d,f,v,w,m,p,h,O;return __generator(this,(function(S){switch(S.label){case 0:n=e.appearance,t=e.checkoutSettings,r=e.currencyConverter,i=e.helloSettings,u=e.onCountryChange,a=e.overrideCurrencyFormat,c=e.storeId,d=e.zonosApiKey;F.cartId=L();F.createCartId=t===null||t===void 0?void 0:t.createCartId;F.buildCartDetail=t===null||t===void 0?void 0:t.buildCartDetail;if(F.doneInit){return[2]}o("====== ZONOS DEBUG MODE: on (".concat(F.version,") ======"));F.zonosApiKey=d;F.storeId=c;if(typeof window!=="undefined"&&window.parent===window){F.googleAnalyticReady=true;F.facebookPixelReady=true}if(!F.isNpm)return[3,4];o("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){o('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=F.isNpm;window.Zonos.isBigCommerce=F.isBigCommerce;window.Zonos.isLegacyCheckout=F.isLegacyCheckout;window.Zonos.zonosMode=F.zonosMode;void window.Zonos.init(e)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!d&&!F.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!F.cartData&&F.cartId))return[3,2];o("Initialize cart data");return[4,C(F.cartId)];case 1:w=S.sent();if(!w){s("Failed to get cart data");return[2]}F.cartData=w.cartData;F.zonosApiKey=w.zonosApiKey;F.cartSettings=w.settings;S.label=2;case 2:return[4,y()];case 3:m=S.sent();if(m){F.zonosApiKey=m}S.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");h=F.cartId&&F.cartData||!!p;if(h){o("Cart data or stripe client secret is available, inject hidden button and trigger checkout");O=document.createElement("button");O.style.display="none";O.id="".concat(l);document.body.appendChild(O)}o("init zonos");F.restoreNativeBrowserFunctions();F.injectCustomScriptForHostedCheckout();F.injectZonosCdn();F.injectZonosCss();F.injectFonts();F.injectCheckoutInternationalButton();F.injectController({config:{appearance:n,checkoutSettings:t,currencyConverter:r,helloSettings:i,onCountryChange:u,overrideCurrencyFormat:a}});F.doneInit=true;return[2]}}))}))};q.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(f))){var e=document.createElement("button");e.id=f;e.style.display="none";document.body.appendChild(e)}};q.injectCustomScriptForHostedCheckout=function(){var e=F.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var t=n.find((function(e){return e.key==="customHeaderScript"}));var r=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){o("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){o("Injecting custom header script");var i=document.createElement("script");i.textContent=t.value;document.head.appendChild(i)}if(r){o("Injecting custom footer script");var i=document.createElement("script");i.textContent=r.value;document.body.appendChild(i)}};q.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};q.triggerCheckoutInternational=function(){return __awaiter(v,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=document.querySelector("#".concat(f));setTimeout((function(){if(e){e.dispatchEvent(n("click"))}}),10);return[2]}))}))};q.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};q.showNotification=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.showNotification(e))};q.updateOrganizationName=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};q.disablePlaceOrderButtons=function(e){var n=e.autoEnable,t=n===void 0?true:n,r=e.config,o=e.disable,i=e.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};a.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(o){e.setAttribute("disabled","true");e.addEventListener("click",s)}else{e.removeAttribute("disabled");e.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",s)}))}),5e3)}}};q.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((e=r.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};q.injectController=function(e){var n=e.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var i=n.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:i});var u=new MutationObserver((function(){F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:i})}));u.observe(document.body,{childList:true,subtree:true})}if((r=n.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var u=new MutationObserver((function(){F.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));u.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=n;c.zonosApiKey=F.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(e){return __awaiter(v,void 0,void 0,(function(){var n,t;return __generator(this,(function(r){switch(r.label){case 0:n=e.detail;o("loading Stripe");return[4,E(n.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;if(window.Zonos.isCollect){void c.initCollectElement(t)}else if(window.Zonos.isInvoice){void c.initInvoiceElement(t)}else{void c.initCheckoutElement(t)}return[2]}}))}))}));document.body.appendChild(c);F.zonosController=c;o("Zonos controller injected!")};q.injectScript=function(e){var n=e.cdnType,t=e.isModule,r=e.theRestUrl;var i=F.getZonosUrl(n);var u="".concat(i,"/").concat(r);var a=function(){var e=document.querySelector('script[src="'.concat(u,'"]'));return!!e};if(a()){o('Zonos script "'.concat(u,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=u;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var e=h(n);if(!e){return}F.injectScript({cdnType:e,isModule:t,theRestUrl:r})};c.appendChild(d)};q.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return G;case"unpkg":return K;case"cdnjs":return B;case"vercel":return x}};if(F.isNpm){var t=g();return t||n()}return n()};q.injectZonosCdn=function(){F.injectScript({cdnType:p,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});F.injectScript({cdnType:p,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});o("Zonos cdn script injected!")};q.injectStylesheet=function(e){var n=e.cdnType,t=e.theRestUrl;var r=F.getZonosUrl(n);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(x,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var e=h(n);if(!e){return}F.injectStylesheet({cdnType:e,theRestUrl:t})};o.appendChild(u)};q.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){o("Zonos style links already injected","warn");return}F.injectStylesheet({cdnType:p,theRestUrl:"dist/zonos-elements/zonos-elements.css"});o("Zonos style css injected!")};q.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){o("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(V,'"]'));for(var t=0;t<n.length;t++){var r=n[t];if(!r){continue}if(W.test(r.href)){continue}return r}return null};if(e()){o("Inter font already injected","warn");return}var n=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=V;n.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(V,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(r);o("Zonos font injected!")};q.setupGoogleFont=function(e){var n;void((n=F.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};q.injectSupportGoogleFont=function(e){var n;o("[FONT] injecting ".concat(e));var t=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(V,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=V;r.appendChild(i)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){o("[FONT] ".concat(t," font already injected"),"warn");return}var u=document.createElement("link");u.rel="stylesheet";u.href=e;r.appendChild(u);o("[FONT] ".concat(t," font injected!"))};var H=e("checkoutSessionMutableAttributeKeys",["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"]);var Q=e("checkoutSessionImmutableAttributeKeys",["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"]);var Y=e("checkoutSessionAttributeKeys",__spreadArray(__spreadArray([],H,true),Q,true))}}}));
@@ -0,0 +1 @@
1
+ import{W as e}from"./p-a4c7ee17.js";const a=3,l=({countryField:a,event:l})=>{var o,t,n;if(!l)return[];const{value:s}=l,i=[],{lastName:r}=e({firstName:s.firstName,lastName:s.lastName,name:s.name});return r.trim()||i.push({key:"lastName"}),(null==a?void 0:a.stateRequired)&&!(null===(o=s.address.state)||void 0===o?void 0:o.trim())&&i.push({key:"state"}),(null==a?void 0:a.zipRequired)&&(null!==(n=null===(t=s.address.postal_code)||void 0===t?void 0:t.trim().length)&&void 0!==n?n:0)<3&&i.push({key:"postal_code"}),i};export{a as M,l as g}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,o){function s(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,a){function i(t){try{c(o.next(t))}catch(t){a(t)}}function r(t){try{c(o["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):s(t.value).then(i,r)}c((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,s,a,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(t){return function(n){return c([t,n])}}function c(r){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(e=0)),e)try{if(o=1,s&&(a=r[0]&2?s["return"]:r[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,r[1])).done)return a;if(s=0,a)r=[r[0]&2,a.value];switch(r[0]){case 0:case 1:a=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!a||r[1]>a[0]&&r[1]<a[3])){e.label=r[1];break}if(r[0]===6&&e.label<a[1]){e.label=a[1];a=r;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(r);break}if(a[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];s=0}finally{o=a=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var o=0,s=n.length,a;o<s;o++){if(a||!(o in n)){if(!a)a=Array.prototype.slice.call(n,0,o);a[o]=n[o]}}return t.concat(a||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-de58684b.system.js","./p-23e7c655.system.js","./p-14afffa8.system.js","./p-4a20893e.system.js","./p-916228fb.system.js","./p-01174496.system.js","./p-eb5f3451.system.js","./p-d938f42f.system.js","./p-6890e060.system.js","./p-989cb22b.system.js","./p-7fbbdb0f.system.js","./p-af19722c.system.js"],(function(t){"use strict";var n,e,o,s,a,i,r,c,h,l,f,p,y,d,m;return{setters:[function(t){n=t.r;e=t.h;o=t.a;s=t.g;a=t.d},function(t){i=t.f},function(t){r=t.c},function(t){c=t.g},function(t){h=t.b;l=t.t},function(t){f=t.s},function(t){p=t.l},function(t){y=t.d;d=t.e},function(t){m=t.l},function(){},function(){},function(){},function(){}],execute:function(){var u=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";var b=u;var g=t("zonos_card",function(){function t(t){n(this,t);this.borderRadius=6;this.spacing="24px"}t.prototype.render=function(){var t=this.backgroundColor?"var(--zonos-elements-".concat(this.backgroundColor,")"):"transparent";var n=c({customRoundRadius:"".concat(this.borderRadius,"px"),overrideBorderStyle:"ROUNDED"});return e(o,{key:"afc0d2d9b79510aa9d85c89af3c01d5a5c767787",style:{"--zonos--font-family":i()}},e("div",{key:"b68bbbb581f56db81f9b7819f6047c1ec48a956f",class:r(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":n,padding:this.spacing}},this.label&&e("header",{key:"27db75fa9c5ac5dbdfefd92656aa6d8e5b654349",class:"card-header",style:{padding:this.spacing}},e("zonos-text",{key:"f54d58eb5f010346d2fcf919baf69d5c799bdbc4",type:"subheader"},this.label),e("h-stack",{key:"a3cbee0ae5fc73bb9507d5e30ab6779f2ce46f55",spacing:8},this.actions)),e("slot",{key:"6ce557ff8df6046d428b22b290c3d79ce6bf36ad"}),(this.footerActions||this.footerContent)&&e("footer",{key:"7cc44dfa05e46026444ac1db6755b30151937be0",class:"card-footer",style:{height:this.footerHeight?"".concat(this.footerHeight,"px"):"auto",padding:this.spacing}},e("div",{key:"6c401d4fbc34346f160b239a7190eb170763c382"},this.footerContent),e("h-stack",{key:"e6cc5de886d04757374b380149fe5b78b0874cf2",spacing:8},this.footerActions))))};return t}());g.style=b;var z='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var x='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var v=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{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}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";var k=v;var w=t("zonos_empty_state_payment",function(){function t(t){n(this,t);this.theme="LIGHT"}t.prototype.render=function(){if(!this.el.shadowRoot){return null}if(this.theme==="DARK"){this.el.shadowRoot.innerHTML=z}else{this.el.shadowRoot.innerHTML=x}return e(o,{class:"zonos--elements",style:{"--zonos--font-family":i(),"--zonos--height":"100%","--zonos--width":"100%"}},e("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());w.style=k;var _=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var I=_;var j=t("zonos_notification",function(){function t(t){n(this,t);this.notificationArray=[]}t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;var o=this;return __generator(this,(function(s){n="id-".concat(Math.random().toString(36).substring(2,9));e=Object.assign(Object.assign({},t),{id:n,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[e],false);setTimeout((function(){o.updateTransitionClass({id:n,transitionClass:"show"})}),50);setTimeout((function(){o.removeNotification(n)}),e.timeout);return[2]}))}))};t.prototype.updateTransitionClass=function(t){var n=t.id,e=t.transitionClass;this.notificationArray=this.notificationArray.map((function(t){if(t.id===n){return Object.assign(Object.assign({},t),{transitionClass:e})}return t}))};t.prototype.removeNotification=function(t){var n=this;this.updateTransitionClass({id:t,transitionClass:""});setTimeout((function(){n.notificationArray=n.notificationArray.filter((function(n){return n.id!==t}))}),300)};t.prototype.render=function(){var t=this;return e(o,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:r(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":c(),"--zonos--font-family":i()}},e("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((function(n){return e("div",{"aria-hidden":"true",class:r(["zonos--notification-item",n.type,n.transitionClass]),key:n.id,onClick:function(){t.removeNotification(n.id)}},e("zonos-text",{textColor:"gray-0"},n.message))}))))};return t}());j.style=I;var S=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";var O=S;var U=t("zonos_payment",function(){function t(t){n(this,t);this.stripe=h.stripe;this.stripeElements=h.stripeElements;this.isPaymentInfoFilled=false;this.trackingSent=false}t.prototype.watchIsPaymentInfoFilled=function(){var t;if(this.isPaymentInfoFilled&&!this.trackingSent){var n=f.checkoutSessionId;void l({checkoutSessionId:n,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:(t=h.stripePaymentEventData)===null||t===void 0?void 0:t.value.type}});this.trackingSent=true}};t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e;var o=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.stripeElements){return[2]}return[4,this.stripeElements.fetchUpdates()];case 1:s.sent();n=h.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:(t=h.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country}}},layout:"tabs"});e=this.el.querySelector(".zonos--payment-component");if(!e){p("Cannot find container element for paymentElement");return[2]}n.mount(e);n.on("change",(function(t){if(t.complete){o.isPaymentInfoFilled=true}h.stripePaymentEventData=t}));h.stripePaymentElement=n;return[2]}}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(o,{key:"faf7791e4cbf6bf8c98fe0b2f368f408ef32b644",class:"zonos--payment zonos--elements"},this.titleText&&e("zonos-text",{key:"e6103d0e04f9905b90533bf94539aaae1d5aa604",class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{key:"b042060ff6fef2d7f20b20ec672b2696cb5f837c",class:"zonos--payment-component"}),e("div",{key:"b6a220513bb964a057c70141dcec89059dbbb0c8",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());U.style=O;var C=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var P=C;var T=t("zonos_paypal_payment",function(){function t(t){n(this,t);this.paypalSessionDone=a(this,"paypalSessionDone",7);this.paypalSessionFail=a(this,"paypalSessionFail",7);this.storeUnsubscribeList=[]}t.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var e=this;return __generator(this,(function(o){if(!window.Zonos.paypal){m("Paypal is not available");return[2]}t=y({onPaypalFail:function(){m("onPaypalFail");e.paypalSessionFail.emit()},onPaypalSessionDone:function(t){var n=t.orderId;m("onPaypalSessionDone","info",{orderId:n});e.paypalSessionDone.emit({orderId:n})}});if(!(t===null||t===void 0?void 0:t.length)){m("There are no paypal buttons available");return[2]}n=this.el.querySelector(".zonos--payment-paypal-container");if(!n){m("Cannot find container element for paypal buttons");return[2]}t.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,t.render(n)];case 1:e.sent();return[2]}}))}))}));return[2]}))}))};t.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[d("paypal",this.loadPaypal.bind(this))]};t.prototype.componentDidLoad=function(){void this.loadPaypal()};t.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(t){return t()}))};t.prototype.render=function(){return e(o,{key:"2eb9e7f7acbe26f51c32ceb722f1e59832ac918a",class:"zonos--paypal-payment zonos--elements"},e("div",{key:"47ad7f3dfdea67dd5e222e6bbba46ed4599680be",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());T.style=P}}}));
1
+ var __awaiter=this&&this.__awaiter||function(t,n,e,o){function s(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,a){function i(t){try{c(o.next(t))}catch(t){a(t)}}function r(t){try{c(o["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):s(t.value).then(i,r)}c((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,s,a,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(t){return function(n){return c([t,n])}}function c(r){if(o)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(e=0)),e)try{if(o=1,s&&(a=r[0]&2?s["return"]:r[0]?s["throw"]||((a=s["return"])&&a.call(s),0):s.next)&&!(a=a.call(s,r[1])).done)return a;if(s=0,a)r=[r[0]&2,a.value];switch(r[0]){case 0:case 1:a=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!a||r[1]>a[0]&&r[1]<a[3])){e.label=r[1];break}if(r[0]===6&&e.label<a[1]){e.label=a[1];a=r;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(r);break}if(a[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];s=0}finally{o=a=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var o=0,s=n.length,a;o<s;o++){if(a||!(o in n)){if(!a)a=Array.prototype.slice.call(n,0,o);a[o]=n[o]}}return t.concat(a||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-de58684b.system.js","./p-23e7c655.system.js","./p-14afffa8.system.js","./p-e4dc24e1.system.js","./p-916228fb.system.js","./p-01174496.system.js","./p-998975a3.system.js","./p-d938f42f.system.js","./p-6890e060.system.js","./p-989cb22b.system.js","./p-7fbbdb0f.system.js","./p-af19722c.system.js"],(function(t){"use strict";var n,e,o,s,a,i,r,c,h,l,f,p,y,d,m;return{setters:[function(t){n=t.r;e=t.h;o=t.a;s=t.g;a=t.d},function(t){i=t.f},function(t){r=t.c},function(t){c=t.g},function(t){h=t.b;l=t.t},function(t){f=t.s},function(t){p=t.l},function(t){y=t.d;d=t.e},function(t){m=t.l},function(){},function(){},function(){},function(){}],execute:function(){var u=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";var b=u;var g=t("zonos_card",function(){function t(t){n(this,t);this.borderRadius=6;this.spacing="24px"}t.prototype.render=function(){var t=this.backgroundColor?"var(--zonos-elements-".concat(this.backgroundColor,")"):"transparent";var n=c({customRoundRadius:"".concat(this.borderRadius,"px"),overrideBorderStyle:"ROUNDED"});return e(o,{key:"afc0d2d9b79510aa9d85c89af3c01d5a5c767787",style:{"--zonos--font-family":i()}},e("div",{key:"b68bbbb581f56db81f9b7819f6047c1ec48a956f",class:r(["styled-card"]),style:{"--zonos--background-color":t,"--zonos--border-radius":n,padding:this.spacing}},this.label&&e("header",{key:"27db75fa9c5ac5dbdfefd92656aa6d8e5b654349",class:"card-header",style:{padding:this.spacing}},e("zonos-text",{key:"f54d58eb5f010346d2fcf919baf69d5c799bdbc4",type:"subheader"},this.label),e("h-stack",{key:"a3cbee0ae5fc73bb9507d5e30ab6779f2ce46f55",spacing:8},this.actions)),e("slot",{key:"6ce557ff8df6046d428b22b290c3d79ce6bf36ad"}),(this.footerActions||this.footerContent)&&e("footer",{key:"7cc44dfa05e46026444ac1db6755b30151937be0",class:"card-footer",style:{height:this.footerHeight?"".concat(this.footerHeight,"px"):"auto",padding:this.spacing}},e("div",{key:"6c401d4fbc34346f160b239a7190eb170763c382"},this.footerContent),e("h-stack",{key:"e6cc5de886d04757374b380149fe5b78b0874cf2",spacing:8},this.footerActions))))};return t}());g.style=b;var z='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var x='<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n';var v=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;position:relative}:host zonos-text{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}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";var k=v;var w=t("zonos_empty_state_payment",function(){function t(t){n(this,t);this.theme="LIGHT"}t.prototype.render=function(){if(!this.el.shadowRoot){return null}if(this.theme==="DARK"){this.el.shadowRoot.innerHTML=z}else{this.el.shadowRoot.innerHTML=x}return e(o,{class:"zonos--elements",style:{"--zonos--font-family":i(),"--zonos--height":"100%","--zonos--width":"100%"}},e("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());w.style=k;var _=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var I=_;var j=t("zonos_notification",function(){function t(t){n(this,t);this.notificationArray=[]}t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;var o=this;return __generator(this,(function(s){n="id-".concat(Math.random().toString(36).substring(2,9));e=Object.assign(Object.assign({},t),{id:n,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[e],false);setTimeout((function(){o.updateTransitionClass({id:n,transitionClass:"show"})}),50);setTimeout((function(){o.removeNotification(n)}),e.timeout);return[2]}))}))};t.prototype.updateTransitionClass=function(t){var n=t.id,e=t.transitionClass;this.notificationArray=this.notificationArray.map((function(t){if(t.id===n){return Object.assign(Object.assign({},t),{transitionClass:e})}return t}))};t.prototype.removeNotification=function(t){var n=this;this.updateTransitionClass({id:t,transitionClass:""});setTimeout((function(){n.notificationArray=n.notificationArray.filter((function(n){return n.id!==t}))}),300)};t.prototype.render=function(){var t=this;return e(o,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:r(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":c(),"--zonos--font-family":i()}},e("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((function(n){return e("div",{"aria-hidden":"true",class:r(["zonos--notification-item",n.type,n.transitionClass]),key:n.id,onClick:function(){t.removeNotification(n.id)}},e("zonos-text",{textColor:"gray-0"},n.message))}))))};return t}());j.style=I;var S=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";var O=S;var U=t("zonos_payment",function(){function t(t){n(this,t);this.stripe=h.stripe;this.stripeElements=h.stripeElements;this.isPaymentInfoFilled=false;this.trackingSent=false}t.prototype.watchIsPaymentInfoFilled=function(){var t;if(this.isPaymentInfoFilled&&!this.trackingSent){var n=f.checkoutSessionId;void l({checkoutSessionId:n,eventName:"checkout_paymentInfoFilled",metadata:{paymentMethod:(t=h.stripePaymentEventData)===null||t===void 0?void 0:t.value.type}});this.trackingSent=true}};t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e;var o=this;return __generator(this,(function(s){switch(s.label){case 0:if(!this.stripeElements){return[2]}return[4,this.stripeElements.fetchUpdates()];case 1:s.sent();n=h.stripePaymentElement||this.stripeElements.create("payment",{defaultValues:{billingDetails:{address:{country:(t=h.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country}}},layout:"tabs"});e=this.el.querySelector(".zonos--payment-component");if(!e){p("Cannot find container element for paymentElement");return[2]}n.mount(e);n.on("change",(function(t){if(t.complete){o.isPaymentInfoFilled=true}h.stripePaymentEventData=t}));h.stripePaymentElement=n;return[2]}}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(o,{key:"faf7791e4cbf6bf8c98fe0b2f368f408ef32b644",class:"zonos--payment zonos--elements"},this.titleText&&e("zonos-text",{key:"e6103d0e04f9905b90533bf94539aaae1d5aa604",class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{key:"b042060ff6fef2d7f20b20ec672b2696cb5f837c",class:"zonos--payment-component"}),e("div",{key:"b6a220513bb964a057c70141dcec89059dbbb0c8",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());U.style=O;var C=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var P=C;var T=t("zonos_paypal_payment",function(){function t(t){n(this,t);this.paypalSessionDone=a(this,"paypalSessionDone",7);this.paypalSessionFail=a(this,"paypalSessionFail",7);this.storeUnsubscribeList=[]}t.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var e=this;return __generator(this,(function(o){if(!window.Zonos.paypal){m("Paypal is not available");return[2]}t=y({onPaypalFail:function(){m("onPaypalFail");e.paypalSessionFail.emit()},onPaypalSessionDone:function(t){var n=t.orderId;m("onPaypalSessionDone","info",{orderId:n});e.paypalSessionDone.emit({orderId:n})}});if(!(t===null||t===void 0?void 0:t.length)){m("There are no paypal buttons available");return[2]}n=this.el.querySelector(".zonos--payment-paypal-container");if(!n){m("Cannot find container element for paypal buttons");return[2]}t.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,t.render(n)];case 1:e.sent();return[2]}}))}))}));return[2]}))}))};t.prototype.componentWillLoad=function(){this.storeUnsubscribeList=[d("paypal",this.loadPaypal.bind(this))]};t.prototype.componentDidLoad=function(){void this.loadPaypal()};t.prototype.disconnectedCallback=function(){this.storeUnsubscribeList.forEach((function(t){return t()}))};t.prototype.render=function(){return e(o,{key:"2eb9e7f7acbe26f51c32ceb722f1e59832ac918a",class:"zonos--paypal-payment zonos--elements"},e("div",{key:"47ad7f3dfdea67dd5e222e6bbba46ed4599680be",class:"zonos--payment-paypal-container"}))};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());T.style=P}}}));
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(o,e,n,t){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,r){function i(o){try{l(t.next(o))}catch(o){r(o)}}function a(o){try{l(t["throw"](o))}catch(o){r(o)}}function l(o){o.done?n(o.value):s(o.value).then(i,a)}l((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},t,s,r,i;return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(o){return function(e){return l([o,e])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(n=0)),n)try{if(t=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=e.call(o,n)}catch(o){a=[6,o];s=0}finally{t=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-e4dc24e1.system.js","./p-916228fb.system.js","./p-de58684b.system.js","./p-c0af11fe.system.js","./p-14afffa8.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-6890e060.system.js","./p-989cb22b.system.js"],(function(o){"use strict";var e,n,t,s,r,i,a,l,c,d,u,f,m,p,h,v,z,y,g,x;return{setters:[function(o){e=o.r;n=o.h;t=o.F;s=o.a;r=o.g},function(o){i=o.a1;a=o.G;l=o.a2;c=o.a3;d=o.a4;u=o.U;f=o.a5;m=o.a6;p=o.K},function(o){h=o.l;v=o.t},function(o){z=o.z;y=o.f},function(o){g=o.r},function(o){x=o.g},function(){},function(){},function(){},function(){}],execute:function(){var b=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}";var w=b;var k="POLICIES";var j=o("zonos_policy_consent",function(){function o(o){e(this,o)}o.prototype.render=function(){var o=i();if(!o.length){return null}var e=Intl.ListFormat;var r=e?new e(h.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(o.map((function(o){return o.name}))):o.flatMap((function(o,e){return e===0?[{type:"element",value:o.name}]:[{type:"literal",value:", "},{type:"element",value:o.name}]}));var l=r.map((function(e){if(e.type==="literal"){return e.value}var t=o.find((function(o){return o.name===e.value}));if(!t){return e.value}return n("a",{href:t.url,onClick:function(o){o.preventDefault();o.stopPropagation();window.open(t.url,"_blank","noopener,noreferrer")},rel:"noopener noreferrer",target:"_blank"},e.value)}));var c=z.organizationName;var d=c?v("I agree to [merchantName]'s [policies]",{merchantName:c,policies:k}):v("I agree to the [policies]",{policies:k});var u=d.split(k),f=u[0],m=f===void 0?"":f,p=u[1],y=p===void 0?"":p;var g=a.showError;var x="zonos--policy-consent-error";return n(s,{class:"zonos--policy-consent-host"},n("div",{class:"zonos--policy-consent".concat(g?" zonos--policy-consent--error":"")},n("label",{class:"zonos--policy-consent-label"},n("input",{"aria-describedby":g?x:undefined,"aria-invalid":g?"true":"false",checked:a.accepted,class:"zonos--policy-consent-checkbox",disabled:a.locked,onChange:function(o){var e=o.target.checked;a.accepted=e;if(e){if(!a.acceptedAt){a.acceptedAt=(new Date).toISOString()}a.showError=false}else{a.acceptedAt=null}},type:"checkbox"}),n("span",{class:"zonos--policy-consent-text"},m,n(t,null,l),y))),g&&n("div",{class:"zonos--policy-consent-error",id:x,role:"alert"},v("You must accept the policies to place this order")))};return o}());j.style=w;var C='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n';var I=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';var _=I;var S="full";var E="custom";var N=o("zonos_store_credit",function(){function o(o){var n=this;e(this,o);this.enabled=true;this.customAmountInput="";this.handleUseStoreCreditChange=function(o){l(o);if(o){c(true)}void d()};this.handleAmountModeChange=function(o){var e=o===S;c(e);if(!e){n.customAmountInput=""}void d()};this.handleCustomAmountChange=function(o){n.customAmountInput=o;u.error=null};this.handleApplyCustomAmount=function(){var o=parseFloat(n.customAmountInput);if(!isNaN(o)&&o>0){f(o)}else{f(null)}if(!u.error){void d()}}}o.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,m()];case 1:o.sent();return[2]}}))}))};o.prototype.render=function(){var o=this;if(!this.enabled){return null}var e=z.appearance.colorPrimary;var r=x({});var i=u.availableBalance;var a=i!==null&&i>0;var l=u.isEnabled;var c=u.useFullBalance;var d=u.error;var f=p();var m=g({amount:i!==null&&i!==void 0?i:0,isForeign:true});return n(s,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":r,"--zonos--font-family":y(),"--zonos--primary-color":e}},n("div",{class:"zonos--store-credit-container"},n("div",{class:"zonos--store-credit-header"},n("div",{class:"zonos--store-credit-title-row"},n("div",{class:"zonos--store-credit-title-left"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:22})),n("zonos-text",{type:"semiBoldLabel"},v("Store credit"))),a&&n("div",{class:"zonos--store-credit-balance-badge"},n("zonos-text",{textColor:"gray-600",type:"caption"},m)))),n(t,null,a?n("div",{class:"zonos--store-credit-content"},n("div",{class:"zonos--store-credit-checkbox"},n("zonos-checkbox",{isChecked:l,label:v("Use store credit"),onCheckboxSelected:function(e){return o.handleUseStoreCreditChange(e.detail)},size:16})),l&&n("div",{class:"zonos--store-credit-options"},n("div",{class:"zonos--store-credit-toggle-row"},n("zonos-toggle",{onToggleChanged:function(e){return o.handleAmountModeChange(e.detail)},options:[{label:v("Apply full balance"),value:S},{label:v("Enter amount"),value:E}],value:c?S:E})),!c&&n("div",{class:"zonos--store-credit-custom-amount"},n("div",{class:"zonos--store-credit-custom-amount-row"},n("zonos-input",{inputLabel:v("Enter amount"),inputValue:this.customAmountInput,isError:!!d,onInputChange:function(e){return o.handleCustomAmountChange(e.detail)}}),n("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},v("Apply")))),d&&n("div",{class:"zonos--store-credit-error"},n("zonos-text",{textColor:"red-600",type:"caption"},d)),n("div",{class:"zonos--store-credit-summary"},n("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},v("Amount to apply: [amount]",{amount:g({amount:f,isForeign:true})}))))):n("div",{class:"zonos--store-credit-empty"},n("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},n("zonos-icon",{content:C,iconColor:"gray-500",size:28})),n("zonos-text",{textColor:"gray-600",type:"caption"},v("No store credit available"))))))};Object.defineProperty(o.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return o}());N.style=_}}}));
@@ -1 +1 @@
1
- import{r as s,d as t,h as o,a as e,g as n}from"./p-ce75b047.js";import{t as i}from"./p-f4720b0a.js";import{U as a,b as r,t as l,H as d,u as h,d as c}from"./p-dc80cb87.js";import{s as p,B as u,t as f,A as m,l as z}from"./p-6bdc5c96.js";import{z as b,g as v,f as g}from"./p-27660512.js";import{l as y,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-a553e132.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-bcf5cffb.js";import{g as S}from"./p-1834f486.js";import"./p-2bbe9d91.js";import"./p-502d6eeb.js";import"./p-1d42cd20.js";const D=s=>{var t,o,e;return[s.name,null===(t=s.address)||void 0===t?void 0:t.line1,null===(o=s.address)||void 0===o?void 0:o.postal_code,null===(e=s.address)||void 0===e?void 0:e.country].map((s=>(s||"").trim().toLowerCase())).join("|")},N=({currentEvent:s,defaultAddress:t})=>{if(!s)return t;const o=(s=>{const{firstName:t,lastName:o}=a({firstName:s.firstName,lastName:s.lastName,name:s.name});return{address:{city:s.address.city,country:s.address.country,line1:s.address.line1,line2:s.address.line2||void 0,postal_code:s.address.postal_code,state:s.address.state},name:(s.name||`${t} ${o}`).trim(),phone:s.phone||void 0}})(s.value),e=D(o);return t.some((s=>D(s)===e))?t:[o,...t]},L=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=i(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:r.stripeBillingAddressElement,stripeAddressEventData:r.stripeBillingAddressEventData,stripeElements:r.stripeElementsForBillingAddress}:{stripeAddressElement:r.stripeAddressElement,stripeAddressEventData:r.stripeAddressEventData,stripeElements:r.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?r.stripeBillingAddressEventData=s:r.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,l({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?r.stripeBillingAddressElement=s:r.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void y("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,n=e?Object.values(e).map((s=>s.code)):[],i=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?n:[],l=(null==s?void 0:s.value.address.country)||u(r);A(`Stripe country code: ${l}`,"info");const d=t.create("address",{allowedCountries:i?[]:r,contacts:N({currentEvent:s,defaultAddress:o}),defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:l}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=a({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?r.stripeAddressEventData=null:r.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:r.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:r.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{r.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:r.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{r.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:r.companyName,onInputChange:s=>{r.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"9b7a5340b839d63c64da03639bdfda5a11a5c25e",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"23739f6a48e5698372df2d53098dea6ad1c0559a",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"dea4b437eedaad2af2f6bbe3a1e2ae4f0706aa13",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"b4be684977a632371b9b6ff4587ccdd7bacc8c67",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};L.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const Z=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=v(b.appearance.theme);return o(e,{key:"9ad8aff8631692fa53ef172869d98e9fbfbdc059",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":g()}},o("div",{key:"6d7c55b90bfb05890d876a0243558eb9a2e7a772",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"abf306ddd70cefd64aa6804aeccf700506c175d7",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"dc7e9e6d501872597928603ded57d82c15c26710",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"5c1fa9ec8b59cba68ccbc5dc36e66e2fdefdeae5",class:"wrapper"},o("div",{key:"0ce48c41c78e393a181fd5e9beeac90622b5c620",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"b42157f8e76de8a60190e384d7d53a36d8051c67",class:"content"},o("div",{key:"bd8eb897f15a6d095df8fbd1803f62a11b9d5d7b",class:"title"},o("zonos-text",{key:"d1c06b89d4917b2366f881dda7da9e1369722126",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"4f1269aaab5ad3965d6ddfc0949341d4f202f296",class:"subtitle"},o("zonos-text",{key:"f784b5dd86ff684e790f27a586e3eeb4ac683884",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"e0403a968aee6ff878c9e916e9ff216e2052ab0c",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"66e34a9d61f677786bfe286f377854c9ebc780ed",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"3652507591e3055856a044e191525ea36b6042ca",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return n(this)}};Z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-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)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);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 .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const B=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),O=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=r.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=B(s);r.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!r.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=r.stripeLinkElement||r.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void y("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;r.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),r.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(r.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=r.stripeLinkElement)||void 0===o||o.clear(),null===(e=r.stripeLinkElement)||void 0===e||e.destroy(),r.stripeLinkElement=null,r.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=r.clientSecret})),d("stripe",(async()=>{this.stripe=r.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=B(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};O.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const M=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"8cafd99b309b04da5cf1b26b0f0804f4699c06b2",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"9ce7ac9b7e6956a5f76fc2105fa7f5d05299fd36",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"4be3a8d471e3aead2e4194c4ecbf66878a7a3f17",size:this.size,spinnerColor:this.spinnerColor})))}};M.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{L as zonos_address,Z as zonos_confirm_dialog,O as zonos_link_authentication,M as zonos_loading_overlay}
1
+ import{r as s,d as t,h as o,a as e,g as n}from"./p-ce75b047.js";import{t as i}from"./p-f4720b0a.js";import{W as a,b as r,t as l,J as d,w as h,d as c}from"./p-a4c7ee17.js";import{s as p,B as u,t as f,A as m,l as z}from"./p-6bdc5c96.js";import{z as b,g as v,f as g}from"./p-27660512.js";import{l as y,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-a553e132.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-bcf5cffb.js";import{g as S}from"./p-1834f486.js";import"./p-2bbe9d91.js";import"./p-502d6eeb.js";import"./p-1d42cd20.js";const D=s=>{var t,o,e;return[s.name,null===(t=s.address)||void 0===t?void 0:t.line1,null===(o=s.address)||void 0===o?void 0:o.postal_code,null===(e=s.address)||void 0===e?void 0:e.country].map((s=>(s||"").trim().toLowerCase())).join("|")},N=({currentEvent:s,defaultAddress:t})=>{if(!s)return t;const o=(s=>{const{firstName:t,lastName:o}=a({firstName:s.firstName,lastName:s.lastName,name:s.name});return{address:{city:s.address.city,country:s.address.country,line1:s.address.line1,line2:s.address.line2||void 0,postal_code:s.address.postal_code,state:s.address.state},name:(s.name||`${t} ${o}`).trim(),phone:s.phone||void 0}})(s.value),e=D(o);return t.some((s=>D(s)===e))?t:[o,...t]},L=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=i(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:r.stripeBillingAddressElement,stripeAddressEventData:r.stripeBillingAddressEventData,stripeElements:r.stripeElementsForBillingAddress}:{stripeAddressElement:r.stripeAddressElement,stripeAddressEventData:r.stripeAddressEventData,stripeElements:r.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?r.stripeBillingAddressEventData=s:r.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,l({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?r.stripeBillingAddressElement=s:r.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void y("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,n=e?Object.values(e).map((s=>s.code)):[],i=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),r="shipping"===this.type?n:[],l=(null==s?void 0:s.value.address.country)||u(r);A(`Stripe country code: ${l}`,"info");const d=t.create("address",{allowedCountries:i?[]:r,contacts:N({currentEvent:s,defaultAddress:o}),defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:l}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=a({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?r.stripeAddressEventData=null:r.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:r.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:f(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:r.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{r.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:f("Short address code"),inputPlaceholder:"RRRD2929",inputValue:r.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{r.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:f("Company name (optional)"),inputValue:r.companyName,onInputChange:s=>{r.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[m("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=r.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"9b7a5340b839d63c64da03639bdfda5a11a5c25e",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"23739f6a48e5698372df2d53098dea6ad1c0559a",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"dea4b437eedaad2af2f6bbe3a1e2ae4f0706aa13",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"b4be684977a632371b9b6ff4587ccdd7bacc8c67",class:"zonos--address-component"}))}get el(){return n(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};L.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const Z=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=f("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=v(b.appearance.theme);return o(e,{key:"9ad8aff8631692fa53ef172869d98e9fbfbdc059",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":g()}},o("div",{key:"6d7c55b90bfb05890d876a0243558eb9a2e7a772",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"abf306ddd70cefd64aa6804aeccf700506c175d7",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"dc7e9e6d501872597928603ded57d82c15c26710",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"5c1fa9ec8b59cba68ccbc5dc36e66e2fdefdeae5",class:"wrapper"},o("div",{key:"0ce48c41c78e393a181fd5e9beeac90622b5c620",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"b42157f8e76de8a60190e384d7d53a36d8051c67",class:"content"},o("div",{key:"bd8eb897f15a6d095df8fbd1803f62a11b9d5d7b",class:"title"},o("zonos-text",{key:"d1c06b89d4917b2366f881dda7da9e1369722126",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"4f1269aaab5ad3965d6ddfc0949341d4f202f296",class:"subtitle"},o("zonos-text",{key:"f784b5dd86ff684e790f27a586e3eeb4ac683884",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"e0403a968aee6ff878c9e916e9ff216e2052ab0c",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"66e34a9d61f677786bfe286f377854c9ebc780ed",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||f("Cancel")),o("zonos-button",{key:"3652507591e3055856a044e191525ea36b6042ca",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return n(this)}};Z.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-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)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);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 .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const B=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),O=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=r.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=B(s);r.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!r.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=r.stripeLinkElement||r.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void y("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;r.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),r.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(r.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=r.stripeLinkElement)||void 0===o||o.clear(),null===(e=r.stripeLinkElement)||void 0===e||e.destroy(),r.stripeLinkElement=null,r.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=r.clientSecret})),d("stripe",(async()=>{this.stripe=r.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=r.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:f("Email"),inputValue:this.defaultEmail||(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=r.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=B(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},f("Please enter a valid email address.")))}get el(){return n(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};O.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const M=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"8cafd99b309b04da5cf1b26b0f0804f4699c06b2",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"9ce7ac9b7e6956a5f76fc2105fa7f5d05299fd36",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"4be3a8d471e3aead2e4194c4ecbf66878a7a3f17",size:this.size,spinnerColor:this.spinnerColor})))}};M.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{L as zonos_address,Z as zonos_confirm_dialog,O as zonos_link_authentication,M as zonos_loading_overlay}
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,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(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-de58684b.system.js","./p-916228fb.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-6890e060.system.js","./p-14afffa8.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.l;a=e.j;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=e("g",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2,{errors:n,json:o}]}}))}))}));var A=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),O=A.onChange,C=A.reset,k=A.state;e("U",k);var I=e("V",(function(){C()}));var T=function(e){d("Store credit balance from session","info",e);k.availableBalance=e};var P=e("a6",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;T(i);return[2]}}))}))}));var E=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);k.error=n;return[2,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});k.isApplying=true;k.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}]}k.appliedAmount=a.amountApplied;k.remainingBalance=a.remainingBalance;k.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}];case 4:return[2]}}))}))}));var N=e("a2",(function(e){k.isEnabled=e;k.error=null;if(!e){k.amountToApply=null}}));var j=e("a5",(function(e){if(e===null){k.amountToApply=null;k.error=null;return}if(e<=0){k.error="Amount must be greater than zero";return}if(k.availableBalance!==null&&e>k.availableBalance){k.error="Amount exceeds available balance";return}var r=Ze.total+(Ze.storeCredit||0);if(e>r){k.error="Amount exceeds order total";return}k.error=null;k.amountToApply=e}));var D=e("a3",(function(e){k.useFullBalance=e;k.error=null;if(e&&k.availableBalance!==null){var r=Ze.total+(Ze.storeCredit||0);var n=Math.min(k.availableBalance,r);k.amountToApply=n}else if(!e){k.amountToApply=null}}));var L=function(){if(!k.isEnabled||k.amountToApply===null){return{mode:"NONE"}}if(k.useFullBalance){return{mode:"FULL"}}return{amount:k.amountToApply,mode:"PARTIAL"}};var x=e("K",(function(){if(!k.isEnabled||k.availableBalance===null){return 0}if(k.useFullBalance){return Math.min(k.availableBalance,Ze.total+(Ze.storeCredit||0))}return k.amountToApply||0}));var R=e("B",(function(){return k.amountToApply!==null&&k.amountToApply>0&&Ze.storeCredit>0&&Ze.total<=0}));var U=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);k.error=i;return[2,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;k.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}];case 4:return[2]}}))}))}));var z=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];var B={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var F=r({accepted:false,acceptedAt:null,locked:false,showError:false}),J=F.reset,M=F.state;e({p:J,G:M});var q=e("a1",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return z.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(B[n]),url:a});return r}),[])}));var W=e("y",(function(){return q().length>0}));var Y=e("W",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var H=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};var K=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=ce.stripeLinkEventData;var s=ce.stripeAddressEventData;var u=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}var d=H({currentAddress:s,translatedAddress:ce.translatedAddress.address});var l=Y({name:d.name}),c=l.firstName,v=l.lastName;var f=H({currentAddress:u,translatedAddress:ce.translatedAddress.address});var p=Y({name:f.name}),m=p.firstName,h=p.lastName;var w=a()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:m,lastName:h,phone:f.phone},cartCurrencyCode:(r=Ze.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||i.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Ze.promoCode?[{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var G=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var r=ce.stripeLinkEventData;var n=ce.stripeAddressEventData;var o=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}var i=H({currentAddress:n,translatedAddress:ce.translatedAddress.address});var a=Y({name:i.name}),s=a.firstName,u=a.lastName;var l=H({currentAddress:o,translatedAddress:ce.translatedAddress.address});var c=Y({name:l.name}),v=c.firstName,f=c.lastName;var p=Ze.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Ze.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:r===null||r===void 0?void 0:r.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Ze.items,landedCostAdjustments:m,shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=G();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Ze.promoCode})];case 1:s=v.sent();if(!s||!((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var X=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,V(t)];case 1:o=d.sent();return[2,o];case 2:return[4,c("/api/zonos-elements/calculate-landed-cost",{body:G(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}a.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2,s]}return[2,s]}}))}))};var Z=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,c("/api/zonos-elements/cart-calculate-landed-cost",{body:K(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var $=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3,2];return[4,X(e)];case 1:n=a.sent();return[2,n];case 2:return[4,Z({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var ee=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,a,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&!window.Zonos.zonosConversionTest){return[2]}d=i.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}});return[2]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:a}),organizationId:v};return[4,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var re=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}return Object.keys(t).length?t:undefined};var ne=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;var l=Y({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=Y({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:re({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),billingAddress:!i?re({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};var te=e("a0",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));var oe=e("C",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,i,a;return __generator(this,(function(s){switch(s.label){case 0:return[4,S()];case 1:n=s.sent(),t=n.errors,i=n.json;if(t.length||!i){v("Failed to retrieve checkout session info before confirming payment ",t);void h({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:l}});return[2,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}a=!!(((e=i.checkoutSession.order)===null||e===void 0?void 0:e.id)&&!i.checkoutSession.completedAt);if(!a&&!((r=i.checkoutSession.landedCost)===null||r===void 0?void 0:r.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2,{errorMessage:o('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))}));var ie=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ae=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var se={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var ue=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),de=ue.onChange,le=ue.reset,ce=ue.state;e({J:de,b:ce});var ve=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},ie({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},ae({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:m,customerSessionClientSecret:ce.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:i.selectedLocale}};var fe=e("u",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var pe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var me=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var he=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=ce.clientSecret;if(!ce.stripe){d("Skip. Stripe is not initialized");return[2]}o=ve({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(ce.stripeElementsOptions);if(!ce.stripeElements||!ce.stripeElementsForBillingAddress){ce.stripeElementsForBillingAddress=(r=ce.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");ce.stripeElements=(n=ce.stripe)===null||n===void 0?void 0:n.elements(o);ce.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){ce.stripeElements.update(o);ce.stripeElementsForBillingAddress.update(o);ce.stripeElementsOptions=o;void ce.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var we=e("H",(function(){sessionStorage.removeItem("zonos--client-secret");le();ce.stripe=window.Zonos.stripe}));var ye=function(){var e,r,n,t;var o=JSON.stringify((e=ce.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!ce.stripeShippingSameAsBilling&&JSON.stringify((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ge=function(){var e,r,n,t,o,i,a,s;var u=(e=Ze.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Ze.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;if(!u||!d){return false}if(ce.partyShippingId!==u||ce.partyBillingId!==d){return true}var l=JSON.stringify((n=ce.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=ce.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!ce.stripeShippingSameAsBilling&&JSON.stringify((a=ce.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=ce.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=ce.taxIdUsedWhenAsyncAddressUpdate!==ce.taxId;var p=ce.companyNameUsedWhenAsyncAddressUpdate!==ce.companyName;return l||c||v||f||p};var be=e("M",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=Y({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var _e=e("Z",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=ce.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!ce.stripeShippingSameAsBilling&&!((r=ce.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!ce.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Ze.landedCostData){return[2,{partiesCreated:false}]}i=(n=Ze.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=ge();if(!a){return[2,{partiesCreated:false}]}s=be({address:ce.stripeAddressEventData.value.address,firstName:ce.stripeAddressEventData.value.firstName,lastName:ce.stripeAddressEventData.value.lastName,name:ce.stripeAddressEventData.value.name,phone:ce.stripeAddressEventData.value.phone});u=ce.stripeShippingSameAsBilling?s:be({address:ce.stripeBillingAddressEventData.value.address,firstName:ce.stripeBillingAddressEventData.value.firstName,lastName:ce.stripeBillingAddressEventData.value.lastName,name:ce.stripeBillingAddressEventData.value.name,phone:ce.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:ce.companyName,email:((o=ce.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:ce.shortAddressCode,taxId:ce.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2,{partiesCreated:false}]}ce.companyNameUsedWhenAsyncAddressUpdate=ce.companyName;ce.stripeAddressUsedWhenAsyncAddressUpdate=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenAsyncAddressUpdate=ce.stripeBillingAddressEventData;ce.taxIdUsedWhenAsyncAddressUpdate=ce.taxId;ce.partyBillingId=m.billToPartyId;ce.partyShippingId=m.shipToPartyId;Ze.partiesData=Ze.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2,{partiesCreated:true}]}}))}))}));var Se=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Ae=function(){var e,r;var n=JSON.stringify((e=ce.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=ce.stripeAddressEventData&&JSON.stringify(Se(ce.stripeAddressEventData.value))!==JSON.stringify(ce.stripeAddressUsedWhenFetchingLC);var o=!ce.stripeShippingSameAsBilling&&ce.stripeBillingAddressEventData&&JSON.stringify(Se(ce.stripeBillingAddressEventData.value))!==JSON.stringify(ce.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};var Oe=function(){var e;var r=Ze.landedCostData&&((e=Ze.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Ze.subtotal;var n=Ae();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});return!Ze.landedCostData&&!ce.isFetchingLandedCost||n||r};var Ce=e("Y",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Ze.addressFormRenderType==="stripe"){return a||s}return s}));var ke=function(){var e,r,n,t;var o=!!((e=ce.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=ce.stripeShippingSameAsBilling?i:!!((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ce(s);if(i&&a&&o){return true}if(!u||!ce.stripeAddressEventData){return i&&a&&o}var d=ce.stripeAddressEventData.value.address.line1.length>0;var l=ce.stripeAddressEventData.value.firstName&&ce.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&ce.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&ce.stripeAddressEventData.value.address.postal_code.length>=3;var f=ce.stripeAddressEventData.value.phone&&ce.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var Ie=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;ce.fetchingLandedCostAbortController=r;mr();return[4,$(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;Ze.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Ze.shippingData=te((d===null||d===void 0?void 0:d.filter(Boolean))||[]);rr(a);ce.fetchingLandedCostAbortController=null;Ze.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];Ze.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void ee({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Ze.promoCodeApplied&&!Ze.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Ze.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Ze.promoCode)}return[2]}}))}))};var Te=e("w",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=ke();if(!u){return[2,{isRequestNotReady:true}]}if(s){(r=ce.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();ce.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){ce.isFetchingLandedCost=false;setTimeout((function(){ce.isFetchingLandedCost=true}),300)}else{ce.isFetchingLandedCost=true}if(ce.stripeAddressEventData){ce.stripeAddressUsedWhenFetchingLC={countryCode:ce.stripeAddressEventData.value.address.country,postalCode:ce.stripeAddressEventData.value.address.postal_code,state:ce.stripeAddressEventData.value.address.state}}if(ce.stripeBillingAddressEventData){ce.stripeBillingAddressUsedWhenFetchingLC={countryCode:ce.stripeBillingAddressEventData.value.address.country,postalCode:ce.stripeBillingAddressEventData.value.address.postal_code,state:ce.stripeBillingAddressEventData.value.address.state}}if(ce.stripeLinkEventData){ce.stripeLinkUsedWhenFetchingLC=Object.assign({},ce.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);mr();return[4,Ie()];case 2:w.sent();d=(n=Ze.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Ze.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){ir({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:f=w.sent();Ze.landedCostData=[];Ze.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3,6];if(!(i<1))return[3,5];return[4,Te(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=ce.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3,7];case 7:ce.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var Pe=e("Q",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,Te({applyingPromocode:true})];case 1:o.sent();if(Ze.step==="payment"){yr()}return[4,_e()];case 2:o.sent();n=(e=Ze.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2]}return[4,cr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2]}}))}))}));var Ee=e("S",(function(){Ze.promoCode="";sessionStorage.removeItem("zonos--promo-code");Ze.promoCodeError=false;Ze.promoCodeApplied=false}));var Ne=e("R",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Ze.step==="payment"){yr()}Ee();return[4,Pe()];case 1:e.sent();return[2]}}))}))}));var je=e("T",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;switch(e){case"succeeded":{r=[o("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",o("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));var De=e("n",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3,2];return[4,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!u.available||u.status===204){return[2,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){ce.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4,t({items:Ze.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ze.items}});throw l;case 6:return[2]}}))}))}));var Le=e("F",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2]}return[4,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var xe=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=je(f),n=r.isError,t=r.messages;return[2,{error:n,messages:t}]}i=c||ce.clientSecret;if(!ce.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[o("Something went wrong.")]}]}if(!i.includes("_secret_")){return[2,{error:true,messages:[o("Something went wrong.")]}]}return[4,ce.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=je(s),d=u.isError,l=u.messages;return[2,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("E",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=ce.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=ce.stripeElements;s=ce.stripe;u=ce.clientSecret;ce.customErrorMessage=null;if(!((n=Ze.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,oe()];case 1:l=h.sent();if(!l.valid){ce.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void ee({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var Ue=function(){if(!M.accepted){return null}var e=q();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:M.acceptedAt||(new Date).toISOString(),locale:i.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};var ze=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(se).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var Be=e("q",(function(){var e;var r=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Ze.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:i.selectedLocale}],paymentProcessor:ze(),presentmentCountryCode:i.selectedCountryCode,skipPaymentIntent:ce.skipPaymentIntent,varianceTestInput:n};return o}));var Fe=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}return[4,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}ur(i.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var Je=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,a,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!i.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}ce.isFetchingSession=true;n=Be();d("Checkout session body","info",n);return[4,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,a=t.json;ce.isFetchingSession=false;if(o.length||!a){s=(e=o.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2,false]}u=a.checkoutSessionCreate;ur(u);ir({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Ze.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var Me=e("z",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){v("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:ce.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==ce.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var qe=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,a;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:ce.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:i.selectedLocale}],presentmentCountryCode:m,shipToPartyId:ce.partyShippingId,skipPaymentIntent:ce.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:a}]}return[2,{errors:[],json:a}]}}))}))};var We=e("L",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=Ue();if(!e){return[2,{errors:[]}]}if(!t.checkoutSessionId){return[2,{errors:[]}]}return[4,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2,{errors:[]}]}}))}))}));var Ye=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};var He=e("X",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=ne({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:ce.stripeAddressEventData,stripeBillingAddressEventData:ce.stripeBillingAddressEventData,stripeShippingSameAsBilling:ce.stripeShippingSameAsBilling});if(!i){ce.translatedAddress={address:{},billingAddress:{}};return[2]}a=ye();if(!a){return[2]}return[4,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));ce.translatedAddress={address:{},billingAddress:{}};return[2]}ce.stripeAddressUsedWhenValidatingAddress=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenValidatingAddress=ce.stripeBillingAddressEventData;l=(r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;ce.translatedAddress={address:l?Ye({currentAddress:Object.assign(Object.assign({},l),{name:(t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!ce.stripeShippingSameAsBilling?Ye({currentAddress:Object.assign(Object.assign({},f),{name:(o=ce.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2]}}))}))}));de("clientSecret",(function(e){if(e&&ce.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var Ke=e("P",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ge.onChange,Xe=Ge.reset,Ze=Ge.state;e({I:Ve,d:Ze});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};var $e=e("_",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var er=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};var rr=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Ze.items.find((function(r){return er({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Ze.restrictedItems=r;Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return er({item1:r,item2:e})}))})}));return{cartItems:Ze.items,restrictedItems:r}};var nr=null;var tr=e("f",(function(){t.checkoutSessionId=null;if(nr){clearTimeout(nr);nr=null}I();Xe()}));var or=e("r",(function(e){var r=e.messages,n=e.title;tr();we();Ze.step="error";Ze.error={messages:r,title:n}}));var ir=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;Ze.exchangeRate=t.exchangeRate;Ze.adjustmentTotal=t.adjustments;Ze.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Ze.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Ze.subtotal=t.items;Ze.total=t.total;Ze.currency=t.presentmentCurrencyCode;Ze.dutiesTaxesFeesEstimate=r||null};var ar=e("O",(function(){var e=Ze.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var sr=e("m",(function(){var e,r;return!!(((r=(e=Ze.checkoutSession)===null||e===void 0?void 0:e.order)===null||r===void 0?void 0:r.id)&&!Ze.checkoutSession.completedAt)}));var ur=e("v",(function(e){var r,n,o,i,a,c,v;ce.clientSecret=e.clientSecret;ce.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;ce.customerProfile=e.customerProfile;Ze.checkoutSession=e;T((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var f=s(e.varianceTestResults||[]);u(f);var p=((a=(i=(o=Ze.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||((v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Ze.externalConfirmationPageURL=p}}));var dr=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,a,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Ze.selectedLandedCost){n=Ze.selectedLandedCost.subtotals;ir({dutiesTaxesFeesEstimate:m,method:Ze.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,qe({adjustmentsAmount:c,billToPartyId:ce.partyBillingId,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:i.selectedCountryCode,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];v("Error occurs when updating checkout session.");if(!y)return[3,3];d("Initiating checkout session on failure","info");return[4,Je()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){ir({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Ze.exchangeRate)}ur(u.checkoutSessionUpdate);return[2,true]}}))}))};var lr=e("$",(function(e,r){var t,o,i,a;if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}if(Ke({deliveryType:r,landedCost:e,shipToCountry:(a=ce.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var cr=e("N",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,A,O,C,k,I,T,P;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Ze.selectedShippingOption=j;h=$e(Ze.selectedShippingOption);if(h){w=h.maxTransit,y=h.minTransit,g=h.unit;Ze.selectedShippingOptionTransitTime="".concat(y,"-").concat(w," ").concat(g)}else{Ze.selectedShippingOptionTransitTime=""}b=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===N}));Ze.selectedLandedCost=b||null;if(!b){return[2,false]}_=((o=b.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;A=_*S;if(A){d("DAP quote, using estimate: ".concat(A),"info")}Ze.landedCostMethod=lr(b.landedCost,(i=j.shippingProfile)===null||i===void 0?void 0:i.serviceLevel.deliveryType);Ze.shipping=b.subtotals.shipping;O=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Ze.isSelectedShippingAboveDeminimis=C;Ze.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];I=b.subtotals;ir({dutiesTaxesFeesEstimate:A,method:Ze.landedCostMethod,subtotals:I});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate);k=true;return[3,3];case 1:return[4,dr({adjustmentsAmount:Ze.adjustmentTotal,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:A,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:T=(c=Ze.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;P=((v=ce.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";ce.shouldRenderPayInUsdButton=T==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=Ze.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(P));return[2,k]}}))}))}));var vr=e("o",(function(e){var r=e.isPreview,n=e.sessionTimeout;if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Ze.checkoutTimeoutInterval=setTimeout((function(){Ze.checkoutSessionTimeoutShow=true}),o)}));var fr=e("j",(function(){if(Ze.checkoutTimeoutInterval){clearTimeout(Ze.checkoutTimeoutInterval);Ze.checkoutTimeoutInterval=null}}));var pr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var mr=function(){Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Ze.restrictedItems=[]};var hr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var a=e.adjustments,s=e.cartItems,u=e.landedCostId,d=e.shouldInitSessionOnFailure,l=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:Ze.adjustments=a;Ze.items=pr(s);n=(r=s.find(Boolean))===null||r===void 0?void 0:r.currencyCode;o=s.reduce((function(e,r){return e+r.amount*r.quantity}),0);i=a.reduce((function(e,r){return e+r.amount}),0);if(!n||!o){return[2]}Ze.currency=n;ce.isFetchingSession=true;return[4,dr({adjustmentsAmount:i,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:u,shipToPartyId:ce.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();ce.isFetchingSession=false;return[2]}}))}))}));var wr=function(){Ze.selectedShippingOption=null;Ze.isSelectedShippingAboveDeminimis=false;Ze.isSelectedShippingGuarantee=false;Ze.selectedShippingOptionTransitTime="";Ze.dutiesTaxesFees=0;Ze.dutiesTaxesFeesEstimate=0;Ze.shipping=0;Ze.total=Ze.subtotal};var yr=function(){if(Ze.step==="shipping"){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="payment"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="finish"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false})})}};var gr=e("x",(function(){if(Ze.step==="customer-info"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:true})})}else if(Ze.step==="shipping"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:true})})}else if(Ze.step==="payment"){Ze.step="finish"}}));var br=e("h",(function(){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})});wr()}));var _r=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,a,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2]}n=Ze.selectedLandedCost;o=Ze.currency||((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";a=Ze.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4,qe({adjustmentsAmount:a,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:i.selectedCountryCode,storeCreditApplication:L()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2]}ir({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});ur(c.checkoutSessionUpdate);return[2]}}))}))};var Sr=e("a4",(function(){if(nr){clearTimeout(nr)}nr=setTimeout((function(){nr=null;void _r()}),300)}))}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,t,r,e){function i(n){return n instanceof r?n:new r((function(t){t(n)}))}return new(r||(r=Promise))((function(r,o){function u(n){try{c(e.next(n))}catch(n){o(n)}}function s(n){try{c(e["throw"](n))}catch(n){o(n)}}function c(n){n.done?r(n.value):i(n.value).then(u,s)}c((e=e.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,i,o,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(n){return function(t){return c([n,t])}}function c(s){if(e)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(r=0)),r)try{if(e=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(n,r)}catch(n){s=[6,n];i=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-4a20893e.system.js","./p-916228fb.system.js","./p-01174496.system.js"],(function(n){"use strict";var t,r,e,i;return{setters:[function(n){t=n.d},function(n){r=n.s},function(n){e=n.l;i=n.h}],execute:function(){var o=this;var u=n("p",(function(){return __awaiter(o,void 0,void 0,(function(){var n,o,u,s,c,a,f,l,d;return __generator(this,(function(h){switch(h.label){case 0:u=(n=t.partiesData.find((function(n){return n.type==="DESTINATION"})))===null||n===void 0?void 0:n.id;s=(o=t.partiesData.find((function(n){return n.type==="PAYOR"})))===null||o===void 0?void 0:o.id;c=r.checkoutSessionId;if(!c||!s||!u){e("Missing required data",{billToPartyId:s,checkoutSessionId:c,shipToPartyId:u});return[2,{errors:["Missing required data"],json:null}]}a={billToPartyId:s,checkoutSessionId:c,shipToPartyId:u};return[4,i("/api/zonos-elements/place-test-order",{body:a,method:"POST"})];case 1:f=h.sent(),l=f.errors,d=f.json;if(l.length||!d){e("Error occurs when placing test order",l);return[2,{errors:l.map((function(n){return n.message})),json:null}]}return[2,{errors:[],json:d}]}}))}))}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,t,r,e){function i(n){return n instanceof r?n:new r((function(t){t(n)}))}return new(r||(r=Promise))((function(r,o){function u(n){try{c(e.next(n))}catch(n){o(n)}}function s(n){try{c(e["throw"](n))}catch(n){o(n)}}function c(n){n.done?r(n.value):i(n.value).then(u,s)}c((e=e.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,i,o,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(n){return function(t){return c([n,t])}}function c(s){if(e)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(r=0)),r)try{if(e=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(n,r)}catch(n){s=[6,n];i=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-e4dc24e1.system.js","./p-916228fb.system.js","./p-01174496.system.js"],(function(n){"use strict";var t,r,e,i;return{setters:[function(n){t=n.d},function(n){r=n.s},function(n){e=n.l;i=n.h}],execute:function(){var o=this;var u=n("p",(function(){return __awaiter(o,void 0,void 0,(function(){var n,o,u,s,c,a,f,l,d;return __generator(this,(function(h){switch(h.label){case 0:u=(n=t.partiesData.find((function(n){return n.type==="DESTINATION"})))===null||n===void 0?void 0:n.id;s=(o=t.partiesData.find((function(n){return n.type==="PAYOR"})))===null||o===void 0?void 0:o.id;c=r.checkoutSessionId;if(!c||!s||!u){e("Missing required data",{billToPartyId:s,checkoutSessionId:c,shipToPartyId:u});return[2,{errors:["Missing required data"],json:null}]}a={billToPartyId:s,checkoutSessionId:c,shipToPartyId:u};return[4,i("/api/zonos-elements/place-test-order",{body:a,method:"POST"})];case 1:f=h.sent(),l=f.errors,d=f.json;if(l.length||!d){e("Error occurs when placing test order",l);return[2,{errors:l.map((function(n){return n.message})),json:null}]}return[2,{errors:[],json:d}]}}))}))}))}}}));