@zonos/elements 1.3.221 → 1.3.223

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 (166) hide show
  1. package/dist/cjs/{cart-9a9ae4b9.js → cart-3a2a062c.js} +2 -2
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/{localization-0169b27d.js → localization-12e7e934.js} +1 -1
  4. package/dist/cjs/{paypal-9ee374a0.js → paypal-a1377508.js} +3 -3
  5. package/dist/cjs/{placeTestOrder-0dfff170.js → placeTestOrder-6fcce33e.js} +2 -2
  6. package/dist/cjs/{isCollectMobileTablet-7a9413e3.js → renderFallback-39ba034b.js} +11 -2
  7. package/dist/cjs/{translationStore-0c67178f.js → translationStore-951ed4b4.js} +100 -40
  8. package/dist/cjs/zonos-address_11.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +5 -5
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
  11. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +4 -4
  12. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +35 -42
  13. package/dist/cjs/zonos-collect.cjs.entry.js +22 -15
  14. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
  16. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  17. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  21. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  22. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +1 -1
  23. package/dist/collection/components/checkout/zonos-collect/zonos-collect.css +3 -1
  24. package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +11 -3
  25. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.css +2 -0
  26. package/dist/collection/components/store/translationStore/strings.arabic.js +5 -2
  27. package/dist/collection/components/store/translationStore/strings.base.js +5 -2
  28. package/dist/collection/components/store/translationStore/strings.chinese.js +5 -2
  29. package/dist/collection/components/store/translationStore/strings.danish.js +5 -2
  30. package/dist/collection/components/store/translationStore/strings.dutch.js +5 -2
  31. package/dist/collection/components/store/translationStore/strings.french.js +5 -2
  32. package/dist/collection/components/store/translationStore/strings.german.js +5 -2
  33. package/dist/collection/components/store/translationStore/strings.hebrew.js +5 -2
  34. package/dist/collection/components/store/translationStore/strings.indonesian.js +5 -2
  35. package/dist/collection/components/store/translationStore/strings.italian.js +5 -2
  36. package/dist/collection/components/store/translationStore/strings.japanese.js +5 -2
  37. package/dist/collection/components/store/translationStore/strings.korean.js +5 -2
  38. package/dist/collection/components/store/translationStore/strings.norwegian.js +5 -2
  39. package/dist/collection/components/store/translationStore/strings.polish.js +5 -2
  40. package/dist/collection/components/store/translationStore/strings.portuguese.js +5 -2
  41. package/dist/collection/components/store/translationStore/strings.russian.js +5 -2
  42. package/dist/collection/components/store/translationStore/strings.spanish.js +5 -2
  43. package/dist/collection/components/store/translationStore/strings.swedish.js +5 -2
  44. package/dist/collection/components/store/translationStore/strings.turkish.js +5 -2
  45. package/dist/collection/components/store/translationStore/strings.vietnamese.js +5 -2
  46. package/dist/esm/{cart-b2dd578c.js → cart-7f06662c.js} +2 -2
  47. package/dist/esm/index.js +7 -7
  48. package/dist/esm/{localization-d7125e4e.js → localization-192886e4.js} +1 -1
  49. package/dist/esm/{paypal-555bbf1e.js → paypal-53f1b4a1.js} +3 -3
  50. package/dist/esm/{placeTestOrder-2d67c1a9.js → placeTestOrder-95cbb623.js} +2 -2
  51. package/dist/esm/{isCollectMobileTablet-7f9a5e2b.js → renderFallback-6352363c.js} +11 -3
  52. package/dist/esm/{translationStore-13502f49.js → translationStore-fb98a08d.js} +100 -40
  53. package/dist/esm/zonos-address_11.entry.js +3 -3
  54. package/dist/esm/zonos-cart-items_12.entry.js +5 -5
  55. package/dist/esm/zonos-checkout.entry.js +4 -4
  56. package/dist/esm/zonos-collect-cart-items_3.entry.js +4 -4
  57. package/dist/esm/zonos-collect-finish_6.entry.js +7 -14
  58. package/dist/esm/zonos-collect.entry.js +16 -9
  59. package/dist/esm/zonos-confirm-dialog_2.entry.js +1 -1
  60. package/dist/esm/zonos-controller.entry.js +3 -3
  61. package/dist/esm/zonos-country-flag.entry.js +2 -2
  62. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  63. package/dist/esm/zonos-empty-state-payment_4.entry.js +4 -4
  64. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  65. package/dist/esm/zonos-hello.entry.js +2 -2
  66. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  67. package/dist/esm-es5/{cart-b2dd578c.js → cart-7f06662c.js} +1 -1
  68. package/dist/esm-es5/index.js +1 -1
  69. package/dist/esm-es5/{localization-d7125e4e.js → localization-192886e4.js} +1 -1
  70. package/dist/esm-es5/{paypal-555bbf1e.js → paypal-53f1b4a1.js} +1 -1
  71. package/dist/esm-es5/{placeTestOrder-2d67c1a9.js → placeTestOrder-95cbb623.js} +1 -1
  72. package/dist/esm-es5/renderFallback-6352363c.js +1 -0
  73. package/dist/esm-es5/translationStore-fb98a08d.js +1 -0
  74. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  75. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  76. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  77. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  78. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  79. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  80. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -1
  81. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  82. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  83. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  84. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  85. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  86. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  87. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  88. package/dist/scripts/index.js +1 -1
  89. package/dist/scripts/loadZonos.js +1 -1
  90. package/dist/scripts/zonos.js +1 -1
  91. package/dist/types/components/store/translationStore/strings.arabic.d.ts +4 -1
  92. package/dist/types/components/store/translationStore/strings.base.d.ts +4 -1
  93. package/dist/types/components/store/translationStore/strings.chinese.d.ts +4 -1
  94. package/dist/types/components/store/translationStore/strings.danish.d.ts +4 -1
  95. package/dist/types/components/store/translationStore/strings.dutch.d.ts +4 -1
  96. package/dist/types/components/store/translationStore/strings.french.d.ts +4 -1
  97. package/dist/types/components/store/translationStore/strings.german.d.ts +4 -1
  98. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +4 -1
  99. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +4 -1
  100. package/dist/types/components/store/translationStore/strings.italian.d.ts +4 -1
  101. package/dist/types/components/store/translationStore/strings.japanese.d.ts +4 -1
  102. package/dist/types/components/store/translationStore/strings.korean.d.ts +4 -1
  103. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +4 -1
  104. package/dist/types/components/store/translationStore/strings.polish.d.ts +4 -1
  105. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +4 -1
  106. package/dist/types/components/store/translationStore/strings.russian.d.ts +4 -1
  107. package/dist/types/components/store/translationStore/strings.spanish.d.ts +4 -1
  108. package/dist/types/components/store/translationStore/strings.swedish.d.ts +4 -1
  109. package/dist/types/components/store/translationStore/strings.turkish.d.ts +4 -1
  110. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +4 -1
  111. package/dist/zonos-elements/index.esm.js +1 -1
  112. package/dist/zonos-elements/{p-82e88a33.system.js → p-00423fa0.system.js} +1 -1
  113. package/dist/zonos-elements/p-0c0fda23.js +1 -0
  114. package/dist/zonos-elements/p-19f25feb.system.entry.js +1 -0
  115. package/dist/zonos-elements/p-1cd1da90.system.js +1 -0
  116. package/dist/zonos-elements/{p-c803753e.entry.js → p-2131fa8b.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-8dd47520.system.entry.js → p-245f6ad4.system.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-759ef3ca.entry.js → p-366ea017.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-d291e964.system.entry.js → p-3f3c92db.system.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-960e0ab1.system.entry.js → p-45d288d0.system.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-637b22ee.system.entry.js → p-4637f365.system.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-40a4266f.js → p-4a3abbf2.js} +1 -1
  123. package/dist/zonos-elements/{p-af7b7931.system.entry.js → p-4d9ad3b1.system.entry.js} +1 -1
  124. package/dist/zonos-elements/p-4dcbbd60.js +1 -0
  125. package/dist/zonos-elements/{p-2b3c7c77.system.entry.js → p-520bd291.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-b3d5bcf9.entry.js → p-53b46925.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-b9e9b82f.system.entry.js → p-5e3d2bd2.system.entry.js} +1 -1
  128. package/dist/zonos-elements/p-62fa680d.system.js +1 -0
  129. package/dist/zonos-elements/{p-d3485a03.system.js → p-640a6898.system.js} +1 -1
  130. package/dist/zonos-elements/{p-7ecbb2cb.entry.js → p-6afbbe66.entry.js} +1 -1
  131. package/dist/zonos-elements/p-6cfe66fe.entry.js +1 -0
  132. package/dist/zonos-elements/{p-ce15d62d.system.js → p-6f6573a5.system.js} +1 -1
  133. package/dist/zonos-elements/{p-c7b57886.js → p-7b56e345.js} +1 -1
  134. package/dist/zonos-elements/{p-e5388438.system.entry.js → p-7f7abdf2.system.entry.js} +1 -1
  135. package/dist/zonos-elements/{p-fe7e2dc4.entry.js → p-8194fcd8.entry.js} +1 -1
  136. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  137. package/dist/zonos-elements/{p-3462e9e4.system.entry.js → p-8350937d.system.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-6b3a0874.entry.js → p-9396059b.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-849b47aa.entry.js → p-9b062dfb.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-52d35358.system.entry.js → p-a435931e.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-ea8aff21.system.js → p-a7485913.system.js} +1 -1
  142. package/dist/zonos-elements/{p-3c1b1be1.system.entry.js → p-a95d2034.system.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-48356573.entry.js → p-a9b3cfe1.entry.js} +1 -1
  144. package/dist/zonos-elements/p-abcefd25.entry.js +1 -0
  145. package/dist/zonos-elements/{p-2a6c964d.js → p-b76db2ac.js} +1 -1
  146. package/dist/zonos-elements/{p-e77b6e42.entry.js → p-bdf183a3.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-63a42823.entry.js → p-d1b415cd.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-372c2fc5.entry.js → p-d2098bef.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-7e000a9a.system.js → p-da200c19.system.js} +1 -1
  150. package/dist/zonos-elements/p-df0cbde4.js +1 -0
  151. package/dist/zonos-elements/p-e8accbef.system.entry.js +1 -0
  152. package/dist/zonos-elements/{p-79d8c3f3.system.entry.js → p-e970f2aa.system.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-a08a005d.entry.js → p-fc27467b.entry.js} +1 -1
  154. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  155. package/package.json +1 -1
  156. package/dist/esm-es5/isCollectMobileTablet-7f9a5e2b.js +0 -1
  157. package/dist/esm-es5/translationStore-13502f49.js +0 -1
  158. package/dist/zonos-elements/p-0e07e1d6.entry.js +0 -1
  159. package/dist/zonos-elements/p-126087a2.system.entry.js +0 -1
  160. package/dist/zonos-elements/p-27d9abab.js +0 -1
  161. package/dist/zonos-elements/p-2813d72e.system.js +0 -1
  162. package/dist/zonos-elements/p-2b8897d1.system.entry.js +0 -1
  163. package/dist/zonos-elements/p-73c1e91f.js +0 -1
  164. package/dist/zonos-elements/p-932600b7.js +0 -1
  165. package/dist/zonos-elements/p-9c5b8239.system.js +0 -1
  166. package/dist/zonos-elements/p-a10de7fb.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-9d863a3b.system.js","./p-062430f9.system.js","./p-5a2dd041.system.js","./p-2813d72e.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c;return{setters:[function(n){r=n.c;e=n.z},function(n){t=n.l;o=n.j;i=n.h;a=n.b},function(n){u=n.a},function(n){c=n.a}],execute:function(){var s=this;var l=function(n){var r=!!n.find((function(n){return n.testKey in u}));if(!r){t("No available test key found in response","info",{response:n})}return!!n.find((function(n){return n.testKey in u}))};var v=n("f",(function(n){if(!l(n)){return[]}return n.filter((function(n){var r;var e=u[n.testKey]&&!n.selectedVariantKey;var t=n.selectedVariantKey&&!!((r=u[n.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(n.selectedVariantKey));return e||t})).map((function(n){return Object.assign(Object.assign({},n),{expiresAt:n.expiresAt||Date.now()+d,selectedVariantKey:n.selectedVariantKey||null})}))}));var d=n("V",60*60*24*1e3);var f=r({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:o(localStorage.getItem("zonos--enabled-variant-test-keys"))}),y=f.onChange,w=f.state;n({o:y,s:w});y("enabledVariantTestKeys",(function(){var n;if(!((n=w.enabledVariantTestKeys)===null||n===void 0?void 0:n.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(w.enabledVariantTestKeys))}));y("checkoutSessionId",(function(){if(!w.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",w.checkoutSessionId)}));var m=n("b",(function(n){w.enabledVariantTestKeys=v(n)}));var h=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,i("/api/zonos-elements/get-countries",{method:"GET"})];case 1:n=o.sent(),r=n.errors,e=n.json;if(r.length||!e){return[2,null]}return[2,e];case 2:t=o.sent();return[2,null];case 3:return[2]}}))}))};var g=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,o,u;return __generator(this,(function(c){switch(c.label){case 0:if(!n){return[2,null]}e="/api/zonos-elements/country-landed-cost/".concat(n);return[4,i(e)];case 1:t=c.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,u||null]}}))}))};var _={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var p=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,o,u,c,s,l,v,d;var f=n.country,y=n.isGuaranteed,w=n.sourceCurrency,m=n.targetCurrency;return __generator(this,(function(n){switch(n.label){case 0:if(w===m&&!y){return[2,_]}e=new URLSearchParams;e.set("sourceCurrency",w);e.set("targetCurrency",m);e.set("isGuaranteed",String(y));e.set("country",f||"");return[4,i("/api/zonos-elements/exchange-rates?".concat(e.toString()))];case 1:t=n.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,_]}c=u.exchangeRateCreate,s=c.rate,l=c.targetFormat;v=u.maxAge;if(s){sessionStorage.setItem(f+"_rate",JSON.stringify(s));d={rate:s,targetFormat:l};return[2,{exchangeRate:d,maxAge:v}]}return[2,_]}}))}))};var b=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,o;return __generator(this,(function(u){switch(u.label){case 0:if(!n){return[2,null]}return[4,i("/api/zonos-elements/inclusive-prices/".concat(n))];case 1:e=u.sent(),t=e.errors,o=e.json;if(t.length||!o){a("Error fetching country inclusive price setting: ".concat((r=t.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,o||null]}}))}))};var z=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,o,u;var c=n.countryCode,s=n.localeTo,l=n.storeId;return __generator(this,(function(n){switch(n.label){case 0:e=new URLSearchParams;e.set("countryCode",c);e.set("storeId",l.toString());if(s){e.set("localeTo",s)}return[4,i("/api/zonos-elements/locale-messages?".concat(e.toString()))];case 1:t=n.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching exchange rate",(r=o.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,u.locale_countryCodesPage]}}))}))};var S=function(n){if(n&&/^[A-Z]{2}$/.test(n)){return n}return null};var C=n("g",(function(n){var r=new URLSearchParams(n||window.location.search);var e=function(n){var e=r.get(n);return S(e)};var t=e("zCountry");var o=e("country");var i=e("customerCountry");return t||o||i}));var L=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,a,u,c;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n=new URL(window.location.href);r=window.sessionStorage.getItem("zonos--country");e=C(n.searchParams)||r;t=new URLSearchParams;if(e){t.set("zCountry",e)}return[4,i("/api/zonos-elements/localization?".concat(t.toString()))];case 1:o=s.sent(),a=o.errors,u=o.json;if(a.length||!u){return[2,{country:null,locale:null}]}return[2,{country:u.country,locale:u.locale}];case 2:c=s.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var k=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,u,c;return __generator(this,(function(s){switch(s.label){case 0:if((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean)]}return[4,i("/api/zonos-elements/shipping-zones")];case 1:t=s.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching shipping zones: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}c=(e=u===null||u===void 0?void 0:u.shippingZones)===null||e===void 0?void 0:e.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean);return[2,c||null]}}))}))};var A=n("m",(function(n){var r=J.exchangeRate;if(!r||!n||isNaN(n)){return n}var e=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var t=n*r.rate;var o=t.toFixed(e);return Number(o)}));var E=function(n){var r=n.amount,e=n.currency,t=n.targetFormat;var o=e||J.targetCurrency;var i=(t===null||t===void 0?void 0:t.scale)||2;var a=window.navigator.userAgent.indexOf("MSIE ")!==-1;var u=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(a||!u){var c=Number(r).toFixed(i).replace(".","|dec|").replace(",",(t===null||t===void 0?void 0:t.thousandsDelimiter)||"").replace("|dec|",(t===null||t===void 0?void 0:t.decimalDelimiter)||"");return c}var s=new Intl.NumberFormat(window.navigator.language,{currency:o,currencyDisplay:"code",minimumFractionDigits:i,style:"currency"}).format(r);return s.replace(new RegExp("".concat(o,"\\s+")),"")};var I=n("d",(function(n){var r=n.amount,t=n.currency;if(isNaN(r)||r!==0&&!r){return""}var o=e.overrideCurrencyFormat;var i=J.exchangeRate;var a=t||J.targetCurrency;if(typeof o==="function"){return o({amount:r,currencyCode:a,numberFormat:function(n){var r=n.amount;return E({amount:r,currency:a,targetFormat:(i===null||i===void 0?void 0:i.targetFormat)||null})}})}var u=(i||{}).targetFormat;if(!u||!i){return"".concat(r.toFixed(2)," ").concat(a)}var c=u.scale||2;var s=window.navigator.userAgent.indexOf("MSIE ")!==-1;var l=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(s||!l){var v=Number(r).toFixed(c).replace(".","|dec|").replace(",",u.thousandsDelimiter||"").replace("|dec|",u.decimalDelimiter||"");var d="".concat(v).concat(u.currencyCode!=="USD"?" ".concat(u.currencyCode):"");return d}var f=(o===null||o===void 0?void 0:o.currencyDisplay)||"symbol";var y=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:f,minimumFractionDigits:c,style:"currency"}).format(r);var w=f==="code"?"".concat(y.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):y;return w}));var N=n("k",(function(n){var r=A(n);var e=I({amount:r});return e}));var x=n("i",(function(n){try{document.createDocumentFragment().querySelector(n)}catch(n){return false}return true}));var D=function(n){var r=n||".money";if(!x(r)){a('Currency element selector "'.concat(r,'" is not valid.'));return null}var e=document.querySelectorAll(r);if(!e.length){t('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(e)};var j=function(n){var r;var e=n.getAttribute("data-domestic");var t=n.getAttribute("data-zintl");var o=(r=n.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!o){return null}if(!e||n.textContent!==t&&t){n.setAttribute("data-domestic",o);return parseFloat(o)}return parseFloat(e)};var R=function(n){var r;var t=j(n);if(!t||isNaN(t)){return}var o=n.getAttribute("data-zintl");var i=parseFloat(n.getAttribute("data-zrate")||"1");var a=n.getAttribute("data-zcountry-code");var u=J.exchangeRate&&J.targetCurrency===J.exchangeRate.targetFormat.currencyCode;var c=((r=J.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(u&&(n.textContent!==o||c!==i||a!==J.selectedCountryCode)){var s=typeof e.currencyConverter==="function"&&e.currencyConverter({convert:A,convertAndFormat:N,currencyCode:J.targetCurrency,format:function(n){return I({amount:n})},originalAmount:t,selector:n});var l=s||N(t);if(l!==n.textContent){n.textContent=l}n.setAttribute("data-zrate",c.toString());n.setAttribute("data-zintl",l);n.setAttribute("data-zcountry-code",J.selectedCountryCode||"")}};var B=function(){var n=e.helloSettings.currencyElementSelector;var r=D(n);if(!(r===null||r===void 0?void 0:r.length)){return}if(!J.exchangeRate){a("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(n){R(n)}))};var U=n("j",(function(){if(e.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){return}B()}));var O=function(n){var r;var e=(r=J.shippingZoneCountries)===null||r===void 0?void 0:r[n];if(e){return e.currencyCode}return null};var P=n("h",(function(n){if(!n){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||e.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",n);var o="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,o)}}));var F=r({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricing:null,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),T=F.dispose,G=F.onChange,J=F.state;n({c:G,l:J});var K=function(n){return __awaiter(s,void 0,void 0,(function(){var r,t,o;return __generator(this,(function(i){switch(i.label){case 0:return[4,p({country:J.selectedCountryCode,isGuaranteed:n,sourceCurrency:e.sourceCurrency,targetCurrency:J.targetCurrency})];case 1:r=i.sent(),t=r.exchangeRate,o=r.maxAge;if(t){J.exchangeRate=t;U()}return[2,{maxAge:o}]}}))}))};var M="CA";var V=n("n",(function(n){if(J.selectedCountryCode&&n.includes(J.selectedCountryCode)){return J.selectedCountryCode}return M}));var Z=function(n){var r=n.isGuaranteed,e=n.maxAge;if(J.exchangeRateTimeout){clearTimeout(J.exchangeRateTimeout)}var t=5*60;var o=e||t;J.exchangeRateTimeout=setTimeout((function(){return __awaiter(s,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,K(r)];case 1:n=e.sent().maxAge;Z({isGuaranteed:r,maxAge:n});return[2]}}))}))}),o*1e3)};var $=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,o,i,a,u,c,s;return __generator(this,(function(l){switch(l.label){case 0:t("get new localization store");r=J.isDisabledCountry,o=J.isShippableCountry,i=J.selectedCountryCode;if(!!window.Zonos.isLegacyCheckout)return[3,3];a=J;return[4,g(J.selectedCountryCode)];case 1:a.countryLandedCost=l.sent();u=J;return[4,b(i)];case 2:u.inclusivePricing=((n=l.sent())===null||n===void 0?void 0:n.setting)||null;if(J.inclusivePricing){t("Inclusive price setting found for this country (".concat(i,") ").concat(JSON.stringify(J.inclusivePricing,null,2)))}return[3,4];case 3:t("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");l.label=4;case 4:if(e.helloSettings.currencyBehavior==="DISABLED"||!o||r||!i){return[2]}c=e.checkoutSettings.visibilityStatus==="ENABLED";return[4,K(c)];case 5:s=l.sent().maxAge;Z({isGuaranteed:c,maxAge:s});return[2]}}))}))};var q=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(o){switch(o.label){case 0:t("Getting custom messages for ".concat(J.selectedCountryCode));if(!J.selectedCountryCode||!e.storeId){return[2]}return[4,z({countryCode:J.selectedCountryCode,localeTo:J.selectedLocale,storeId:e.storeId})];case 1:n=o.sent();r=n.flatMap((function(n){var r;return{countryCode:J.selectedCountryCode,message:(r=n.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:n.pageName}}));J.customMessages=r;return[2]}}))}))};var H=function(){var n=new URL(window.location.href);var r=n.searchParams.get("zonosLocale");return r};var Y=function(){if(J.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var Q=function(n){if(n==="UK"){return"GB"}return n};var W=n("a",(function(n){var r,o;t("Updating selected country code to ".concat(n));var i=!J.selectedCountryCode;J.selectedCountryCode=Q(n);var a=J.selectedCountryCode,u=J.shippingZoneCountries;var c=!!u&&!!a&&!!u[a]&&!e.disabledCountries.includes(a);J.isShippableCountry=c;t("".concat(J.selectedCountryCode," is a shippable country: ").concat(J.isShippableCountry));var s=!!a&&e.disabledCountries.includes(a);J.isDisabledCountry=s;t("".concat(J.selectedCountryCode," is a disabled country: ").concat(J.isDisabledCountry));Y();if(!a){return}var l=O(a);if(!i){(r=e.onCountryChange)===null||r===void 0?void 0:r.call(e,{countryCode:a,currencyCode:l,isShippableCountry:c})}if(!l){return}J.targetCurrency=l;void $();window.sessionStorage.setItem("zonos--country",a);P(a);(o=document.querySelector("zonos-hello"))===null||o===void 0?void 0:o.setAttribute("z-country",a)}));var X=function(n){var r=e.helloSettings.showCountryList;var t=J.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){J.helloCountryList=t;return}if(r==="ALL"){J.helloCountryList=n;return}J.helloCountryList=r.reduce((function(r,e){var t;var o=n===null||n===void 0?void 0:n[e];return o?Object.assign(Object.assign({},r),(t={},t[e]=o,t)):r}),{})};var nn=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e;return __generator(this,(function(t){switch(t.label){case 0:if(!w.checkoutSessionId){return[2,null]}return[4,i("/api/zonos-elements/update-checkout-session-metadata",{body:{id:w.checkoutSessionId,metadata:[{key:"language",value:J.selectedLocale}]},method:"POST"})];case 1:n=t.sent(),r=n.errors,e=n.json;if(r.length||!e){a("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:e}]}return[2,{errors:[],json:e}]}}))}))};var rn=n("p",(function(n){J.selectedLocale=n;c(n);void nn();void q()}));var en=n("e",(function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,o,i,a,u,c,s;return __generator(this,(function(l){switch(l.label){case 0:return[4,Promise.all([h(),k(),L()])];case 1:n=l.sent(),r=n[0],e=n[1],o=n[2];i=e===null||e===void 0?void 0:e.reduce((function(n,e){var t;var o=r===null||r===void 0?void 0:r[e];return o?Object.assign(Object.assign({},n),(t={},t[e]=o,t)):n}),{});J.shippingZoneCountries=i||null;X(r||{});a=o.country,u=o.locale;t("Country code from localization: ".concat(a));t("Locale from localization: ".concat(u));W(a);c=H();rn(c||u||"en");s=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!J.selectedCountryCode&&s.some((function(n){return window.location.origin.includes(n)}))){W("CA")}J.localizationLoaded=true;return[2]}}))}))}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-9d863a3b.system.js","./p-062430f9.system.js","./p-5a2dd041.system.js","./p-62fa680d.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c;return{setters:[function(n){r=n.c;e=n.z},function(n){t=n.l;o=n.j;i=n.h;a=n.b},function(n){u=n.a},function(n){c=n.a}],execute:function(){var s=this;var l=function(n){var r=!!n.find((function(n){return n.testKey in u}));if(!r){t("No available test key found in response","info",{response:n})}return!!n.find((function(n){return n.testKey in u}))};var v=n("f",(function(n){if(!l(n)){return[]}return n.filter((function(n){var r;var e=u[n.testKey]&&!n.selectedVariantKey;var t=n.selectedVariantKey&&!!((r=u[n.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(n.selectedVariantKey));return e||t})).map((function(n){return Object.assign(Object.assign({},n),{expiresAt:n.expiresAt||Date.now()+d,selectedVariantKey:n.selectedVariantKey||null})}))}));var d=n("V",60*60*24*1e3);var f=r({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:o(localStorage.getItem("zonos--enabled-variant-test-keys"))}),y=f.onChange,w=f.state;n({o:y,s:w});y("enabledVariantTestKeys",(function(){var n;if(!((n=w.enabledVariantTestKeys)===null||n===void 0?void 0:n.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(w.enabledVariantTestKeys))}));y("checkoutSessionId",(function(){if(!w.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",w.checkoutSessionId)}));var m=n("b",(function(n){w.enabledVariantTestKeys=v(n)}));var h=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,i("/api/zonos-elements/get-countries",{method:"GET"})];case 1:n=o.sent(),r=n.errors,e=n.json;if(r.length||!e){return[2,null]}return[2,e];case 2:t=o.sent();return[2,null];case 3:return[2]}}))}))};var g=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,o,u;return __generator(this,(function(c){switch(c.label){case 0:if(!n){return[2,null]}e="/api/zonos-elements/country-landed-cost/".concat(n);return[4,i(e)];case 1:t=c.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,u||null]}}))}))};var _={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var p=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,o,u,c,s,l,v,d;var f=n.country,y=n.isGuaranteed,w=n.sourceCurrency,m=n.targetCurrency;return __generator(this,(function(n){switch(n.label){case 0:if(w===m&&!y){return[2,_]}e=new URLSearchParams;e.set("sourceCurrency",w);e.set("targetCurrency",m);e.set("isGuaranteed",String(y));e.set("country",f||"");return[4,i("/api/zonos-elements/exchange-rates?".concat(e.toString()))];case 1:t=n.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,_]}c=u.exchangeRateCreate,s=c.rate,l=c.targetFormat;v=u.maxAge;if(s){sessionStorage.setItem(f+"_rate",JSON.stringify(s));d={rate:s,targetFormat:l};return[2,{exchangeRate:d,maxAge:v}]}return[2,_]}}))}))};var b=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,o;return __generator(this,(function(u){switch(u.label){case 0:if(!n){return[2,null]}return[4,i("/api/zonos-elements/inclusive-prices/".concat(n))];case 1:e=u.sent(),t=e.errors,o=e.json;if(t.length||!o){a("Error fetching country inclusive price setting: ".concat((r=t.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,o||null]}}))}))};var z=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,o,u;var c=n.countryCode,s=n.localeTo,l=n.storeId;return __generator(this,(function(n){switch(n.label){case 0:e=new URLSearchParams;e.set("countryCode",c);e.set("storeId",l.toString());if(s){e.set("localeTo",s)}return[4,i("/api/zonos-elements/locale-messages?".concat(e.toString()))];case 1:t=n.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching exchange rate",(r=o.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,u.locale_countryCodesPage]}}))}))};var S=function(n){if(n&&/^[A-Z]{2}$/.test(n)){return n}return null};var C=n("g",(function(n){var r=new URLSearchParams(n||window.location.search);var e=function(n){var e=r.get(n);return S(e)};var t=e("zCountry");var o=e("country");var i=e("customerCountry");return t||o||i}));var L=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,a,u,c;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);n=new URL(window.location.href);r=window.sessionStorage.getItem("zonos--country");e=C(n.searchParams)||r;t=new URLSearchParams;if(e){t.set("zCountry",e)}return[4,i("/api/zonos-elements/localization?".concat(t.toString()))];case 1:o=s.sent(),a=o.errors,u=o.json;if(a.length||!u){return[2,{country:null,locale:null}]}return[2,{country:u.country,locale:u.locale}];case 2:c=s.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var k=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,u,c;return __generator(this,(function(s){switch(s.label){case 0:if((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean)]}return[4,i("/api/zonos-elements/shipping-zones")];case 1:t=s.sent(),o=t.errors,u=t.json;if(o.length||!u){a("Error fetching shipping zones: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}c=(e=u===null||u===void 0?void 0:u.shippingZones)===null||e===void 0?void 0:e.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean);return[2,c||null]}}))}))};var A=n("m",(function(n){var r=J.exchangeRate;if(!r||!n||isNaN(n)){return n}var e=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var t=n*r.rate;var o=t.toFixed(e);return Number(o)}));var E=function(n){var r=n.amount,e=n.currency,t=n.targetFormat;var o=e||J.targetCurrency;var i=(t===null||t===void 0?void 0:t.scale)||2;var a=window.navigator.userAgent.indexOf("MSIE ")!==-1;var u=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(a||!u){var c=Number(r).toFixed(i).replace(".","|dec|").replace(",",(t===null||t===void 0?void 0:t.thousandsDelimiter)||"").replace("|dec|",(t===null||t===void 0?void 0:t.decimalDelimiter)||"");return c}var s=new Intl.NumberFormat(window.navigator.language,{currency:o,currencyDisplay:"code",minimumFractionDigits:i,style:"currency"}).format(r);return s.replace(new RegExp("".concat(o,"\\s+")),"")};var I=n("d",(function(n){var r=n.amount,t=n.currency;if(isNaN(r)||r!==0&&!r){return""}var o=e.overrideCurrencyFormat;var i=J.exchangeRate;var a=t||J.targetCurrency;if(typeof o==="function"){return o({amount:r,currencyCode:a,numberFormat:function(n){var r=n.amount;return E({amount:r,currency:a,targetFormat:(i===null||i===void 0?void 0:i.targetFormat)||null})}})}var u=(i||{}).targetFormat;if(!u||!i){return"".concat(r.toFixed(2)," ").concat(a)}var c=u.scale||2;var s=window.navigator.userAgent.indexOf("MSIE ")!==-1;var l=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(s||!l){var v=Number(r).toFixed(c).replace(".","|dec|").replace(",",u.thousandsDelimiter||"").replace("|dec|",u.decimalDelimiter||"");var d="".concat(v).concat(u.currencyCode!=="USD"?" ".concat(u.currencyCode):"");return d}var f=(o===null||o===void 0?void 0:o.currencyDisplay)||"symbol";var y=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:f,minimumFractionDigits:c,style:"currency"}).format(r);var w=f==="code"?"".concat(y.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):y;return w}));var N=n("k",(function(n){var r=A(n);var e=I({amount:r});return e}));var x=n("i",(function(n){try{document.createDocumentFragment().querySelector(n)}catch(n){return false}return true}));var D=function(n){var r=n||".money";if(!x(r)){a('Currency element selector "'.concat(r,'" is not valid.'));return null}var e=document.querySelectorAll(r);if(!e.length){t('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(e)};var j=function(n){var r;var e=n.getAttribute("data-domestic");var t=n.getAttribute("data-zintl");var o=(r=n.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!o){return null}if(!e||n.textContent!==t&&t){n.setAttribute("data-domestic",o);return parseFloat(o)}return parseFloat(e)};var R=function(n){var r;var t=j(n);if(!t||isNaN(t)){return}var o=n.getAttribute("data-zintl");var i=parseFloat(n.getAttribute("data-zrate")||"1");var a=n.getAttribute("data-zcountry-code");var u=J.exchangeRate&&J.targetCurrency===J.exchangeRate.targetFormat.currencyCode;var c=((r=J.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(u&&(n.textContent!==o||c!==i||a!==J.selectedCountryCode)){var s=typeof e.currencyConverter==="function"&&e.currencyConverter({convert:A,convertAndFormat:N,currencyCode:J.targetCurrency,format:function(n){return I({amount:n})},originalAmount:t,selector:n});var l=s||N(t);if(l!==n.textContent){n.textContent=l}n.setAttribute("data-zrate",c.toString());n.setAttribute("data-zintl",l);n.setAttribute("data-zcountry-code",J.selectedCountryCode||"")}};var B=function(){var n=e.helloSettings.currencyElementSelector;var r=D(n);if(!(r===null||r===void 0?void 0:r.length)){return}if(!J.exchangeRate){a("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(n){R(n)}))};var U=n("j",(function(){if(e.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){return}B()}));var O=function(n){var r;var e=(r=J.shippingZoneCountries)===null||r===void 0?void 0:r[n];if(e){return e.currencyCode}return null};var P=n("h",(function(n){if(!n){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||e.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",n);var o="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,o)}}));var F=r({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricing:null,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),T=F.dispose,G=F.onChange,J=F.state;n({c:G,l:J});var K=function(n){return __awaiter(s,void 0,void 0,(function(){var r,t,o;return __generator(this,(function(i){switch(i.label){case 0:return[4,p({country:J.selectedCountryCode,isGuaranteed:n,sourceCurrency:e.sourceCurrency,targetCurrency:J.targetCurrency})];case 1:r=i.sent(),t=r.exchangeRate,o=r.maxAge;if(t){J.exchangeRate=t;U()}return[2,{maxAge:o}]}}))}))};var M="CA";var V=n("n",(function(n){if(J.selectedCountryCode&&n.includes(J.selectedCountryCode)){return J.selectedCountryCode}return M}));var Z=function(n){var r=n.isGuaranteed,e=n.maxAge;if(J.exchangeRateTimeout){clearTimeout(J.exchangeRateTimeout)}var t=5*60;var o=e||t;J.exchangeRateTimeout=setTimeout((function(){return __awaiter(s,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,K(r)];case 1:n=e.sent().maxAge;Z({isGuaranteed:r,maxAge:n});return[2]}}))}))}),o*1e3)};var $=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,o,i,a,u,c,s;return __generator(this,(function(l){switch(l.label){case 0:t("get new localization store");r=J.isDisabledCountry,o=J.isShippableCountry,i=J.selectedCountryCode;if(!!window.Zonos.isLegacyCheckout)return[3,3];a=J;return[4,g(J.selectedCountryCode)];case 1:a.countryLandedCost=l.sent();u=J;return[4,b(i)];case 2:u.inclusivePricing=((n=l.sent())===null||n===void 0?void 0:n.setting)||null;if(J.inclusivePricing){t("Inclusive price setting found for this country (".concat(i,") ").concat(JSON.stringify(J.inclusivePricing,null,2)))}return[3,4];case 3:t("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");l.label=4;case 4:if(e.helloSettings.currencyBehavior==="DISABLED"||!o||r||!i){return[2]}c=e.checkoutSettings.visibilityStatus==="ENABLED";return[4,K(c)];case 5:s=l.sent().maxAge;Z({isGuaranteed:c,maxAge:s});return[2]}}))}))};var q=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(o){switch(o.label){case 0:t("Getting custom messages for ".concat(J.selectedCountryCode));if(!J.selectedCountryCode||!e.storeId){return[2]}return[4,z({countryCode:J.selectedCountryCode,localeTo:J.selectedLocale,storeId:e.storeId})];case 1:n=o.sent();r=n.flatMap((function(n){var r;return{countryCode:J.selectedCountryCode,message:(r=n.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:n.pageName}}));J.customMessages=r;return[2]}}))}))};var H=function(){var n=new URL(window.location.href);var r=n.searchParams.get("zonosLocale");return r};var Y=function(){if(J.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var Q=function(n){if(n==="UK"){return"GB"}return n};var W=n("a",(function(n){var r,o;t("Updating selected country code to ".concat(n));var i=!J.selectedCountryCode;J.selectedCountryCode=Q(n);var a=J.selectedCountryCode,u=J.shippingZoneCountries;var c=!!u&&!!a&&!!u[a]&&!e.disabledCountries.includes(a);J.isShippableCountry=c;t("".concat(J.selectedCountryCode," is a shippable country: ").concat(J.isShippableCountry));var s=!!a&&e.disabledCountries.includes(a);J.isDisabledCountry=s;t("".concat(J.selectedCountryCode," is a disabled country: ").concat(J.isDisabledCountry));Y();if(!a){return}var l=O(a);if(!i){(r=e.onCountryChange)===null||r===void 0?void 0:r.call(e,{countryCode:a,currencyCode:l,isShippableCountry:c})}if(!l){return}J.targetCurrency=l;void $();window.sessionStorage.setItem("zonos--country",a);P(a);(o=document.querySelector("zonos-hello"))===null||o===void 0?void 0:o.setAttribute("z-country",a)}));var X=function(n){var r=e.helloSettings.showCountryList;var t=J.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){J.helloCountryList=t;return}if(r==="ALL"){J.helloCountryList=n;return}J.helloCountryList=r.reduce((function(r,e){var t;var o=n===null||n===void 0?void 0:n[e];return o?Object.assign(Object.assign({},r),(t={},t[e]=o,t)):r}),{})};var nn=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e;return __generator(this,(function(t){switch(t.label){case 0:if(!w.checkoutSessionId){return[2,null]}return[4,i("/api/zonos-elements/update-checkout-session-metadata",{body:{id:w.checkoutSessionId,metadata:[{key:"language",value:J.selectedLocale}]},method:"POST"})];case 1:n=t.sent(),r=n.errors,e=n.json;if(r.length||!e){a("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:e}]}return[2,{errors:[],json:e}]}}))}))};var rn=n("p",(function(n){J.selectedLocale=n;c(n);void nn();void q()}));var en=n("e",(function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,o,i,a,u,c,s;return __generator(this,(function(l){switch(l.label){case 0:return[4,Promise.all([h(),k(),L()])];case 1:n=l.sent(),r=n[0],e=n[1],o=n[2];i=e===null||e===void 0?void 0:e.reduce((function(n,e){var t;var o=r===null||r===void 0?void 0:r[e];return o?Object.assign(Object.assign({},n),(t={},t[e]=o,t)):n}),{});J.shippingZoneCountries=i||null;X(r||{});a=o.country,u=o.locale;t("Country code from localization: ".concat(a));t("Locale from localization: ".concat(u));W(a);c=H();rn(c||u||"en");s=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!J.selectedCountryCode&&s.some((function(n){return window.location.origin.includes(n)}))){W("CA")}J.localizationLoaded=true;return[2]}}))}))}))}}}));
@@ -1 +1 @@
1
- import{r as o,h as s,H as t,a}from"./p-b30c2ad9.js";import{l as i}from"./p-40a4266f.js";import{f as n}from"./p-7ce093aa.js";import{c as e}from"./p-b4b7f705.js";import"./p-a8a312b2.js";import"./p-04a01cb1.js";import"./p-27d9abab.js";const h=class{constructor(s){o(this,s),this.countryCode=i.selectedCountryCode}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,a=n();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":a,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":a}},s("div",{class:e(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return a(this)}};h.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{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
1
+ import{r as o,h as s,H as t,a}from"./p-b30c2ad9.js";import{l as i}from"./p-4a3abbf2.js";import{f as n}from"./p-7ce093aa.js";import{c as e}from"./p-b4b7f705.js";import"./p-a8a312b2.js";import"./p-04a01cb1.js";import"./p-0c0fda23.js";const h=class{constructor(s){o(this,s),this.countryCode=i.selectedCountryCode}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,a=n();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":a,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":a}},s("div",{class:e(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return a(this)}};h.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{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
@@ -0,0 +1 @@
1
+ import{r as o,h as s,H as e,F as c}from"./p-b30c2ad9.js";import{c as t,i as l,d as n,e as i,o as a,f as r,k as z,l as d,u as h,w as m,A as p,y as u,g}from"./p-b76db2ac.js";import{i as b,a as f,c as x,b as w,d as v,e as y,r as k}from"./p-4dcbbd60.js";import{p as C,a as S}from"./p-7b56e345.js";import{s as I,c as j,d as L,l as O}from"./p-4a3abbf2.js";import{t as T}from"./p-0c0fda23.js";import{z as U}from"./p-7ce093aa.js";import{b as E}from"./p-29c80a34.js";import{h as P,l as A,s as N,b as _,g as D}from"./p-a8a312b2.js";import{c as B}from"./p-b4b7f705.js";import{l as F}from"./p-97aceb11.js";import"./p-56e0ed65.js";import"./p-2b9c124d.js";import"./p-04a01cb1.js";const H=class{constructor(s){o(this,s),this.storeUnsubscribeList=[],this.onChangeLocaleListener=()=>{},this.mobile=!1,this.tablet=!1,this.stripe=window.Zonos.stripe,this.showLanguageDialogMobile=!1,this.submitLoading=!1,this.collapseReview=!0,this.isMobile=!1,this.isTablet=!1,this.isOverlayLoading=!0,this.isCartCollected=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.confirmationId=null,this.clientSecret=t.clientSecret,this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret,this.getBaseCurrencySettlementInfo=()=>{const o=i.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:s}}=o;return s?{settlementAmount:(s.discounts||0)+s.items+s.landedCostTotal+s.shipping}:null},this.applyStripeTheme=async()=>{const o=U.appearance.theme;await l({overrideTheme:this.isMobile?o:void 0,paypalEnabled:C()})},this.fetchCheckoutSession=async o=>{const{json:s}=await P("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"});return s},this.checkStripePaymentIntentStatus=async()=>{var o;const s=!!window.Zonos.cartData,e=new URL(window.location.href).searchParams,c=e.get("payment_intent_client_secret"),l=e.get("zonosCheckoutSessionId");if(A("Payment intent exist, checking stripe payment intent status"),!c)return A("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:s};const{error:i,status:a}=await n({clientSecret:c});if(new URLSearchParams(window.location.search).get("redirect_status")&&l){A(i?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen");const s=await this.fetchCheckoutSession(l);return this.confirmationId=(null===(o=null==s?void 0:s.checkoutSession.landedCost)||void 0===o?void 0:o.shortId)||null,I.checkoutSessionId=l,t.clientSecret=c,this.setToFinishStep(a),{shouldAllowOrder:!1}}return s?(A("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(A("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})}}resizeListener(){this.isMobile=b(this.mobile),this.isTablet=f(this.tablet)}async setToFinishStep(o){t.stripe=window.Zonos.stripe,i.step="finish",this.storybookPaymentStatusOverride=o,this.isOverlayLoading=!1}async initCollectCart(){var o,s,e,c,t,l,h,m,p,u,g;if(!window.Zonos.cartData)return;const b=null===(s=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.items[0])||void 0===s?void 0:s.currencyCode;b&&(i.currency=b);const f=null===(c=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.references)||void 0===c?void 0:c.checkoutSessionId,v=null===(l=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.references)||void 0===l?void 0:l.landedCostId;if(!v)return void a({messages:[T("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:U.organizationName})],title:T("Invalid session")});f?(A("Setting checkout session id from cart reference","info",f),I.checkoutSessionId=f):(A("Clear checkout session id from storage so we start from a fresh session for the collect cart"),I.checkoutSessionId=null);const{shouldAllowOrder:y}=await this.checkStripePaymentIntentStatus();if(y){try{const{adjustments:o,cartItems:s}=E(window.Zonos.cartData);if(await r({adjustments:o,cartItems:s,landedCostId:v,shouldInitSessionOnFailure:!1}),!I.checkoutSessionId&&!f){const o=await z();if(A(`stripeStoreInitCheckoutSession: ${o}`),!o)throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Collect quote but being used with sandbox credential")}if((!i.checkoutSession||(null===(h=i.checkoutSession)||void 0===h?void 0:h.completedAt))&&f){const o=await this.fetchCheckoutSession(f);if(this.confirmationId=(null===(m=null==o?void 0:o.checkoutSession.landedCost)||void 0===m?void 0:m.shortId)||null,null==o?void 0:o.checkoutSession.completedAt)return void this.setToFinishStep("succeeded");if(null==o?void 0:o.checkoutSession.clientSecret){const{status:s}=await n({clientSecret:o.checkoutSession.clientSecret});if("processing"===s||"succeeded"===s)return void this.setToFinishStep(s)}throw N({endpoint:"INVALID_COLLECT_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:f,cartId:null===(p=window.Zonos.cartData)||void 0===p?void 0:p.id,cartLandedCostId:v}}),new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it")}if(!i.checkoutSession)throw N({endpoint:"FAIL_TO_UPDATE_CREATE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this collect cart"],metadata:{cartCheckoutSessionId:f||"N/A",cartId:null===(u=window.Zonos.cartData)||void 0===u?void 0:u.id,cartLandedCostId:v||"N/A"}}),new Error("Could not update/create checkout session for this collect cart");d();const e=null===(g=i.checkoutSession)||void 0===g?void 0:g.landedCost;if(!e)throw new Error("Landed cost could not be found in checkout session after creating/updating them");await x(Object.assign(Object.assign({},i.checkoutSession),{id:I.checkoutSessionId||""})),w({landedCostId:e.id}),this.applyStripeTheme()}catch(o){_(o),a({messages:[T("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:U.organizationName})],title:T("Invalid session")})}this.isOverlayLoading=!1}}toggleLanguageDialog(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile}async handleStripePaymentContinue(){var o,s,e,c;if(null===(o=t.stripeBillingAddressElement)||void 0===o||o.getValue(),null===(s=t.stripeLinkEventData)||void 0===s?void 0:s.complete)if(null===(e=t.stripeBillingAddressEventData)||void 0===e?void 0:e.complete)if("USD"!==t.checkoutSettlementCurrency||!t.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,S.paypalErrorMessage=null,t.hasPaymentError=!1,this.submitLoading=!0,i.inventoryCheckErrorMessage=null,!await h())return t.hasPaymentError=!0,t.customErrorMessage=T("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:t.checkoutSettlementCurrency}),void(this.submitLoading=!1);await v();try{return await m({noLandedCostCheck:!0}),i.step="finish",void(this.confirmationId=y.landedCostShortId||(null===(c=i.selectedLandedCost)||void 0===c?void 0:c.landedCostId)||null)}catch(o){_(o),t.hasPaymentError=!0}this.submitLoading=!1}else this.payInUsdConfirmDialogOpen=!0;else{const o=document.querySelector(".zonos--billing-address");null==o||o.scrollIntoView({behavior:"smooth"})}else{const o=document.querySelector("zonos-link-authentication");null==o||o.scrollIntoView({behavior:"smooth"})}}componentWillLoad(){t.stripe=window.Zonos.stripe,i.step="payment",this.initCollectCart(),this.resizeListener(),this.storeUnsubscribeList=[p("clientSecret",(()=>{this.applyStripeTheme()})),j("selectedLocale",(()=>{this.applyStripeTheme()}))],A(`mobile: ${this.isMobile}`)}disconnectedCallback(){u(),g(),this.onChangeLocaleListener(),this.storeUnsubscribeList.forEach((o=>o()))}render(){this.clientSecret=t.clientSecret,t.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret);const o=this.getBaseCurrencySettlementInfo(),{logoUrl:l,theme:n}=U.appearance,a=()=>{const o=`${l}?timestamp=${Date.now()}`;return s("div",{class:"zonos--logo"},o&&s("img",{alt:`${U.organizationName} logo`,src:o}))},r=D(),z=()=>{var o;const e=new URLSearchParams(window.location.search),t=e.get("zonosQaUrl"),l=e.get("zonosDebug"),n=null===(o=F.find((o=>o.code===O.selectedLocale)))||void 0===o?void 0:o.label;return s(c,null,s("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},s("div",{class:"zonos--logo-wrapper"},a(),r&&s("zonos-badge",{badgeColor:"orange",size:"small"},T("Test mode")),"1"===l&&s("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&s("zonos-badge",{badgeColor:"purple",size:"small"},t)),s("div",{class:"zonos--header-right"},s("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:()=>this.toggleLanguageDialog(),variant:"outline"},n,s("zonos-icon",{"aria-label":"Language select",content:'<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',iconColor:"gray-1200"})),s("div",{class:B(["zonos--collect-language-dialog",this.showLanguageDialogMobile&&"zonos--collect-language-dialog-open"])},s("zonos-language-select",{handleOnClose:()=>this.toggleLanguageDialog()})))),k({content:s("zonos-text",{class:"zonos--header-title",type:"header"},y.originCompanyName?T("Customs charges for your recent purchase from [companyName] are available for payment",{companyName:y.originCompanyName}):T("Customs charges from your recent purchase are available for payment")),isLoading:y.isFetchingShippingInfo,skeletonHeight:"34px",skeletonWidth:"600px"}))};return s(e,{class:B(["zonos--collect zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":n},(()=>this.isOverlayLoading||t.isFetchingSession?null:s("div",{class:"zonos--content"},"finish"!==i.step&&"error"!==i.step&&s(c,null,(this.isMobile||this.isTablet)&&z(),s("div",{class:"zonos--left","data-theme":n},!this.isMobile&&!this.isTablet&&z(),s("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},T("Billing info")),s("zonos-v-stack",{spacing:16},s("zonos-link-authentication",{titleText:""}),s("zonos-address",{titleText:"",type:"billing"})),s("zonos-collect-payment",{class:B(["zonos--collect-container"]),continueLoading:this.submitLoading,onContinueClicked:async()=>{await this.handleStripePaymentContinue()}})),s("div",{class:"zonos--right","data-theme":n},s("zonos-collect-review",{mobile:this.isMobile,tablet:this.isTablet}),s("div",{class:"zonos--order-details-container"},s("zonos-collect-order-details",{collapsed:this.collapseReview,mobile:this.isMobile,onCollapseClicked:()=>{this.collapseReview=!this.collapseReview}})),s("div",{class:"flex--wrapper"},s("zonos-v-stack",{spacing:16},s("zonos-collect-subtotal",null)),!this.isMobile&&!this.isTablet&&s("zonos-collect-footer",{"data-theme":n,mobile:this.isMobile,tablet:this.isTablet})))),("finish"===i.step||"error"===i.step)&&s("div",{class:"zonos--done","data-theme":n},s("div",{class:"zonos--header"},a()),s("zonos-collect-finish",{confirmationId:this.confirmationId,overrideNotification:"error"===i.step&&i.error?Object.assign(Object.assign({},i.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),(this.isMobile||this.isTablet||"finish"===i.step||"error"===i.step)&&s("zonos-collect-footer",{"data-theme":n,mobile:this.isMobile,tablet:this.isTablet})))(),o&&s("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:T("Cancel"),dialogConfirmBtnText:T("Pay [orderTotal]",{orderTotal:L({amount:o.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:T("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:T("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),s("zonos-loading-overlay",{open:this.isOverlayLoading}))}static get assetsDirs(){return["assets"]}};H.style=".sc-zonos-collect-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-collect-h *.sc-zonos-collect{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-collect-h img.sc-zonos-collect{max-width:100%}.sc-zonos-collect-h dl.sc-zonos-collect,.sc-zonos-collect-h dd.sc-zonos-collect,.sc-zonos-collect-h h1.sc-zonos-collect,.sc-zonos-collect-h h2.sc-zonos-collect,.sc-zonos-collect-h h3.sc-zonos-collect,.sc-zonos-collect-h h4.sc-zonos-collect,.sc-zonos-collect-h h5.sc-zonos-collect,.sc-zonos-collect-h h6.sc-zonos-collect,.sc-zonos-collect-h hr.sc-zonos-collect,.sc-zonos-collect-h figure.sc-zonos-collect,.sc-zonos-collect-h p.sc-zonos-collect,.sc-zonos-collect-h pre.sc-zonos-collect{margin:0}.sc-zonos-collect-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-collect-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-collect-h *.sc-zonos-collect{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-collect-h *.sc-zonos-collect::-webkit-scrollbar{width:10px}.sc-zonos-collect-h *.sc-zonos-collect::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-collect-h *.sc-zonos-collect::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-collect-h *.sc-zonos-collect::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-collect-h .zonos--content.sc-zonos-collect{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{background-color:var(--zonos-elements-gray-0)}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect .zonos--header.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect .zonos--logo.sc-zonos-collect{margin-bottom:0}.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect zonos-checkout-finish.sc-zonos-collect{-ms-flex:1;flex:1}.sc-zonos-collect-h .zonos--header-title.sc-zonos-collect,.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect{max-width:800px}.sc-zonos-collect-h .zonos--left.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-collect-h .zonos--left.sc-zonos-collect .zonos--wrapper.sc-zonos-collect{padding:0 8px 8px}.sc-zonos-collect-h .zonos--left.sc-zonos-collect .zonos--payment-error-banner.sc-zonos-collect{margin-top:24px}.sc-zonos-collect-h .zonos--right.sc-zonos-collect{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-collect-h .zonos--right.sc-zonos-collect .zonos--order-details-container.sc-zonos-collect{overflow:hidden}.sc-zonos-collect-h .zonos--wrapper.sc-zonos-collect{overflow:auto;max-height:100%;position:relative}.sc-zonos-collect-h .flex--wrapper.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%;margin-top:32px}.sc-zonos-collect-h .zonos--logo-wrapper.sc-zonos-collect{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-collect-h .zonos--logo-wrapper.sc-zonos-collect>*.sc-zonos-collect{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-collect-h .zonos--header-right.sc-zonos-collect{display:none}.sc-zonos-collect-h .zonos--logo.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-collect-h .zonos--logo.sc-zonos-collect img.sc-zonos-collect{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-collect-h .zonos--collect-container.sc-zonos-collect{overflow:visible}.mobile.sc-zonos-collect-h,.tablet.sc-zonos-collect-h{min-width:auto}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{padding-bottom:0}}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--wrapper.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--wrapper.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--review.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--review.sc-zonos-collect{margin-bottom:0}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--cart-items.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect .zonos--cart-items.sc-zonos-collect{margin-top:8px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect zonos-checkout-footer.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect zonos-checkout-footer.sc-zonos-collect{-ms-flex-order:3;order:3}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--wrapper.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--wrapper.sc-zonos-collect{max-height:100%}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--footer.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--footer.sc-zonos-collect{-ms-flex-order:3;order:3}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--done.sc-zonos-collect{width:auto}.mobile.sc-zonos-collect-h .zonos--cart-subtotal.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--cart-subtotal.sc-zonos-collect{margin:0}.mobile.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-collect-h .zonos--header-title.sc-zonos-collect,.mobile.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--header-title.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect{max-width:800px;padding:0 16px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--left.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{overflow:visible;width:100%}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect,.tablet.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--right.sc-zonos-collect{gap:32px}.mobile.sc-zonos-collect-h .flex--wrapper.sc-zonos-collect,.tablet.sc-zonos-collect-h .flex--wrapper.sc-zonos-collect{margin-top:0}.mobile.sc-zonos-collect-h zonos-collect-footer.sc-zonos-collect,.tablet.sc-zonos-collect-h zonos-collect-footer.sc-zonos-collect{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect{padding-top:56px;top:-56px}.mobile.sc-zonos-collect-h .zonos--content.sc-zonos-collect .zonos--header-right.sc-zonos-collect{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-collect-h .zonos--header-wrapper.sc-zonos-collect{padding-top:28px;top:-28px}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect::-webkit-scrollbar{width:10px}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.sc-zonos-collect::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-collect-h .zonos--collect-language-dialog.zonos--collect-language-dialog-open.sc-zonos-collect{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-collect-h .zonos--content.sc-zonos-collect{-ms-scroll-chaining:chained;overscroll-behavior:auto}";export{H as zonos_collect}
@@ -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 a(e){try{d(r.next(e))}catch(e){i(e)}}function s(e){try{d(r["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):o(e.value).then(a,s)}d((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,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(n){return d([e,n])}}function d(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(r=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:t.label++;return{value:s[1],done:false};case 5:t.label++;o=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];o=0}finally{r=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,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-9d863a3b.system.js","./p-d3485a03.system.js","./p-2813d72e.system.js","./p-062430f9.system.js","./p-e7f8595f.system.js","./p-e63b8b24.system.js"],(function(e){"use strict";var n,t,r,o,i,a,s,d,u,l,c,v,f,m,p,h,w,g;return{setters:[function(e){n=e.z;t=e.c},function(e){r=e.s;o=e.l;i=e.f;a=e.b},function(e){s=e.t},function(e){d=e.l;u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;m=e.d;p=e.b;h=e.j},function(e){w=e.i},function(e){g=e.g}],execute:function(){var y=this;var b=e("J",(function(e){var n=e.firstName,t=e.lastName,r=e.name;var o;if(!r&&!n&&!t){return{firstName:"",lastName:""}}var i=(r===null||r===void 0?void 0:r.split(/\s+/))||[];var a=(n===null||n===void 0?void 0:n.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(t===null||t===void 0?void 0:t.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var _=function(e){var n=e.currentAddress,t=e.translatedAddress;var r,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,m=u.postal_code,p=u.state;var h=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((r=t.city)===null||r===void 0?void 0:r[l])||l,country:c,line1:((o=t.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=t.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=t.name)===null||a===void 0?void 0:a[h])||h,phone:n.value.phone||"",postal_code:((s=t.postal_code)===null||s===void 0?void 0:s[m])||m,state:((d=t.state)===null||d===void 0?void 0:d[p])||p}};var S=function(e){var n;var t=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=F.stripeLinkEventData;var i=F.stripeAddressEventData;var a=F.stripeShippingSameAsBilling?F.stripeAddressEventData:F.stripeBillingAddressEventData;if(!i||!a){throw new Error("Missing stripe address data")}var s=_({currentAddress:i,translatedAddress:F.translatedAddress.address});var d=b({name:s.name}),u=d.firstName,l=d.lastName;var c=_({currentAddress:a,translatedAddress:F.translatedAddress.address});var v=b({name:c.name}),f=v.firstName,m=v.lastName;return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:f,lastName:m,phone:c.phone},cartCurrencyCode:(n=Se.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:F.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:u,lastName:l,phone:s.phone},isTest:!!t,landedCostAdjustments:Se.promoCode?[{amount:0,productId:null,promoCode:Se.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:F.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};var O=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=F.stripeLinkEventData;var t=F.stripeAddressEventData;var o=F.stripeShippingSameAsBilling?F.stripeAddressEventData:F.stripeBillingAddressEventData;d({stripeAddressData:t,stripeBillingAddressData:o},"info");if(!t||!o){throw new Error("Missing stripe address data")}var i=_({currentAddress:t,translatedAddress:F.translatedAddress.address});var a=b({name:i.name}),s=a.firstName,u=a.lastName;var l=_({currentAddress:o,translatedAddress:F.translatedAddress.address});var c=b({name:l.name}),v=c.firstName,f=c.lastName;var m=Se.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var p=Se.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Se.promoCode,sku:null,type:"PROMO_CODE"}],m,true):m;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:r.checkoutSessionId||"",contact:{companyName:F.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Se.items,landedCostAdjustments:p,shipToTaxId:F.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var C=function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=O();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:u["vercel"]})];case 1:s=f.sent();if(!s||!((n=s.checkoutSessionWorkflow)===null||n===void 0?void 0:n.length)&&((t=s.errors)===null||t===void 0?void 0:t.length)){throw new Error("Failed to build landed cost: ".concat(((o=(r=s===null||s===void 0?void 0:s.errors)===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,l("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=f.sent(),c=d.errors,v=d.json;if(!v||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var k=function(e){return __awaiter(y,void 0,void 0,(function(){var t,r,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:r=n.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,C(r)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:O(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=u.sent(),a=i.errors,s=i.json;if(a.length||!s){d=((t=a[0])===null||t===void 0?void 0:t.message)==="The user aborted a request.";if(d){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 A=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:S(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){u=typeof((n=s[0])===null||n===void 0?void 0:n.message)==="string"&&(((t=s[0])===null||t===void 0?void 0:t.message)==="The user aborted a request."||((r=s[0])===null||r===void 0?void 0:r.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")));c=u?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(c)}return[2,d]}}))}))};var I=undefined&&undefined.__rest||function(e,n){var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0)t[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++){if(n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o]))t[r[o]]=e[r[o]]}return t};var T=function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,k(e)];case 1:t=a.sent();return[2,t];case 2:return[4,A({abortController:e,cartId:n})];case 3:r=a.sent(),o=r.cartWorkflow,i=I(r,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var E=e("t",(function(e){return __awaiter(y,[e],void 0,(function(e){var t,r,i,a,s,d,u,p,h;var w=e.checkoutSessionId,g=e.eventName,y=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:i=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;p=n.organizationId;if(!w){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:m,checkoutSessionId:w,eventName:g,metadata:y,organizationId:p,trackEventLogs:a}});return[2]}if(!p){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:m,checkoutSessionId:w,eventName:g,metadata:y,organizationId:p,trackEventLogs:a}})}h={checkoutSessionId:w,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:p};return[4,l("/api/zonos-elements/track-conversion-event",{body:h,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var N=function(e){var n=e.address,t=e.invalidAdddressList;if(!n){return}if(!t){return}var r={};if(t.city){r.city=n.city}if(t.line1){r.line1=n.line1}if(t.line2){r.line2=n.line2}if(t.postal_code){r.postal_code=n.postal_code}if(t.state){r.state=n.state}if(t.name){r.name=n.name}return Object.keys(r).length?r:undefined};var j=function(e){var n=e.addressInvalidCharactersList,t=e.billingAddressInvalidCharactersList,r=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(r===null||r===void 0?void 0:r.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!n&&!t){return null}var d=r.value;var u=(o===null||o===void 0?void 0:o.value)||null;var l=b({firstName:d.firstName,lastName:d.lastName,name:d.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var m=b({firstName:u===null||u===void 0?void 0:u.firstName,lastName:u===null||u===void 0?void 0:u.lastName,name:(u===null||u===void 0?void 0:u.name)||""}),p=m.firstName,h=m.lastName;var w=p&&h?"".concat(p," ").concat(h):"";var g=d.address;var y=u===null||u===void 0?void 0:u.address;return{address:N({address:Object.assign(Object.assign({},g),{name:f}),invalidAdddressList:n}),billingAddress:!i?N({address:y?Object.assign(Object.assign({},y),{name:w}):null,invalidAdddressList:t}):undefined,destinationCountry:g.country}};var P=e("O",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var D=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o;return __generator(this,(function(i){switch(i.label){case 0:if(!r.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",r.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),t=n.errors,o=n.json;return[2,{errors:t,json:o}]}}))}))};var L=e("z",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,D()];case 1:n=o.sent(),t=n.errors,r=n.json;if(t.length||!r){p("Failed to retrieve checkout session info before confirming payment ",t);void f({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:m}});return[2,{errorMessage:s("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=r.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){p("Landed cost is not found in the checkout session before confirming payment.");void f({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:m}});return[2,{errorMessage:s('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 x=function(e){var t=e.theme;var r={".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(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var R=function(e){var n=e.borderStyle,t=e.theme;switch(t){case"DARK":return{borderRadius:g({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var U=t((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,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:{}}}})),z=U.onChange,B=U.reset,F=U.state;e({A:z,c:F});var J=function(e){var t=e.clientSecret,r=e.overrideBorderRadius,i=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,d=e.paypalEnabled;var u=i||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=u&&w(u)?"night":"flat";var v=s==="DARK"?"night":"flat";var f=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},x({theme:s||"LIGHT"})),theme:s?v:c,variables:Object.assign(Object.assign({},R({borderStyle:r,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||undefined,customerSessionClientSecret:F.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],f,true),locale:o.selectedLocale}};var M=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var q=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var W=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return h(e)}));var Y=e("i",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){r=F.clientSecret;if(!F.stripe){d("Skip. Stripe is not initialized");return[2]}o=J({clientSecret:r,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(F.stripeElementsOptions);if(!F.stripeElements||!F.stripeElementsForBillingAddress){F.stripeElementsForBillingAddress=(n=F.stripe)===null||n===void 0?void 0:n.elements(o);d("Stripe elements for billing address initialized");F.stripeElements=(t=F.stripe)===null||t===void 0?void 0:t.elements(o);F.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){F.stripeElements.update(o);F.stripeElementsForBillingAddress.update(o);F.stripeElementsOptions=o;void F.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var H=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");B();F.stripe=window.Zonos.stripe}));var K=function(){var e,n,t,r;var o=JSON.stringify((e=F.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!F.stripeShippingSameAsBilling&&JSON.stringify((t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=F.stripeBillingAddressUsedWhenValidatingAddress)===null||r===void 0?void 0:r.value);return o||i};var G=function(){var e,n,t,r,o,i;var a=JSON.stringify((e=F.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((t=F.stripeAddressUsedWhenAsyncAddressUpdate)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value);var d=!F.stripeShippingSameAsBilling&&JSON.stringify((o=F.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=F.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=F.taxIdUsedWhenAsyncAddressUpdate!==F.taxId;var l=F.companyNameUsedWhenAsyncAddressUpdate!==F.companyName;return a||s||d||u||l};var V=e("B",(function(e){var n=e.address,t=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=b({firstName:t,lastName:o,name:i}),d=s.firstName,u=s.lastName;if(!d||!u){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,firstName:t,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:d,lastName:u,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}}));var Z=e("L",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,c,v,h;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=F.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!F.stripeShippingSameAsBilling&&!((n=F.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!F.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Se.landedCostData){return[2,{partiesCreated:false}]}i=(t=Se.landedCostData.find(Boolean))===null||t===void 0?void 0:t.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId}});return[2,{partiesCreated:false}]}a=G();if(!a){return[2,{partiesCreated:false}]}s=V({address:F.stripeAddressEventData.value.address,firstName:F.stripeAddressEventData.value.firstName,lastName:F.stripeAddressEventData.value.lastName,name:F.stripeAddressEventData.value.name,phone:F.stripeAddressEventData.value.phone});d=F.stripeShippingSameAsBilling?s:V({address:F.stripeBillingAddressEventData.value.address,firstName:F.stripeBillingAddressEventData.value.firstName,lastName:F.stripeBillingAddressEventData.value.lastName,name:F.stripeBillingAddressEventData.value.name,phone:F.stripeBillingAddressEventData.value.phone});u=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,l("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:d,companyName:F.companyName,email:((o=F.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:F.taxId},method:"POST"})];case 1:c=w.sent(),v=c.errors,h=c.json;if(v.length||!h){p("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,errors:v,json:h}});return[2,{partiesCreated:false}]}F.companyNameUsedWhenAsyncAddressUpdate=F.companyName;F.stripeAddressUsedWhenAsyncAddressUpdate=F.stripeAddressEventData;F.stripeBillingAddressUsedWhenAsyncAddressUpdate=F.stripeBillingAddressEventData;F.taxIdUsedWhenAsyncAddressUpdate=F.taxId;F.partyBillingId=h.billToPartyId;F.partyShippingId=h.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Q=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var X=function(){var e,n;var t=JSON.stringify((e=F.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeLinkEventData)===null||n===void 0?void 0:n.value);var r=F.stripeAddressEventData&&JSON.stringify(Q(F.stripeAddressEventData.value))!==JSON.stringify(F.stripeAddressUsedWhenFetchingLC);var o=!F.stripeShippingSameAsBilling&&F.stripeBillingAddressEventData&&JSON.stringify(Q(F.stripeBillingAddressEventData.value))!==JSON.stringify(F.stripeBillingAddressUsedWhenFetchingLC);return t||r||o};var $=function(){var e;var n=Se.landedCostData&&((e=Se.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Se.subtotal;var t=X();d("isPrefetchInfoOutdated","info",{isAddressOutdated:t});return!Se.landedCostData&&!F.isFetchingLandedCost||t||n};var ee=function(e){var t,r;var o=(t=n.genericSettings)===null||t===void 0?void 0:t.countryFields;var i=(r=n.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Se.addressFormRenderType==="stripe"){return a||s}return s};var ne=function(){var e,n,t,r;var o=!!((e=F.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=F.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=F.stripeShippingSameAsBilling?i:!!((t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete);var s=((r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)||"US";var d=ee(s);if(i&&a&&o){return true}if(!d||!F.stripeAddressEventData){return i&&a&&o}var u=F.stripeAddressEventData.value.address.line1.length>0;var l=F.stripeAddressEventData.value.firstName&&F.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&F.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&F.stripeAddressEventData.value.address.postal_code.length>=3;var f=F.stripeAddressEventData.value.phone&&F.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var te=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;F.fetchingLandedCostAbortController=n;ze();return[4,T(n)];case 1:t=v.sent(),o=t.checkoutSessionWorkflow,i=t.errors,a=t.itemCreateWorkflow,s=t.landedCostCalculateWorkflow,d=t.partyCreateWorkflow,u=t.shipmentRatingCalculateWorkflow;Se.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var n;return((n=e.extensions)===null||n===void 0?void 0:n.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;Se.shippingData=P((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ae(a);F.fetchingLandedCostAbortController=null;Se.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];Se.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var n=s===null||s===void 0?void 0:s.find((function(n){return(n===null||n===void 0?void 0:n.id)===e.landedCostId}));if(!n){return null}return Object.assign(Object.assign({},e),{landedCost:n})})).filter(Boolean))||[];l=r.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void E({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Se.promoCodeApplied&&!Se.landedCostData.find((function(e){var n;return(n=e.landedCost.appliedAdjustments)===null||n===void 0?void 0:n.find((function(e){return e.type==="PROMO_CODE"}))}));Se.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Se.promoCode)}return[2]}}))}))};var re=e("q",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,u,l,c,v,m,h;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=$();d=ne();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=F.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();F.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){F.isFetchingLandedCost=false;setTimeout((function(){F.isFetchingLandedCost=true}),300)}else{F.isFetchingLandedCost=true}if(F.stripeAddressEventData){F.stripeAddressUsedWhenFetchingLC={countryCode:F.stripeAddressEventData.value.address.country,postalCode:F.stripeAddressEventData.value.address.postal_code,state:F.stripeAddressEventData.value.address.state}}if(F.stripeBillingAddressEventData){F.stripeBillingAddressUsedWhenFetchingLC={countryCode:F.stripeBillingAddressEventData.value.address.country,postalCode:F.stripeBillingAddressEventData.value.address.postal_code,state:F.stripeBillingAddressEventData.value.address.state}}if(F.stripeLinkEventData){F.stripeLinkUsedWhenFetchingLC=Object.assign({},F.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);ze();return[4,te()];case 2:w.sent();u=(t=Se.shippingData)===null||t===void 0?void 0:t.find(Boolean);l=(r=Se.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Ee({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();Se.landedCostData=[];Se.shippingData=[];m=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!m.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,re(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:h=(o=F.stripeAddressEventData)===null||o===void 0?void 0:o.value;void f({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:h}});w.label=6;case 6:p(v);return[3,7];case 7:F.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var oe=e("E",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,re({applyingPromocode:true})];case 1:o.sent();if(Se.step==="payment"){Je()}return[4,Z()];case 2:o.sent();t=(e=Se.shippingData)===null||e===void 0?void 0:e.find(Boolean);r=(n=Se.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(t===null||t===void 0?void 0:t.id)}));if(!t||!r){return[2]}return[4,Le({applySubtotalsOnly:false,landedCostId:r.landedCostId,selectedShippingOption:t})];case 3:o.sent();return[2]}}))}))}));var ie=e("G",(function(){Se.promoCode="";sessionStorage.removeItem("zonos--promo-code");Se.promoCodeError=false;Se.promoCodeApplied=false}));var ae=e("F",(function(){return __awaiter(y,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Se.step==="payment"){Je()}ie();return[4,oe()];case 1:e.sent();return[2]}}))}))}));var se=e("H",(function(e){var n=[];var t=true;var r=window.Zonos.isCollect;switch(e){case"succeeded":{n=[s("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."),"",s("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(r){n=[s("Thank you for submitting your payment. We appreciate your prompt attention."),"",s("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.")]}t=false;break}case"requires_capture":case"processing":{n=[s("Payment processing. We'll update you when payment is received.")];t=false;break}case"requires_payment_method":{n=[s("Payment failed. Please try another payment method.")];if(r){n=[s("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{t=false;n=[s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[s("Something went wrong.")];break}}return{isError:t,messages:n}}));var de=e("v",(function(){return __awaiter(y,void 0,void 0,(function(){var e,t,r,o,i,a,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:r=n.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:i=v.sent(),a=i.errors,d=i.json;if(a.length||!d){p("Error occurs when handling inventory refund","warn",JSON.stringify(a));return[2,null]}if(!d.available||d.status===204){return[2,s("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(d.available||d.status===200){F.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,r({items:Se.items})];case 4:u=v.sent();return[2,u];case 5:c=v.sent();u=c instanceof Error?c.message:"Unknown error";void f({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(u)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Se.items}});throw c;case 6:return[2]}}))}))}));var ue=e("x",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t;return __generator(this,(function(r){switch(r.label){case 0:t=!!((n=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||n===void 0?void 0:n.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!t){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:r.sent();return[2]}}))}))}));var le=e("d",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=se(v),t=n.isError,r=n.messages;return[2,{error:t,messages:r}]}o=c||F.clientSecret;if(!F.stripe||!o){p("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[s("Something went wrong.")]}]}return[4,F.stripe.retrievePaymentIntent(o)];case 1:i=e.sent().paymentIntent;a=i===null||i===void 0?void 0:i.status;d=se(a),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:a}]}}))}))}));var ce=e("w",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,o,i,a,u,l,c,v,f,m,p;return __generator(this,(function(h){switch(h.label){case 0:o=!!((n=F.stripePaymentEventData)===null||n===void 0?void 0:n.complete);i=F.stripeElements;a=F.stripe;u=F.clientSecret;F.customErrorMessage=null;if(!((t=Se.selectedLandedCost)===null||t===void 0?void 0:t.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,L()];case 1:l=h.sent();if(!l.valid){F.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=r.checkoutSessionId;if(!(a&&i&&o&&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 E({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,a.confirmPayment({confirmParams:{return_url:v.toString()},elements:i,redirect:"if_required"})];case 2:f=h.sent(),m=f.error,p=f.paymentIntent;d("Payment intent confirmed","info",{error:m,paymentIntent:p});if((p===null||p===void 0?void 0:p.status)==="requires_action"){throw new Error(s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(m){if(m.type==="card_error"||m.type==="validation_error"){throw new Error(m.message)}if(m.type==="invalid_request_error"){if(m.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(p.status==="requires_payment_method"){throw new Error(s("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var ve=e("n",(function(){var e;var n=Se.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var t=r.enabledVariantTestKeys||[];var i={adjustmentsAmount:Se.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=Se.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Se.customerAuthenticationToken||undefined,isCollect:window.Zonos.isCollect,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:F.skipPaymentIntent,varianceTestInput:t};return i}));var fe=e("l",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:if(!r.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:m,cartId:window.Zonos.cartId}});Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:r.checkoutSessionId},method:"POST"})];case 1:n=a.sent(),t=n.errors,o=n.json;i=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(t.length||!i){p("Error occurs when getting payment intent",JSON.stringify(t,null,2));void f({endpoint:"Error creating payment intent",errors:t.map((function(e){return e.message})),metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,clientSecret:i}});Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2]}je(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var me=e("k",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r,i,a,s,u;return __generator(this,(function(c){switch(c.label){case 0:if(!o.targetCurrency){p("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}F.isFetchingSession=true;t=ve();d("Checkout session body","info",t);return[4,l("/api/zonos-elements/create-checkout-session",{body:t,method:"POST"})];case 1:r=c.sent(),i=r.errors,a=r.json;F.isFetchingSession=false;if(i.length||!a){s=(e=i.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.")}p("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}u=a.checkoutSessionCreate;je(u);Ee({method:((n=u.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Se.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var pe=e("u",(function(){return __awaiter(y,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(i){switch(i.label){case 0:e=r.checkoutSessionId;if(!e){p("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,l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:F.checkoutSettlementCurrency},method:"POST"})];case 1:t=i.sent().json;o=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||o!==F.checkoutSettlementCurrency){p("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var he=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,i,a;var s=e.adjustmentsAmount,d=e.cartId,u=e.currency,c=e.id,v=e.itemsAmount,f=e.landedCostId,m=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:n=r.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:F.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:Se.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:m,shipToPartyId:F.partyShippingId,skipPaymentIntent:F.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:t=e.sent(),i=t.errors,a=t.json;if(i.length||!a){p("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var we=function(e){var n,t,r,o,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var u={};if(!d){return u}var l=d.city,c=d.line1,v=d.line2,f=d.name,m=d.postal_code,p=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(t={},t[s.line1]=c,t)}if(s.line2&&v){u.line2=(r={},r[s.line2]=v,r)}if(s.postal_code&&m){u.postal_code=(o={},o[s.postal_code]=m,o)}if(s.state&&p){u.state=(i={},i[s.state]=p,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var ge=e("I",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c,v;var f=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=j({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:m,stripeAddressEventData:F.stripeAddressEventData,stripeBillingAddressEventData:F.stripeBillingAddressEventData,stripeShippingSameAsBilling:F.stripeShippingSameAsBilling});if(!i){F.translatedAddress={address:{},billingAddress:{}};return[2]}a=K();if(!a){return[2]}return[4,l("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,u=s.json;if(d.length||!u){p("Error occurs when translating address to latin",JSON.stringify(d,null,2));F.translatedAddress={address:{},billingAddress:{}};return[2]}F.stripeAddressUsedWhenValidatingAddress=F.stripeAddressEventData;F.stripeBillingAddressUsedWhenValidatingAddress=F.stripeBillingAddressEventData;c=(n=F.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value.address;F.translatedAddress={address:c?we({currentAddress:Object.assign(Object.assign({},c),{name:(r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!F.stripeShippingSameAsBilling?we({currentAddress:Object.assign(Object.assign({},v),{name:(o=F.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));z("clientSecret",(function(e){if(e&&F.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var ye=t((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:v(),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",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}})),be=ye.onChange,_e=ye.reset,Se=ye.state;e({K:be,e:Se});var Oe=function(e){switch(e){case"DAYS":return s("days");case"WEEKS":return s("weeks");case"BUSINESS_DAYS":default:return s("business days")}};var Ce=e("M",(function(e){var n;var t=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(t===null||t===void 0?void 0:t.min)||!(t===null||t===void 0?void 0:t.max)||!(t===null||t===void 0?void 0:t.type)){return null}return{maxTransit:t.max,minTransit:t.min,unit:Oe(t.type)}}));var ke=function(e){var n=e.item1,t=e.item2;if(!n||!t){return false}return t.sku&&n.sku&&n.sku===t.sku||t.description&&n.description&&n.description===t.description||n.name&&t.name&&n.name===t.name};var Ae=function(e){d("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var t=Se.items.find((function(n){return ke({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:t},e),{restriction:n})})).filter(Boolean);Se.restrictedItems=n;Se.items=Se.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return ke({item1:n,item2:e})}))})}));return{cartItems:Se.items,restrictedItems:n}};var Ie=e("g",(function(){r.checkoutSessionId=null;_e()}));var Te=e("o",(function(e){var n=e.messages,t=e.title;Ie();H();Se.step="error";Se.error={messages:n,title:t}}));var Ee=function(e){var n=e.dutiesTaxesFeesEstimate,t=e.method,r=e.subtotals;Se.exchangeRate=r.exchangeRate;Se.adjustmentTotal=r.adjustments;Se.dutiesTaxesFees=t==="DAP"?null:r.landedCostTotal;Se.subtotal=r.items;Se.total=r.total;Se.currency=r.presentmentCurrencyCode;Se.dutiesTaxesFeesEstimate=n||null};var Ne=e("D",(function(){var e=Se.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var je=e("p",(function(e){var n,t,o,s,u;F.clientSecret=e.clientSecret;F.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;F.customerProfile=e.customerProfile;Se.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:m,checkoutSession:e}})}if(e.id){r.checkoutSessionId=e.id}var l=i(e.varianceTestResults||[]);a(l);var c=((o=(t=(n=Se.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||t===void 0?void 0:t.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((u=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||u===void 0?void 0:u.value)||null;if(c){d("Found externalConfirmationPageURL: ".concat(c));Se.externalConfirmationPageURL=c}}));var Pe=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,i,a,u,l;var c=e.adjustmentsAmount,v=e.cartId,f=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Se.selectedLandedCost){t=Se.selectedLandedCost.subtotals;Ee({dutiesTaxesFeesEstimate:m,method:Se.landedCostMethod,subtotals:t});d("Exchange rate updated for cart items (landed cost subtotal)","info",Se.exchangeRate)}if(!r.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,he({adjustmentsAmount:c,billToPartyId:F.partyBillingId,cartId:v,currency:f,id:r.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:F.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:i=e.sent(),a=i.errors,u=i.json;if(!(a.length>0||!u))return[3,4];p("Error occurs when updating checkout session.");if(!g)return[3,3];d("Initiating checkout session on failure","info");return[4,me()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Ee({method:((n=u.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Se.exchangeRate)}je(u.checkoutSessionUpdate);return[2,true]}}))}))};var De=e("N",(function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=F.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var Le=e("C",(function(e){return __awaiter(y,[e],void 0,(function(e){var t,o,i,a,s,u,l,c,v,f,m,p,h,w,g,y,b,_,S,O,C,k,A,I,T;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});Se.selectedShippingOption=j;p=Ce(Se.selectedShippingOption);if(p){h=p.maxTransit,w=p.minTransit,g=p.unit;Se.selectedShippingOptionTransitTime="".concat(w,"-").concat(h," ").concat(g)}else{Se.selectedShippingOptionTransitTime=""}y=(t=Se.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===N}));Se.selectedLandedCost=y||null;if(!y){return[2,false]}b=((o=y.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;_=y.subtotals.exchangeRate.rate;S=b*_;if(S){d("DAP quote, using estimate: ".concat(S),"info")}Se.landedCostMethod=De(y.landedCost);Se.shipping=y.subtotals.shipping;O=((i=y===null||y===void 0?void 0:y.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";C=!!((s=(a=y===null||y===void 0?void 0:y.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Se.isSelectedShippingAboveDeminimis=C;Se.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];A=y.subtotals;Ee({dutiesTaxesFeesEstimate:S,method:Se.landedCostMethod,subtotals:A});d("Exchange rate updated for cart items (landed cost subtotal)","info",Se.exchangeRate);k=true;return[3,3];case 1:return[4,Pe({adjustmentsAmount:Se.adjustmentTotal,billToPartyId:F.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(u=y.landedCost)===null||u===void 0?void 0:u.id,shipToPartyId:F.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:I=(l=Se.items.find(Boolean))===null||l===void 0?void 0:l.currencyCode;T=((c=F.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";F.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((v=Se.checkoutSession)===null||v===void 0?void 0:v.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(f=n.genericSettings)===null||f===void 0?void 0:f.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(T));return[2,k]}}))}))}));var xe=e("m",(function(e){var n=e.isPreview,t=e.sessionTimeout;if(n){return}var r=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=r&&!isNaN(parseInt(r,10))?parseInt(r,10):t;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Se.checkoutTimeoutInterval=setTimeout((function(){Se.checkoutSessionTimeoutShow=true}),o)}));var Re=e("j",(function(){if(Se.checkoutTimeoutInterval){clearTimeout(Se.checkoutTimeoutInterval);Se.checkoutTimeoutInterval=null}}));var Ue=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var ze=function(){Se.items=Se.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Se.restrictedItems=[]};var Be=e("f",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,o,i;var a=e.adjustments,s=e.cartItems,d=e.landedCostId,u=e.shouldInitSessionOnFailure,l=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:Se.adjustments=a;Se.items=Ue(s);t=(n=s.find(Boolean))===null||n===void 0?void 0:n.currencyCode;o=s.reduce((function(e,n){return e+n.amount*n.quantity}),0);i=a.reduce((function(e,n){return e+n.amount}),0);if(!t||!o){return[2]}Se.currency=t;F.isFetchingSession=true;return[4,Pe({adjustmentsAmount:i,billToPartyId:F.partyBillingId,cartId:window.Zonos.cartId,currency:t,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:d,shipToPartyId:F.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:e.sent();F.isFetchingSession=false;return[2]}}))}))}));var Fe=function(){Se.selectedShippingOption=null;Se.isSelectedShippingAboveDeminimis=false;Se.isSelectedShippingGuarantee=false;Se.selectedShippingOptionTransitTime="";Se.dutiesTaxesFees=0;Se.dutiesTaxesFeesEstimate=0;Se.shipping=0;Se.total=Se.subtotal};var Je=function(){if(Se.step==="shipping"){Se.step="customer-info";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})})}else if(Se.step==="payment"){Se.step="shipping";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})})}else if(Se.step==="finish"){Se.step="payment";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{payment:Object.assign(Object.assign({},Se.tabItems.payment),{isDone:false})})}};var Me=e("r",(function(){if(Se.step==="customer-info"){Se.step="shipping";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems["customer-info"]),{isDone:true})})}else if(Se.step==="shipping"){Se.step="payment";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:true})})}else if(Se.step==="payment"){Se.step="finish"}}));var qe=e("h",(function(){Se.step="customer-info";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Se.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})});Fe()}))}}}));
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 a(e){try{d(r.next(e))}catch(e){i(e)}}function s(e){try{d(r["throw"](e))}catch(e){i(e)}}function d(e){e.done?t(e.value):o(e.value).then(a,s)}d((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,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(n){return d([e,n])}}function d(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(t=0)),t)try{if(r=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:t.label++;return{value:s[1],done:false};case 5:t.label++;o=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=n.call(e,t)}catch(e){s=[6,e];o=0}finally{r=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,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-9d863a3b.system.js","./p-640a6898.system.js","./p-62fa680d.system.js","./p-062430f9.system.js","./p-e7f8595f.system.js","./p-e63b8b24.system.js"],(function(e){"use strict";var n,t,r,o,i,a,s,d,u,l,c,v,f,m,p,h,w,g;return{setters:[function(e){n=e.z;t=e.c},function(e){r=e.s;o=e.l;i=e.f;a=e.b},function(e){s=e.t},function(e){d=e.l;u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;m=e.d;p=e.b;h=e.j},function(e){w=e.i},function(e){g=e.g}],execute:function(){var y=this;var b=e("J",(function(e){var n=e.firstName,t=e.lastName,r=e.name;var o;if(!r&&!n&&!t){return{firstName:"",lastName:""}}var i=(r===null||r===void 0?void 0:r.split(/\s+/))||[];var a=(n===null||n===void 0?void 0:n.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(t===null||t===void 0?void 0:t.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var _=function(e){var n=e.currentAddress,t=e.translatedAddress;var r,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,m=u.postal_code,p=u.state;var h=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((r=t.city)===null||r===void 0?void 0:r[l])||l,country:c,line1:((o=t.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=t.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=t.name)===null||a===void 0?void 0:a[h])||h,phone:n.value.phone||"",postal_code:((s=t.postal_code)===null||s===void 0?void 0:s[m])||m,state:((d=t.state)===null||d===void 0?void 0:d[p])||p}};var S=function(e){var n;var t=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=F.stripeLinkEventData;var i=F.stripeAddressEventData;var a=F.stripeShippingSameAsBilling?F.stripeAddressEventData:F.stripeBillingAddressEventData;if(!i||!a){throw new Error("Missing stripe address data")}var s=_({currentAddress:i,translatedAddress:F.translatedAddress.address});var d=b({name:s.name}),u=d.firstName,l=d.lastName;var c=_({currentAddress:a,translatedAddress:F.translatedAddress.address});var v=b({name:c.name}),f=v.firstName,m=v.lastName;return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:f,lastName:m,phone:c.phone},cartCurrencyCode:(n=Se.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionId:r.checkoutSessionId||"",contact:{companyName:F.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:u,lastName:l,phone:s.phone},isTest:!!t,landedCostAdjustments:Se.promoCode?[{amount:0,productId:null,promoCode:Se.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:F.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};var O=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=F.stripeLinkEventData;var t=F.stripeAddressEventData;var o=F.stripeShippingSameAsBilling?F.stripeAddressEventData:F.stripeBillingAddressEventData;d({stripeAddressData:t,stripeBillingAddressData:o},"info");if(!t||!o){throw new Error("Missing stripe address data")}var i=_({currentAddress:t,translatedAddress:F.translatedAddress.address});var a=b({name:i.name}),s=a.firstName,u=a.lastName;var l=_({currentAddress:o,translatedAddress:F.translatedAddress.address});var c=b({name:l.name}),v=c.firstName,f=c.lastName;var m=Se.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var p=Se.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Se.promoCode,sku:null,type:"PROMO_CODE"}],m,true):m;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:r.checkoutSessionId||"",contact:{companyName:F.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Se.items,landedCostAdjustments:p,shipToTaxId:F.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var C=function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=O();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:u["vercel"]})];case 1:s=f.sent();if(!s||!((n=s.checkoutSessionWorkflow)===null||n===void 0?void 0:n.length)&&((t=s.errors)===null||t===void 0?void 0:t.length)){throw new Error("Failed to build landed cost: ".concat(((o=(r=s===null||s===void 0?void 0:s.errors)===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,l("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=f.sent(),c=d.errors,v=d.json;if(!v||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var k=function(e){return __awaiter(y,void 0,void 0,(function(){var t,r,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:r=n.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,C(r)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:O(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=u.sent(),a=i.errors,s=i.json;if(a.length||!s){d=((t=a[0])===null||t===void 0?void 0:t.message)==="The user aborted a request.";if(d){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 A=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:S(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){u=typeof((n=s[0])===null||n===void 0?void 0:n.message)==="string"&&(((t=s[0])===null||t===void 0?void 0:t.message)==="The user aborted a request."||((r=s[0])===null||r===void 0?void 0:r.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")));c=u?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(c)}return[2,d]}}))}))};var I=undefined&&undefined.__rest||function(e,n){var t={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0)t[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++){if(n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o]))t[r[o]]=e[r[o]]}return t};var T=function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,k(e)];case 1:t=a.sent();return[2,t];case 2:return[4,A({abortController:e,cartId:n})];case 3:r=a.sent(),o=r.cartWorkflow,i=I(r,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var E=e("t",(function(e){return __awaiter(y,[e],void 0,(function(e){var t,r,i,a,s,d,u,p,h;var w=e.checkoutSessionId,g=e.eventName,y=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:i=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;p=n.organizationId;if(!w){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:m,checkoutSessionId:w,eventName:g,metadata:y,organizationId:p,trackEventLogs:a}});return[2]}if(!p){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:m,checkoutSessionId:w,eventName:g,metadata:y,organizationId:p,trackEventLogs:a}})}h={checkoutSessionId:w,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:p};return[4,l("/api/zonos-elements/track-conversion-event",{body:h,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var N=function(e){var n=e.address,t=e.invalidAdddressList;if(!n){return}if(!t){return}var r={};if(t.city){r.city=n.city}if(t.line1){r.line1=n.line1}if(t.line2){r.line2=n.line2}if(t.postal_code){r.postal_code=n.postal_code}if(t.state){r.state=n.state}if(t.name){r.name=n.name}return Object.keys(r).length?r:undefined};var j=function(e){var n=e.addressInvalidCharactersList,t=e.billingAddressInvalidCharactersList,r=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(r===null||r===void 0?void 0:r.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!n&&!t){return null}var d=r.value;var u=(o===null||o===void 0?void 0:o.value)||null;var l=b({firstName:d.firstName,lastName:d.lastName,name:d.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var m=b({firstName:u===null||u===void 0?void 0:u.firstName,lastName:u===null||u===void 0?void 0:u.lastName,name:(u===null||u===void 0?void 0:u.name)||""}),p=m.firstName,h=m.lastName;var w=p&&h?"".concat(p," ").concat(h):"";var g=d.address;var y=u===null||u===void 0?void 0:u.address;return{address:N({address:Object.assign(Object.assign({},g),{name:f}),invalidAdddressList:n}),billingAddress:!i?N({address:y?Object.assign(Object.assign({},y),{name:w}):null,invalidAdddressList:t}):undefined,destinationCountry:g.country}};var P=e("O",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var D=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o;return __generator(this,(function(i){switch(i.label){case 0:if(!r.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",r.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),t=n.errors,o=n.json;return[2,{errors:t,json:o}]}}))}))};var L=e("z",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,D()];case 1:n=o.sent(),t=n.errors,r=n.json;if(t.length||!r){p("Failed to retrieve checkout session info before confirming payment ",t);void f({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:m}});return[2,{errorMessage:s("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=r.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){p("Landed cost is not found in the checkout session before confirming payment.");void f({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:m}});return[2,{errorMessage:s('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 x=function(e){var t=e.theme;var r={".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(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var R=function(e){var n=e.borderStyle,t=e.theme;switch(t){case"DARK":return{borderRadius:g({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var U=t((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,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:{}}}})),z=U.onChange,B=U.reset,F=U.state;e({A:z,c:F});var J=function(e){var t=e.clientSecret,r=e.overrideBorderRadius,i=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,d=e.paypalEnabled;var u=i||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=u&&w(u)?"night":"flat";var v=s==="DARK"?"night":"flat";var f=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},x({theme:s||"LIGHT"})),theme:s?v:c,variables:Object.assign(Object.assign({},R({borderStyle:r,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||undefined,customerSessionClientSecret:F.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],f,true),locale:o.selectedLocale}};var M=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var q=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var W=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return h(e)}));var Y=e("i",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i;return __generator(this,(function(a){r=F.clientSecret;if(!F.stripe){d("Skip. Stripe is not initialized");return[2]}o=J({clientSecret:r,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(F.stripeElementsOptions);if(!F.stripeElements||!F.stripeElementsForBillingAddress){F.stripeElementsForBillingAddress=(n=F.stripe)===null||n===void 0?void 0:n.elements(o);d("Stripe elements for billing address initialized");F.stripeElements=(t=F.stripe)===null||t===void 0?void 0:t.elements(o);F.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){F.stripeElements.update(o);F.stripeElementsForBillingAddress.update(o);F.stripeElementsOptions=o;void F.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var H=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");B();F.stripe=window.Zonos.stripe}));var K=function(){var e,n,t,r;var o=JSON.stringify((e=F.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!F.stripeShippingSameAsBilling&&JSON.stringify((t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=F.stripeBillingAddressUsedWhenValidatingAddress)===null||r===void 0?void 0:r.value);return o||i};var G=function(){var e,n,t,r,o,i;var a=JSON.stringify((e=F.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((t=F.stripeAddressUsedWhenAsyncAddressUpdate)===null||t===void 0?void 0:t.value)!==JSON.stringify((r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value);var d=!F.stripeShippingSameAsBilling&&JSON.stringify((o=F.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=F.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=F.taxIdUsedWhenAsyncAddressUpdate!==F.taxId;var l=F.companyNameUsedWhenAsyncAddressUpdate!==F.companyName;return a||s||d||u||l};var V=e("B",(function(e){var n=e.address,t=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=b({firstName:t,lastName:o,name:i}),d=s.firstName,u=s.lastName;if(!d||!u){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,firstName:t,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:d,lastName:u,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}}));var Z=e("L",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,c,v,h;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=F.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!F.stripeShippingSameAsBilling&&!((n=F.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!F.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Se.landedCostData){return[2,{partiesCreated:false}]}i=(t=Se.landedCostData.find(Boolean))===null||t===void 0?void 0:t.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId}});return[2,{partiesCreated:false}]}a=G();if(!a){return[2,{partiesCreated:false}]}s=V({address:F.stripeAddressEventData.value.address,firstName:F.stripeAddressEventData.value.firstName,lastName:F.stripeAddressEventData.value.lastName,name:F.stripeAddressEventData.value.name,phone:F.stripeAddressEventData.value.phone});d=F.stripeShippingSameAsBilling?s:V({address:F.stripeBillingAddressEventData.value.address,firstName:F.stripeBillingAddressEventData.value.firstName,lastName:F.stripeBillingAddressEventData.value.lastName,name:F.stripeBillingAddressEventData.value.name,phone:F.stripeBillingAddressEventData.value.phone});u=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,l("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:d,companyName:F.companyName,email:((o=F.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:F.taxId},method:"POST"})];case 1:c=w.sent(),v=c.errors,h=c.json;if(v.length||!h){p("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,errors:v,json:h}});return[2,{partiesCreated:false}]}F.companyNameUsedWhenAsyncAddressUpdate=F.companyName;F.stripeAddressUsedWhenAsyncAddressUpdate=F.stripeAddressEventData;F.stripeBillingAddressUsedWhenAsyncAddressUpdate=F.stripeBillingAddressEventData;F.taxIdUsedWhenAsyncAddressUpdate=F.taxId;F.partyBillingId=h.billToPartyId;F.partyShippingId=h.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Q=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var X=function(){var e,n;var t=JSON.stringify((e=F.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=F.stripeLinkEventData)===null||n===void 0?void 0:n.value);var r=F.stripeAddressEventData&&JSON.stringify(Q(F.stripeAddressEventData.value))!==JSON.stringify(F.stripeAddressUsedWhenFetchingLC);var o=!F.stripeShippingSameAsBilling&&F.stripeBillingAddressEventData&&JSON.stringify(Q(F.stripeBillingAddressEventData.value))!==JSON.stringify(F.stripeBillingAddressUsedWhenFetchingLC);return t||r||o};var $=function(){var e;var n=Se.landedCostData&&((e=Se.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Se.subtotal;var t=X();d("isPrefetchInfoOutdated","info",{isAddressOutdated:t});return!Se.landedCostData&&!F.isFetchingLandedCost||t||n};var ee=function(e){var t,r;var o=(t=n.genericSettings)===null||t===void 0?void 0:t.countryFields;var i=(r=n.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Se.addressFormRenderType==="stripe"){return a||s}return s};var ne=function(){var e,n,t,r;var o=!!((e=F.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=F.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=F.stripeShippingSameAsBilling?i:!!((t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete);var s=((r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value.address.country)||"US";var d=ee(s);if(i&&a&&o){return true}if(!d||!F.stripeAddressEventData){return i&&a&&o}var u=F.stripeAddressEventData.value.address.line1.length>0;var l=F.stripeAddressEventData.value.firstName&&F.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&F.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&F.stripeAddressEventData.value.address.postal_code.length>=3;var f=F.stripeAddressEventData.value.phone&&F.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var te=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;F.fetchingLandedCostAbortController=n;ze();return[4,T(n)];case 1:t=v.sent(),o=t.checkoutSessionWorkflow,i=t.errors,a=t.itemCreateWorkflow,s=t.landedCostCalculateWorkflow,d=t.partyCreateWorkflow,u=t.shipmentRatingCalculateWorkflow;Se.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var n;return((n=e.extensions)===null||n===void 0?void 0:n.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;Se.shippingData=P((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ae(a);F.fetchingLandedCostAbortController=null;Se.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];Se.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var n=s===null||s===void 0?void 0:s.find((function(n){return(n===null||n===void 0?void 0:n.id)===e.landedCostId}));if(!n){return null}return Object.assign(Object.assign({},e),{landedCost:n})})).filter(Boolean))||[];l=r.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void E({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Se.promoCodeApplied&&!Se.landedCostData.find((function(e){var n;return(n=e.landedCost.appliedAdjustments)===null||n===void 0?void 0:n.find((function(e){return e.type==="PROMO_CODE"}))}));Se.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Se.promoCode)}return[2]}}))}))};var re=e("q",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,r,o,i,a,s,d,u,l,c,v,m,h;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=$();d=ne();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=F.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();F.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){F.isFetchingLandedCost=false;setTimeout((function(){F.isFetchingLandedCost=true}),300)}else{F.isFetchingLandedCost=true}if(F.stripeAddressEventData){F.stripeAddressUsedWhenFetchingLC={countryCode:F.stripeAddressEventData.value.address.country,postalCode:F.stripeAddressEventData.value.address.postal_code,state:F.stripeAddressEventData.value.address.state}}if(F.stripeBillingAddressEventData){F.stripeBillingAddressUsedWhenFetchingLC={countryCode:F.stripeBillingAddressEventData.value.address.country,postalCode:F.stripeBillingAddressEventData.value.address.postal_code,state:F.stripeBillingAddressEventData.value.address.state}}if(F.stripeLinkEventData){F.stripeLinkUsedWhenFetchingLC=Object.assign({},F.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);ze();return[4,te()];case 2:w.sent();u=(t=Se.shippingData)===null||t===void 0?void 0:t.find(Boolean);l=(r=Se.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Ee({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();Se.landedCostData=[];Se.shippingData=[];m=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!m.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,re(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:h=(o=F.stripeAddressEventData)===null||o===void 0?void 0:o.value;void f({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:h}});w.label=6;case 6:p(v);return[3,7];case 7:F.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var oe=e("E",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r;return __generator(this,(function(o){switch(o.label){case 0:return[4,re({applyingPromocode:true})];case 1:o.sent();if(Se.step==="payment"){Je()}return[4,Z()];case 2:o.sent();t=(e=Se.shippingData)===null||e===void 0?void 0:e.find(Boolean);r=(n=Se.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(t===null||t===void 0?void 0:t.id)}));if(!t||!r){return[2]}return[4,Le({applySubtotalsOnly:false,landedCostId:r.landedCostId,selectedShippingOption:t})];case 3:o.sent();return[2]}}))}))}));var ie=e("G",(function(){Se.promoCode="";sessionStorage.removeItem("zonos--promo-code");Se.promoCodeError=false;Se.promoCodeApplied=false}));var ae=e("F",(function(){return __awaiter(y,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Se.step==="payment"){Je()}ie();return[4,oe()];case 1:e.sent();return[2]}}))}))}));var se=e("H",(function(e){var n=[];var t=true;var r=window.Zonos.isCollect;switch(e){case"succeeded":{n=[s("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."),"",s("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(r){n=[s("Thank you for submitting your payment. We appreciate your prompt attention."),"",s("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.")]}t=false;break}case"requires_capture":case"processing":{n=[s("Payment processing. We'll update you when payment is received.")];t=false;break}case"requires_payment_method":{n=[s("Payment failed. Please try another payment method.")];if(r){n=[s("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{t=false;n=[s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[s("Something went wrong.")];break}}return{isError:t,messages:n}}));var de=e("v",(function(){return __awaiter(y,void 0,void 0,(function(){var e,t,r,o,i,a,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:r=n.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:i=v.sent(),a=i.errors,d=i.json;if(a.length||!d){p("Error occurs when handling inventory refund","warn",JSON.stringify(a));return[2,null]}if(!d.available||d.status===204){return[2,s("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(d.available||d.status===200){F.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,r({items:Se.items})];case 4:u=v.sent();return[2,u];case 5:c=v.sent();u=c instanceof Error?c.message:"Unknown error";void f({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(u)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Se.items}});throw c;case 6:return[2]}}))}))}));var ue=e("x",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t;return __generator(this,(function(r){switch(r.label){case 0:t=!!((n=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||n===void 0?void 0:n.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!t){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:r.sent();return[2]}}))}))}));var le=e("d",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=se(v),t=n.isError,r=n.messages;return[2,{error:t,messages:r}]}o=c||F.clientSecret;if(!F.stripe||!o){p("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[s("Something went wrong.")]}]}return[4,F.stripe.retrievePaymentIntent(o)];case 1:i=e.sent().paymentIntent;a=i===null||i===void 0?void 0:i.status;d=se(a),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:a}]}}))}))}));var ce=e("w",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,t,o,i,a,u,l,c,v,f,m,p;return __generator(this,(function(h){switch(h.label){case 0:o=!!((n=F.stripePaymentEventData)===null||n===void 0?void 0:n.complete);i=F.stripeElements;a=F.stripe;u=F.clientSecret;F.customErrorMessage=null;if(!((t=Se.selectedLandedCost)===null||t===void 0?void 0:t.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,L()];case 1:l=h.sent();if(!l.valid){F.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=r.checkoutSessionId;if(!(a&&i&&o&&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 E({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,a.confirmPayment({confirmParams:{return_url:v.toString()},elements:i,redirect:"if_required"})];case 2:f=h.sent(),m=f.error,p=f.paymentIntent;d("Payment intent confirmed","info",{error:m,paymentIntent:p});if((p===null||p===void 0?void 0:p.status)==="requires_action"){throw new Error(s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(m){if(m.type==="card_error"||m.type==="validation_error"){throw new Error(m.message)}if(m.type==="invalid_request_error"){if(m.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(p.status==="requires_payment_method"){throw new Error(s("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var ve=e("n",(function(){var e;var n=Se.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var t=r.enabledVariantTestKeys||[];var i={adjustmentsAmount:Se.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=Se.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Se.customerAuthenticationToken||undefined,isCollect:window.Zonos.isCollect,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:F.skipPaymentIntent,varianceTestInput:t};return i}));var fe=e("l",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:if(!r.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:m,cartId:window.Zonos.cartId}});Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:r.checkoutSessionId},method:"POST"})];case 1:n=a.sent(),t=n.errors,o=n.json;i=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(t.length||!i){p("Error occurs when getting payment intent",JSON.stringify(t,null,2));void f({endpoint:"Error creating payment intent",errors:t.map((function(e){return e.message})),metadata:{allLogs:m,cartId:window.Zonos.cartId,checkoutSessionId:r.checkoutSessionId,clientSecret:i}});Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2]}je(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var me=e("k",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,t,r,i,a,s,u;return __generator(this,(function(c){switch(c.label){case 0:if(!o.targetCurrency){p("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}F.isFetchingSession=true;t=ve();d("Checkout session body","info",t);return[4,l("/api/zonos-elements/create-checkout-session",{body:t,method:"POST"})];case 1:r=c.sent(),i=r.errors,a=r.json;F.isFetchingSession=false;if(i.length||!a){s=(e=i.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.")}p("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}u=a.checkoutSessionCreate;je(u);Ee({method:((n=u.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Se.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var pe=e("u",(function(){return __awaiter(y,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(i){switch(i.label){case 0:e=r.checkoutSessionId;if(!e){p("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,l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:F.checkoutSettlementCurrency},method:"POST"})];case 1:t=i.sent().json;o=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||o!==F.checkoutSettlementCurrency){p("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var he=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,i,a;var s=e.adjustmentsAmount,d=e.cartId,u=e.currency,c=e.id,v=e.itemsAmount,f=e.landedCostId,m=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:n=r.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:F.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:Se.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:m,shipToPartyId:F.partyShippingId,skipPaymentIntent:F.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:t=e.sent(),i=t.errors,a=t.json;if(i.length||!a){p("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var we=function(e){var n,t,r,o,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var u={};if(!d){return u}var l=d.city,c=d.line1,v=d.line2,f=d.name,m=d.postal_code,p=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(t={},t[s.line1]=c,t)}if(s.line2&&v){u.line2=(r={},r[s.line2]=v,r)}if(s.postal_code&&m){u.postal_code=(o={},o[s.postal_code]=m,o)}if(s.state&&p){u.state=(i={},i[s.state]=p,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var ge=e("I",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,r,o,i,a,s,d,u,c,v;var f=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=j({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:m,stripeAddressEventData:F.stripeAddressEventData,stripeBillingAddressEventData:F.stripeBillingAddressEventData,stripeShippingSameAsBilling:F.stripeShippingSameAsBilling});if(!i){F.translatedAddress={address:{},billingAddress:{}};return[2]}a=K();if(!a){return[2]}return[4,l("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,u=s.json;if(d.length||!u){p("Error occurs when translating address to latin",JSON.stringify(d,null,2));F.translatedAddress={address:{},billingAddress:{}};return[2]}F.stripeAddressUsedWhenValidatingAddress=F.stripeAddressEventData;F.stripeBillingAddressUsedWhenValidatingAddress=F.stripeBillingAddressEventData;c=(n=F.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(t=F.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value.address;F.translatedAddress={address:c?we({currentAddress:Object.assign(Object.assign({},c),{name:(r=F.stripeAddressEventData)===null||r===void 0?void 0:r.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!F.stripeShippingSameAsBilling?we({currentAddress:Object.assign(Object.assign({},v),{name:(o=F.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));z("clientSecret",(function(e){if(e&&F.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var ye=t((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:v(),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",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}})),be=ye.onChange,_e=ye.reset,Se=ye.state;e({K:be,e:Se});var Oe=function(e){switch(e){case"DAYS":return s("days");case"WEEKS":return s("weeks");case"BUSINESS_DAYS":default:return s("business days")}};var Ce=e("M",(function(e){var n;var t=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(t===null||t===void 0?void 0:t.min)||!(t===null||t===void 0?void 0:t.max)||!(t===null||t===void 0?void 0:t.type)){return null}return{maxTransit:t.max,minTransit:t.min,unit:Oe(t.type)}}));var ke=function(e){var n=e.item1,t=e.item2;if(!n||!t){return false}return t.sku&&n.sku&&n.sku===t.sku||t.description&&n.description&&n.description===t.description||n.name&&t.name&&n.name===t.name};var Ae=function(e){d("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var t=Se.items.find((function(n){return ke({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:t},e),{restriction:n})})).filter(Boolean);Se.restrictedItems=n;Se.items=Se.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return ke({item1:n,item2:e})}))})}));return{cartItems:Se.items,restrictedItems:n}};var Ie=e("g",(function(){r.checkoutSessionId=null;_e()}));var Te=e("o",(function(e){var n=e.messages,t=e.title;Ie();H();Se.step="error";Se.error={messages:n,title:t}}));var Ee=function(e){var n=e.dutiesTaxesFeesEstimate,t=e.method,r=e.subtotals;Se.exchangeRate=r.exchangeRate;Se.adjustmentTotal=r.adjustments;Se.dutiesTaxesFees=t==="DAP"?null:r.landedCostTotal;Se.subtotal=r.items;Se.total=r.total;Se.currency=r.presentmentCurrencyCode;Se.dutiesTaxesFeesEstimate=n||null};var Ne=e("D",(function(){var e=Se.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var je=e("p",(function(e){var n,t,o,s,u;F.clientSecret=e.clientSecret;F.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;F.customerProfile=e.customerProfile;Se.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:m,checkoutSession:e}})}if(e.id){r.checkoutSessionId=e.id}var l=i(e.varianceTestResults||[]);a(l);var c=((o=(t=(n=Se.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||t===void 0?void 0:t.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((u=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||u===void 0?void 0:u.value)||null;if(c){d("Found externalConfirmationPageURL: ".concat(c));Se.externalConfirmationPageURL=c}}));var Pe=function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,i,a,u,l;var c=e.adjustmentsAmount,v=e.cartId,f=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Se.selectedLandedCost){t=Se.selectedLandedCost.subtotals;Ee({dutiesTaxesFeesEstimate:m,method:Se.landedCostMethod,subtotals:t});d("Exchange rate updated for cart items (landed cost subtotal)","info",Se.exchangeRate)}if(!r.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,he({adjustmentsAmount:c,billToPartyId:F.partyBillingId,cartId:v,currency:f,id:r.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:F.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:i=e.sent(),a=i.errors,u=i.json;if(!(a.length>0||!u))return[3,4];p("Error occurs when updating checkout session.");if(!g)return[3,3];d("Initiating checkout session on failure","info");return[4,me()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){Te({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Ee({method:((n=u.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Se.exchangeRate)}je(u.checkoutSessionUpdate);return[2,true]}}))}))};var De=e("N",(function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=F.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var Le=e("C",(function(e){return __awaiter(y,[e],void 0,(function(e){var t,o,i,a,s,u,l,c,v,f,m,p,h,w,g,y,b,_,S,O,C,k,A,I,T;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});Se.selectedShippingOption=j;p=Ce(Se.selectedShippingOption);if(p){h=p.maxTransit,w=p.minTransit,g=p.unit;Se.selectedShippingOptionTransitTime="".concat(w,"-").concat(h," ").concat(g)}else{Se.selectedShippingOptionTransitTime=""}y=(t=Se.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===N}));Se.selectedLandedCost=y||null;if(!y){return[2,false]}b=((o=y.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;_=y.subtotals.exchangeRate.rate;S=b*_;if(S){d("DAP quote, using estimate: ".concat(S),"info")}Se.landedCostMethod=De(y.landedCost);Se.shipping=y.subtotals.shipping;O=((i=y===null||y===void 0?void 0:y.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";C=!!((s=(a=y===null||y===void 0?void 0:y.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Se.isSelectedShippingAboveDeminimis=C;Se.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];A=y.subtotals;Ee({dutiesTaxesFeesEstimate:S,method:Se.landedCostMethod,subtotals:A});d("Exchange rate updated for cart items (landed cost subtotal)","info",Se.exchangeRate);k=true;return[3,3];case 1:return[4,Pe({adjustmentsAmount:Se.adjustmentTotal,billToPartyId:F.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(u=y.landedCost)===null||u===void 0?void 0:u.id,shipToPartyId:F.partyShippingId,varianceTestInput:r.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:I=(l=Se.items.find(Boolean))===null||l===void 0?void 0:l.currencyCode;T=((c=F.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";F.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((v=Se.checkoutSession)===null||v===void 0?void 0:v.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(f=n.genericSettings)===null||f===void 0?void 0:f.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(T));return[2,k]}}))}))}));var xe=e("m",(function(e){var n=e.isPreview,t=e.sessionTimeout;if(n){return}var r=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=r&&!isNaN(parseInt(r,10))?parseInt(r,10):t;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Se.checkoutTimeoutInterval=setTimeout((function(){Se.checkoutSessionTimeoutShow=true}),o)}));var Re=e("j",(function(){if(Se.checkoutTimeoutInterval){clearTimeout(Se.checkoutTimeoutInterval);Se.checkoutTimeoutInterval=null}}));var Ue=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var ze=function(){Se.items=Se.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Se.restrictedItems=[]};var Be=e("f",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,t,o,i;var a=e.adjustments,s=e.cartItems,d=e.landedCostId,u=e.shouldInitSessionOnFailure,l=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:Se.adjustments=a;Se.items=Ue(s);t=(n=s.find(Boolean))===null||n===void 0?void 0:n.currencyCode;o=s.reduce((function(e,n){return e+n.amount*n.quantity}),0);i=a.reduce((function(e,n){return e+n.amount}),0);if(!t||!o){return[2]}Se.currency=t;F.isFetchingSession=true;return[4,Pe({adjustmentsAmount:i,billToPartyId:F.partyBillingId,cartId:window.Zonos.cartId,currency:t,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:d,shipToPartyId:F.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:r.enabledVariantTestKeys||[]})];case 1:e.sent();F.isFetchingSession=false;return[2]}}))}))}));var Fe=function(){Se.selectedShippingOption=null;Se.isSelectedShippingAboveDeminimis=false;Se.isSelectedShippingGuarantee=false;Se.selectedShippingOptionTransitTime="";Se.dutiesTaxesFees=0;Se.dutiesTaxesFeesEstimate=0;Se.shipping=0;Se.total=Se.subtotal};var Je=function(){if(Se.step==="shipping"){Se.step="customer-info";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})})}else if(Se.step==="payment"){Se.step="shipping";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})})}else if(Se.step==="finish"){Se.step="payment";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{payment:Object.assign(Object.assign({},Se.tabItems.payment),{isDone:false})})}};var Me=e("r",(function(){if(Se.step==="customer-info"){Se.step="shipping";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems["customer-info"]),{isDone:true})})}else if(Se.step==="shipping"){Se.step="payment";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:true})})}else if(Se.step==="payment"){Se.step="finish"}}));var qe=e("h",(function(){Se.step="customer-info";Se.tabItems=Object.assign(Object.assign({},Se.tabItems),{"customer-info":Object.assign(Object.assign({},Se.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Se.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Se.tabItems.shipping),{isDone:false})});Fe()}))}}}));
@@ -1,4 +1,4 @@
1
- import{z as o,c as e}from"./p-7ce093aa.js";import{t as n,z as r,c as t,e as a,v as i,r as s,j as l}from"./p-2a6c964d.js";import{s as c}from"./p-40a4266f.js";import{t as u}from"./p-27d9abab.js";import{h as d,l as p,b as v,j as y}from"./p-a8a312b2.js";import{t as f}from"./p-56e0ed65.js";
1
+ import{z as o,c as e}from"./p-7ce093aa.js";import{t as n,z as r,c as t,e as a,v as i,r as s,j as l}from"./p-b76db2ac.js";import{s as c}from"./p-4a3abbf2.js";import{t as u}from"./p-0c0fda23.js";import{h as d,l as p,b as v,j as y}from"./p-a8a312b2.js";import{t as f}from"./p-56e0ed65.js";
2
2
  /*!
3
3
  * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
4
  * Copyright 2020-present, PayPal, Inc. All rights reserved.