@zonos/elements 1.3.280 → 1.3.281

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 (211) hide show
  1. package/dist/cjs/{TaxId-12acedde.js → TaxId-cd9d490e.js} +1 -1
  2. package/dist/cjs/{cart-0fa312a5.js → cart-3313cb0c.js} +2 -2
  3. package/dist/cjs/{collect-f9c4ca7c.js → collect-2659c5af.js} +2 -2
  4. package/dist/cjs/{hasInclusivePrice-95431bca.js → hasInclusivePrice-d132daaa.js} +1 -1
  5. package/dist/cjs/index.cjs.js +8 -8
  6. package/dist/cjs/{invoice-ce757565.js → invoice-26f52c07.js} +2 -2
  7. package/dist/cjs/{localization-7fded969.js → localization-6189080f.js} +80 -80
  8. package/dist/cjs/{paypal-57ab3ab6.js → paypal-f6a256b5.js} +2 -2
  9. package/dist/cjs/{placeTestOrder-35e0d3bd.js → placeTestOrder-695f2b32.js} +2 -2
  10. package/dist/cjs/{renderCheckoutCurrency-41d48407.js → renderCheckoutCurrency-fe56094f.js} +2 -2
  11. package/dist/cjs/{shouldRenderTaxIdInput-b8abf6de.js → shouldRenderTaxIdInput-7d19556c.js} +1 -1
  12. package/dist/cjs/zonos-address-display_8.cjs.entry.js +4 -4
  13. package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
  14. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +4 -4
  15. package/dist/cjs/zonos-card_5.cjs.entry.js +4 -4
  16. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +14 -11
  17. package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
  19. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +7 -7
  20. package/dist/cjs/zonos-collect.cjs.entry.js +5 -5
  21. package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
  22. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  24. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  25. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  26. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +5 -5
  27. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +7 -7
  28. package/dist/cjs/zonos-invoice.cjs.entry.js +5 -5
  29. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  30. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +4 -4
  31. package/dist/collection/components/store/translationStore/strings.arabic.js +4 -4
  32. package/dist/collection/components/store/translationStore/strings.base.js +4 -4
  33. package/dist/collection/components/store/translationStore/strings.chinese.js +4 -4
  34. package/dist/collection/components/store/translationStore/strings.danish.js +4 -4
  35. package/dist/collection/components/store/translationStore/strings.dutch.js +4 -4
  36. package/dist/collection/components/store/translationStore/strings.french.js +4 -4
  37. package/dist/collection/components/store/translationStore/strings.german.js +4 -4
  38. package/dist/collection/components/store/translationStore/strings.hebrew.js +4 -4
  39. package/dist/collection/components/store/translationStore/strings.indonesian.js +4 -4
  40. package/dist/collection/components/store/translationStore/strings.italian.js +4 -4
  41. package/dist/collection/components/store/translationStore/strings.japanese.js +4 -4
  42. package/dist/collection/components/store/translationStore/strings.korean.js +4 -4
  43. package/dist/collection/components/store/translationStore/strings.norwegian.js +4 -4
  44. package/dist/collection/components/store/translationStore/strings.polish.js +4 -4
  45. package/dist/collection/components/store/translationStore/strings.portuguese.js +4 -4
  46. package/dist/collection/components/store/translationStore/strings.russian.js +4 -4
  47. package/dist/collection/components/store/translationStore/strings.spanish.js +4 -4
  48. package/dist/collection/components/store/translationStore/strings.swedish.js +4 -4
  49. package/dist/collection/components/store/translationStore/strings.turkish.js +4 -4
  50. package/dist/collection/components/store/translationStore/strings.vietnamese.js +4 -4
  51. package/dist/collection/components/utils/taxIdValidationResult.js +6 -3
  52. package/dist/collection/types/checkout/TaxId.js +1 -1
  53. package/dist/esm/{TaxId-50d72254.js → TaxId-63a14057.js} +1 -1
  54. package/dist/esm/{cart-4699e6ab.js → cart-c66ec17e.js} +2 -2
  55. package/dist/esm/{collect-24cc2e12.js → collect-915fd59d.js} +2 -2
  56. package/dist/esm/{hasInclusivePrice-f81ddcd6.js → hasInclusivePrice-6fd935f3.js} +1 -1
  57. package/dist/esm/index.js +8 -8
  58. package/dist/esm/{invoice-575dc93d.js → invoice-2a17c93c.js} +2 -2
  59. package/dist/esm/{localization-da2f407f.js → localization-6d36209f.js} +80 -80
  60. package/dist/esm/{paypal-d4436abd.js → paypal-cae1d404.js} +2 -2
  61. package/dist/esm/{placeTestOrder-d87b2c6a.js → placeTestOrder-955269d2.js} +2 -2
  62. package/dist/esm/{renderCheckoutCurrency-08526996.js → renderCheckoutCurrency-951386a5.js} +2 -2
  63. package/dist/esm/{shouldRenderTaxIdInput-2572bf77.js → shouldRenderTaxIdInput-ef7b5860.js} +1 -1
  64. package/dist/esm/zonos-address-display_8.entry.js +4 -4
  65. package/dist/esm/zonos-address_4.entry.js +4 -4
  66. package/dist/esm/zonos-airwallex-payment.entry.js +4 -4
  67. package/dist/esm/zonos-card_5.entry.js +4 -4
  68. package/dist/esm/zonos-cart-items_12.entry.js +14 -11
  69. package/dist/esm/zonos-checkout.entry.js +4 -4
  70. package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
  71. package/dist/esm/zonos-collect-finish_6.entry.js +7 -7
  72. package/dist/esm/zonos-collect.entry.js +5 -5
  73. package/dist/esm/zonos-controller.entry.js +3 -3
  74. package/dist/esm/zonos-country-flag.entry.js +1 -1
  75. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  76. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  77. package/dist/esm/zonos-hello.entry.js +1 -1
  78. package/dist/esm/zonos-invoice-cart-items_2.entry.js +5 -5
  79. package/dist/esm/zonos-invoice-finish_5.entry.js +7 -7
  80. package/dist/esm/zonos-invoice.entry.js +5 -5
  81. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm/zonos-policy-consent_2.entry.js +4 -4
  83. package/dist/esm-es5/{TaxId-50d72254.js → TaxId-63a14057.js} +1 -1
  84. package/dist/esm-es5/{cart-4699e6ab.js → cart-c66ec17e.js} +1 -1
  85. package/dist/esm-es5/{collect-24cc2e12.js → collect-915fd59d.js} +1 -1
  86. package/dist/esm-es5/{hasInclusivePrice-f81ddcd6.js → hasInclusivePrice-6fd935f3.js} +1 -1
  87. package/dist/esm-es5/index.js +1 -1
  88. package/dist/esm-es5/{invoice-575dc93d.js → invoice-2a17c93c.js} +1 -1
  89. package/dist/esm-es5/localization-6d36209f.js +1 -0
  90. package/dist/esm-es5/{paypal-d4436abd.js → paypal-cae1d404.js} +1 -1
  91. package/dist/esm-es5/{placeTestOrder-d87b2c6a.js → placeTestOrder-955269d2.js} +1 -1
  92. package/dist/esm-es5/{renderCheckoutCurrency-08526996.js → renderCheckoutCurrency-951386a5.js} +1 -1
  93. package/dist/esm-es5/{shouldRenderTaxIdInput-2572bf77.js → shouldRenderTaxIdInput-ef7b5860.js} +1 -1
  94. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  95. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  96. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  97. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  98. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  99. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  100. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  101. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  102. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  103. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  104. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  105. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  106. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  107. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  108. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  109. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  110. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  111. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  112. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  113. package/dist/scripts/index.d.ts +2 -2
  114. package/dist/scripts/index.js +1 -1
  115. package/dist/scripts/loadZonos.js +1 -1
  116. package/dist/scripts/zonos.js +1 -1
  117. package/dist/types/components/store/translationStore/strings.arabic.d.ts +2 -2
  118. package/dist/types/components/store/translationStore/strings.base.d.ts +2 -2
  119. package/dist/types/components/store/translationStore/strings.chinese.d.ts +2 -2
  120. package/dist/types/components/store/translationStore/strings.danish.d.ts +2 -2
  121. package/dist/types/components/store/translationStore/strings.dutch.d.ts +2 -2
  122. package/dist/types/components/store/translationStore/strings.french.d.ts +2 -2
  123. package/dist/types/components/store/translationStore/strings.german.d.ts +2 -2
  124. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +2 -2
  125. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +2 -2
  126. package/dist/types/components/store/translationStore/strings.italian.d.ts +2 -2
  127. package/dist/types/components/store/translationStore/strings.japanese.d.ts +2 -2
  128. package/dist/types/components/store/translationStore/strings.korean.d.ts +2 -2
  129. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +2 -2
  130. package/dist/types/components/store/translationStore/strings.polish.d.ts +2 -2
  131. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +2 -2
  132. package/dist/types/components/store/translationStore/strings.russian.d.ts +2 -2
  133. package/dist/types/components/store/translationStore/strings.spanish.d.ts +2 -2
  134. package/dist/types/components/store/translationStore/strings.swedish.d.ts +2 -2
  135. package/dist/types/components/store/translationStore/strings.turkish.d.ts +2 -2
  136. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +2 -2
  137. package/dist/types/components/utils/taxIdValidationResult.d.ts +1 -1
  138. package/dist/types/types/checkout/TaxId.d.ts +1 -1
  139. package/dist/zonos-elements/index.esm.js +1 -1
  140. package/dist/zonos-elements/{p-3f90cb36.entry.js → p-03fda4a8.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-81c4f04a.system.entry.js → p-060c521b.system.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-85796e67.entry.js → p-09da3c76.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-f55a2352.system.js → p-0ac1aa87.system.js} +1 -1
  144. package/dist/zonos-elements/{p-275fa2da.js → p-156891c5.js} +1 -1
  145. package/dist/zonos-elements/p-1577a739.js +1 -0
  146. package/dist/zonos-elements/{p-cf0c8c77.system.entry.js → p-179caaea.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-19f4e77a.entry.js → p-1ee5f392.entry.js} +1 -1
  148. package/dist/zonos-elements/p-26ca8ce7.js +1 -0
  149. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  150. package/dist/zonos-elements/{p-6451537c.entry.js → p-30067eed.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-96e7b465.js → p-3246d120.js} +1 -1
  152. package/dist/zonos-elements/{p-1bb85ff1.entry.js → p-38879af9.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-2dbdf883.system.js → p-39695a8b.system.js} +1 -1
  154. package/dist/zonos-elements/{p-6197aa73.system.entry.js → p-3e6bbf0b.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-b6049eef.system.entry.js → p-3f6fe80a.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-564c7bb5.system.entry.js → p-40b96482.system.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-fc2d5dd9.entry.js → p-4441c451.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-362215b6.system.entry.js → p-4c3f5fda.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-66223935.system.entry.js → p-54a8d4cf.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-aff7112b.entry.js → p-5677d31f.entry.js} +1 -1
  161. package/dist/zonos-elements/p-56fc3210.js +1 -0
  162. package/dist/zonos-elements/{p-944148db.system.entry.js → p-5a61c301.system.entry.js} +1 -1
  163. package/dist/zonos-elements/p-5e1aad7d.entry.js +1 -0
  164. package/dist/zonos-elements/{p-12452213.entry.js → p-683ec0bf.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-28b1c189.entry.js → p-6df034d6.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-6bea1787.entry.js → p-6df6cb8a.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-016b5bde.system.js → p-717cbe90.system.js} +1 -1
  168. package/dist/zonos-elements/{p-ec53c436.system.entry.js → p-71cb16da.system.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-dbd5be5d.entry.js → p-727387ed.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-807e7ebc.entry.js → p-746bdebe.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-48d55793.system.js → p-7ac8846c.system.js} +1 -1
  172. package/dist/zonos-elements/{p-a30f03d6.system.js → p-8005e102.system.js} +1 -1
  173. package/dist/zonos-elements/{p-67b2e46c.js → p-8051403a.js} +1 -1
  174. package/dist/zonos-elements/{p-46f88c11.system.entry.js → p-8308f7d6.system.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-0adab1d5.system.entry.js → p-86d6961c.system.entry.js} +1 -1
  176. package/dist/zonos-elements/p-9448d960.js +1 -0
  177. package/dist/zonos-elements/{p-2b8345d8.system.js → p-989cb22b.system.js} +1 -1
  178. package/dist/zonos-elements/{p-3068247c.system.entry.js → p-a23d3b3f.system.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-b05da593.system.entry.js → p-a34269b1.system.entry.js} +1 -1
  180. package/dist/zonos-elements/p-a553e132.js +1 -0
  181. package/dist/zonos-elements/{p-f3759c70.js → p-a5f8dc19.js} +1 -1
  182. package/dist/zonos-elements/{p-c2014d57.system.entry.js → p-a6535773.system.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-c4a479ad.entry.js → p-a6773627.entry.js} +1 -1
  184. package/dist/zonos-elements/{p-7237ec6f.system.entry.js → p-ae30e6c0.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-72c1bd64.entry.js → p-b406bb39.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-6b361d2b.js → p-bcf5cffb.js} +1 -1
  187. package/dist/zonos-elements/p-bf942ef0.system.js +1 -0
  188. package/dist/zonos-elements/p-c345d1f5.system.js +1 -0
  189. package/dist/zonos-elements/{p-dff1d3be.entry.js → p-d4337686.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-40a0c1d3.system.js → p-ddf68916.system.js} +1 -1
  191. package/dist/zonos-elements/{p-65fe75e1.entry.js → p-df8b8827.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-43a14674.system.entry.js → p-e0ec0aa3.system.entry.js} +1 -1
  193. package/dist/zonos-elements/p-e210edd9.system.js +1 -0
  194. package/dist/zonos-elements/{p-db9cb522.entry.js → p-e7a45f6c.entry.js} +1 -1
  195. package/dist/zonos-elements/{p-5b54f10c.entry.js → p-edf613ea.entry.js} +1 -1
  196. package/dist/zonos-elements/{p-b6cd6e62.system.entry.js → p-ee3c7b11.system.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-a7f0e824.system.entry.js → p-f156e2e5.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-788a16bb.system.js → p-f314217a.system.js} +1 -1
  199. package/dist/zonos-elements/{p-a5afcea1.system.entry.js → p-f3e1a6a7.system.entry.js} +1 -1
  200. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  201. package/package.json +1 -1
  202. package/dist/esm-es5/localization-da2f407f.js +0 -1
  203. package/dist/zonos-elements/p-39e2642f.js +0 -1
  204. package/dist/zonos-elements/p-3f8f4c78.js +0 -1
  205. package/dist/zonos-elements/p-63a383f4.js +0 -1
  206. package/dist/zonos-elements/p-75da4ba0.entry.js +0 -1
  207. package/dist/zonos-elements/p-79b6070a.js +0 -1
  208. package/dist/zonos-elements/p-94329e56.js +0 -1
  209. package/dist/zonos-elements/p-b330e451.system.js +0 -1
  210. package/dist/zonos-elements/p-b8c019b9.system.js +0 -1
  211. package/dist/zonos-elements/p-fd2d4d04.system.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-47a1d469.system.js","./p-fd2d4d04.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-30e9a6d7.system.js","./p-2b8345d8.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.l;a=e.j;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2,{errors:n,json:o}]}}))}))};var A=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),O=A.onChange,C=A.reset,k=A.state;e("S",k);var I=e("T",(function(){C()}));var T=function(e){d("Store credit balance from session","info",e);k.availableBalance=e};var P=e("a3",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;T(i);return[2]}}))}))}));var E=e("y",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);k.error=n;return[2,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});k.isApplying=true;k.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}]}k.appliedAmount=a.amountApplied;k.remainingBalance=a.remainingBalance;k.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}];case 4:return[2]}}))}))}));var N=e("$",(function(e){k.isEnabled=e;k.error=null;if(!e){k.amountToApply=null}}));var j=e("a2",(function(e){if(e===null){k.amountToApply=null;k.error=null;return}if(e<=0){k.error="Amount must be greater than zero";return}if(k.availableBalance!==null&&e>k.availableBalance){k.error="Amount exceeds available balance";return}var r=Ze.total+(Ze.storeCredit||0);if(e>r){k.error="Amount exceeds order total";return}k.error=null;k.amountToApply=e}));var D=e("a0",(function(e){k.useFullBalance=e;k.error=null;if(e&&k.availableBalance!==null){var r=Ze.total+(Ze.storeCredit||0);var n=Math.min(k.availableBalance,r);k.amountToApply=n}else if(!e){k.amountToApply=null}}));var L=function(){if(!k.isEnabled||k.amountToApply===null){return{mode:"NONE"}}if(k.useFullBalance){return{mode:"FULL"}}return{amount:k.amountToApply,mode:"PARTIAL"}};var x=e("I",(function(){if(!k.isEnabled||k.availableBalance===null){return 0}if(k.useFullBalance){return Math.min(k.availableBalance,Ze.total+(Ze.storeCredit||0))}return k.amountToApply||0}));var R=e("z",(function(){return k.amountToApply!==null&&k.amountToApply>0&&Ze.storeCredit>0&&Ze.total<=0}));var U=e("B",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);k.error=i;return[2,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;k.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}];case 4:return[2]}}))}))}));var z=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];var B={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var F=r({accepted:false,acceptedAt:null,locked:false,showError:false}),J=F.reset,M=F.state;e({p:J,E:M});var q=e("_",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return z.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(B[n]),url:a});return r}),[])}));var W=e("w",(function(){return q().length>0}));var Y=e("V",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var H=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};var K=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=ce.stripeLinkEventData;var s=ce.stripeAddressEventData;var u=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}var d=H({currentAddress:s,translatedAddress:ce.translatedAddress.address});var l=Y({name:d.name}),c=l.firstName,v=l.lastName;var f=H({currentAddress:u,translatedAddress:ce.translatedAddress.address});var p=Y({name:f.name}),m=p.firstName,h=p.lastName;var w=a()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:m,lastName:h,phone:f.phone},cartCurrencyCode:(r=Ze.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||i.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Ze.promoCode?[{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var G=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var r=ce.stripeLinkEventData;var n=ce.stripeAddressEventData;var o=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}var i=H({currentAddress:n,translatedAddress:ce.translatedAddress.address});var a=Y({name:i.name}),s=a.firstName,u=a.lastName;var l=H({currentAddress:o,translatedAddress:ce.translatedAddress.address});var c=Y({name:l.name}),v=c.firstName,f=c.lastName;var p=Ze.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Ze.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:r===null||r===void 0?void 0:r.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Ze.items,landedCostAdjustments:m,shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=G();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Ze.promoCode})];case 1:s=v.sent();if(!s||!((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var X=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,V(t)];case 1:o=d.sent();return[2,o];case 2:return[4,c("/api/zonos-elements/calculate-landed-cost",{body:G(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}a.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2,s]}return[2,s]}}))}))};var Z=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,c("/api/zonos-elements/cart-calculate-landed-cost",{body:K(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var $=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3,2];return[4,X(e)];case 1:n=a.sent();return[2,n];case 2:return[4,Z({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var ee=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,a,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&!window.Zonos.zonosConversionTest){return[2]}d=i.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}});return[2]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:a}),organizationId:v};return[4,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var re=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}return Object.keys(t).length?t:undefined};var ne=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;var l=Y({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=Y({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:re({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),billingAddress:!i?re({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};var te=e("Z",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));var oe=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(i){switch(i.label){case 0:return[4,S()];case 1:r=i.sent(),n=r.errors,t=r.json;if(n.length||!t){v("Failed to retrieve checkout session info before confirming payment ",n);void h({endpoint:"validateCheckoutSession",errors:n.map((function(e){return e.message})),metadata:{allLogs:l}});return[2,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2,{errorMessage:o('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))}));var ie=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ae=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var se={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var ue=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),de=ue.onChange,le=ue.reset,ce=ue.state;e({H:de,b:ce});var ve=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},ie({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},ae({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:m,customerSessionClientSecret:ce.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:i.selectedLocale}};var fe=e("q",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var pe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var me=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var he=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=ce.clientSecret;if(!ce.stripe){d("Skip. Stripe is not initialized");return[2]}o=ve({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(ce.stripeElementsOptions);if(!ce.stripeElements||!ce.stripeElementsForBillingAddress){ce.stripeElementsForBillingAddress=(r=ce.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");ce.stripeElements=(n=ce.stripe)===null||n===void 0?void 0:n.elements(o);ce.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){ce.stripeElements.update(o);ce.stripeElementsForBillingAddress.update(o);ce.stripeElementsOptions=o;void ce.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var we=e("F",(function(){sessionStorage.removeItem("zonos--client-secret");le();ce.stripe=window.Zonos.stripe}));var ye=function(){var e,r,n,t;var o=JSON.stringify((e=ce.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!ce.stripeShippingSameAsBilling&&JSON.stringify((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ge=function(){var e,r,n,t,o,i,a,s;var u=(e=Ze.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Ze.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;if(!u||!d){return false}if(ce.partyShippingId!==u||ce.partyBillingId!==d){return true}var l=JSON.stringify((n=ce.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=ce.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!ce.stripeShippingSameAsBilling&&JSON.stringify((a=ce.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=ce.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=ce.taxIdUsedWhenAsyncAddressUpdate!==ce.taxId;var p=ce.companyNameUsedWhenAsyncAddressUpdate!==ce.companyName;return l||c||v||f||p};var be=e("K",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=Y({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var _e=e("W",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=ce.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!ce.stripeShippingSameAsBilling&&!((r=ce.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!ce.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Ze.landedCostData){return[2,{partiesCreated:false}]}i=(n=Ze.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=ge();if(!a){return[2,{partiesCreated:false}]}s=be({address:ce.stripeAddressEventData.value.address,firstName:ce.stripeAddressEventData.value.firstName,lastName:ce.stripeAddressEventData.value.lastName,name:ce.stripeAddressEventData.value.name,phone:ce.stripeAddressEventData.value.phone});u=ce.stripeShippingSameAsBilling?s:be({address:ce.stripeBillingAddressEventData.value.address,firstName:ce.stripeBillingAddressEventData.value.firstName,lastName:ce.stripeBillingAddressEventData.value.lastName,name:ce.stripeBillingAddressEventData.value.name,phone:ce.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:ce.companyName,email:((o=ce.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:ce.shortAddressCode,taxId:ce.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2,{partiesCreated:false}]}ce.companyNameUsedWhenAsyncAddressUpdate=ce.companyName;ce.stripeAddressUsedWhenAsyncAddressUpdate=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenAsyncAddressUpdate=ce.stripeBillingAddressEventData;ce.taxIdUsedWhenAsyncAddressUpdate=ce.taxId;ce.partyBillingId=m.billToPartyId;ce.partyShippingId=m.shipToPartyId;Ze.partiesData=Ze.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2,{partiesCreated:true}]}}))}))}));var Se=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Ae=function(){var e,r;var n=JSON.stringify((e=ce.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=ce.stripeAddressEventData&&JSON.stringify(Se(ce.stripeAddressEventData.value))!==JSON.stringify(ce.stripeAddressUsedWhenFetchingLC);var o=!ce.stripeShippingSameAsBilling&&ce.stripeBillingAddressEventData&&JSON.stringify(Se(ce.stripeBillingAddressEventData.value))!==JSON.stringify(ce.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};var Oe=function(){var e;var r=Ze.landedCostData&&((e=Ze.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Ze.subtotal;var n=Ae();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});return!Ze.landedCostData&&!ce.isFetchingLandedCost||n||r};var Ce=function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Ze.addressFormRenderType==="stripe"){return a||s}return s};var ke=function(){var e,r,n,t;var o=!!((e=ce.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=ce.stripeShippingSameAsBilling?i:!!((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ce(s);if(i&&a&&o){return true}if(!u||!ce.stripeAddressEventData){return i&&a&&o}var d=ce.stripeAddressEventData.value.address.line1.length>0;var l=ce.stripeAddressEventData.value.firstName&&ce.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&ce.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&ce.stripeAddressEventData.value.address.postal_code.length>=3;var f=ce.stripeAddressEventData.value.phone&&ce.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var Ie=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;ce.fetchingLandedCostAbortController=r;pr();return[4,$(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;Ze.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Ze.shippingData=te((d===null||d===void 0?void 0:d.filter(Boolean))||[]);rr(a);ce.fetchingLandedCostAbortController=null;Ze.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];Ze.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void ee({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Ze.promoCodeApplied&&!Ze.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Ze.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Ze.promoCode)}return[2]}}))}))};var Te=e("u",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=ke();if(!u){return[2,{isRequestNotReady:true}]}if(s){(r=ce.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();ce.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){ce.isFetchingLandedCost=false;setTimeout((function(){ce.isFetchingLandedCost=true}),300)}else{ce.isFetchingLandedCost=true}if(ce.stripeAddressEventData){ce.stripeAddressUsedWhenFetchingLC={countryCode:ce.stripeAddressEventData.value.address.country,postalCode:ce.stripeAddressEventData.value.address.postal_code,state:ce.stripeAddressEventData.value.address.state}}if(ce.stripeBillingAddressEventData){ce.stripeBillingAddressUsedWhenFetchingLC={countryCode:ce.stripeBillingAddressEventData.value.address.country,postalCode:ce.stripeBillingAddressEventData.value.address.postal_code,state:ce.stripeBillingAddressEventData.value.address.state}}if(ce.stripeLinkEventData){ce.stripeLinkUsedWhenFetchingLC=Object.assign({},ce.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);pr();return[4,Ie()];case 2:w.sent();d=(n=Ze.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Ze.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){ir({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:f=w.sent();Ze.landedCostData=[];Ze.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3,6];if(!(i<1))return[3,5];return[4,Te(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=ce.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3,7];case 7:ce.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,Te({applyingPromocode:true})];case 1:o.sent();if(Ze.step==="payment"){wr()}return[4,_e()];case 2:o.sent();n=(e=Ze.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2]}return[4,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2]}}))}))}));var Ee=e("Q",(function(){Ze.promoCode="";sessionStorage.removeItem("zonos--promo-code");Ze.promoCodeError=false;Ze.promoCodeApplied=false}));var Ne=e("P",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Ze.step==="payment"){wr()}Ee();return[4,Pe()];case 1:e.sent();return[2]}}))}))}));var je=e("R",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;switch(e){case"succeeded":{r=[o("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",o("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));var De=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3,2];return[4,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!u.available||u.status===204){return[2,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){ce.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4,t({items:Ze.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ze.items}});throw l;case 6:return[2]}}))}))}));var Le=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2]}return[4,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var xe=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=je(f),n=r.isError,t=r.messages;return[2,{error:n,messages:t}]}i=c||ce.clientSecret;if(!ce.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[o("Something went wrong.")]}]}if(!i.includes("_secret_")){return[2,{error:true,messages:[o("Something went wrong.")]}]}return[4,ce.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=je(s),d=u.isError,l=u.messages;return[2,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("C",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=ce.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=ce.stripeElements;s=ce.stripe;u=ce.clientSecret;ce.customErrorMessage=null;if(!((n=Ze.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,oe()];case 1:l=h.sent();if(!l.valid){ce.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void ee({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var Ue=function(){if(!M.accepted){return null}var e=q();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:M.acceptedAt||(new Date).toISOString(),locale:i.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};var ze=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(se).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var Be=e("n",(function(){var e;var r=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Ze.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:i.selectedLocale}],paymentProcessor:ze(),presentmentCountryCode:i.selectedCountryCode,skipPaymentIntent:ce.skipPaymentIntent,varianceTestInput:n};return o}));var Fe=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}return[4,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}sr(i.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var Je=e("j",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,a,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!i.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}ce.isFetchingSession=true;n=Be();d("Checkout session body","info",n);return[4,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,a=t.json;ce.isFetchingSession=false;if(o.length||!a){s=(e=o.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2,false]}u=a.checkoutSessionCreate;sr(u);ir({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Ze.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var Me=e("x",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){v("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:ce.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==ce.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var qe=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,a;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:ce.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:i.selectedLocale}],presentmentCountryCode:m,shipToPartyId:ce.partyShippingId,skipPaymentIntent:ce.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:a}]}return[2,{errors:[],json:a}]}}))}))};var We=e("J",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=Ue();if(!e){return[2,{errors:[]}]}if(!t.checkoutSessionId){return[2,{errors:[]}]}return[4,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2,{errors:[]}]}}))}))}));var Ye=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};var He=e("U",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=ne({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:ce.stripeAddressEventData,stripeBillingAddressEventData:ce.stripeBillingAddressEventData,stripeShippingSameAsBilling:ce.stripeShippingSameAsBilling});if(!i){ce.translatedAddress={address:{},billingAddress:{}};return[2]}a=ye();if(!a){return[2]}return[4,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));ce.translatedAddress={address:{},billingAddress:{}};return[2]}ce.stripeAddressUsedWhenValidatingAddress=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenValidatingAddress=ce.stripeBillingAddressEventData;l=(r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;ce.translatedAddress={address:l?Ye({currentAddress:Object.assign(Object.assign({},l),{name:(t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!ce.stripeShippingSameAsBilling?Ye({currentAddress:Object.assign(Object.assign({},f),{name:(o=ce.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2]}}))}))}));de("clientSecret",(function(e){if(e&&ce.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var Ke=e("N",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ge.onChange,Xe=Ge.reset,Ze=Ge.state;e({G:Ve,d:Ze});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};var $e=e("X",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var er=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};var rr=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Ze.items.find((function(r){return er({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Ze.restrictedItems=r;Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return er({item1:r,item2:e})}))})}));return{cartItems:Ze.items,restrictedItems:r}};var nr=null;var tr=e("f",(function(){t.checkoutSessionId=null;if(nr){clearTimeout(nr);nr=null}I();Xe()}));var or=e("o",(function(e){var r=e.messages,n=e.title;tr();we();Ze.step="error";Ze.error={messages:r,title:n}}));var ir=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;Ze.exchangeRate=t.exchangeRate;Ze.adjustmentTotal=t.adjustments;Ze.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Ze.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Ze.subtotal=t.items;Ze.total=t.total;Ze.currency=t.presentmentCurrencyCode;Ze.dutiesTaxesFeesEstimate=r||null};var ar=e("M",(function(){var e=Ze.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var sr=e("r",(function(e){var r,n,o,i,a,c,v;ce.clientSecret=e.clientSecret;ce.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;ce.customerProfile=e.customerProfile;Ze.checkoutSession=e;T((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var f=s(e.varianceTestResults||[]);u(f);var p=((a=(i=(o=Ze.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||((v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Ze.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,a,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Ze.selectedLandedCost){n=Ze.selectedLandedCost.subtotals;ir({dutiesTaxesFeesEstimate:m,method:Ze.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,qe({adjustmentsAmount:c,billToPartyId:ce.partyBillingId,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:i.selectedCountryCode,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];v("Error occurs when updating checkout session.");if(!y)return[3,3];d("Initiating checkout session on failure","info");return[4,Je()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){ir({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Ze.exchangeRate)}sr(u.checkoutSessionUpdate);return[2,true]}}))}))};var dr=e("Y",(function(e,r){var t,o,i,a;if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}if(Ke({deliveryType:r,landedCost:e,shipToCountry:(a=ce.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("L",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,A,O,C,k,I,T,P;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Ze.selectedShippingOption=j;h=$e(Ze.selectedShippingOption);if(h){w=h.maxTransit,y=h.minTransit,g=h.unit;Ze.selectedShippingOptionTransitTime="".concat(y,"-").concat(w," ").concat(g)}else{Ze.selectedShippingOptionTransitTime=""}b=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===N}));Ze.selectedLandedCost=b||null;if(!b){return[2,false]}_=((o=b.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;A=_*S;if(A){d("DAP quote, using estimate: ".concat(A),"info")}Ze.landedCostMethod=dr(b.landedCost,(i=j.shippingProfile)===null||i===void 0?void 0:i.serviceLevel.deliveryType);Ze.shipping=b.subtotals.shipping;O=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Ze.isSelectedShippingAboveDeminimis=C;Ze.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];I=b.subtotals;ir({dutiesTaxesFeesEstimate:A,method:Ze.landedCostMethod,subtotals:I});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate);k=true;return[3,3];case 1:return[4,ur({adjustmentsAmount:Ze.adjustmentTotal,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:A,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:T=(c=Ze.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;P=((v=ce.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";ce.shouldRenderPayInUsdButton=T==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=Ze.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(P));return[2,k]}}))}))}));var cr=e("m",(function(e){var r=e.isPreview,n=e.sessionTimeout;if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Ze.checkoutTimeoutInterval=setTimeout((function(){Ze.checkoutSessionTimeoutShow=true}),o)}));var vr=e("h",(function(){if(Ze.checkoutTimeoutInterval){clearTimeout(Ze.checkoutTimeoutInterval);Ze.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Ze.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var a=e.adjustments,s=e.cartItems,u=e.landedCostId,d=e.shouldInitSessionOnFailure,l=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:Ze.adjustments=a;Ze.items=fr(s);n=(r=s.find(Boolean))===null||r===void 0?void 0:r.currencyCode;o=s.reduce((function(e,r){return e+r.amount*r.quantity}),0);i=a.reduce((function(e,r){return e+r.amount}),0);if(!n||!o){return[2]}Ze.currency=n;ce.isFetchingSession=true;return[4,ur({adjustmentsAmount:i,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:u,shipToPartyId:ce.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();ce.isFetchingSession=false;return[2]}}))}))}));var hr=function(){Ze.selectedShippingOption=null;Ze.isSelectedShippingAboveDeminimis=false;Ze.isSelectedShippingGuarantee=false;Ze.selectedShippingOptionTransitTime="";Ze.dutiesTaxesFees=0;Ze.dutiesTaxesFeesEstimate=0;Ze.shipping=0;Ze.total=Ze.subtotal};var wr=function(){if(Ze.step==="shipping"){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="payment"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="finish"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false})})}};var yr=e("v",(function(){if(Ze.step==="customer-info"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:true})})}else if(Ze.step==="shipping"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:true})})}else if(Ze.step==="payment"){Ze.step="finish"}}));var gr=e("g",(function(){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,a,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2]}n=Ze.selectedLandedCost;o=Ze.currency||((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";a=Ze.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4,qe({adjustmentsAmount:a,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:i.selectedCountryCode,storeCreditApplication:L()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2]}ir({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2]}}))}))};var _r=e("a1",(function(){if(nr){clearTimeout(nr)}nr=setTimeout((function(){nr=null;void br()}),300)}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-47a1d469.system.js","./p-c345d1f5.system.js","./p-d938f42f.system.js","./p-01174496.system.js","./p-dab78981.system.js","./p-30e9a6d7.system.js","./p-989cb22b.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.l;a=e.j;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2,{errors:n,json:o}]}}))}))};var A=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),O=A.onChange,C=A.reset,k=A.state;e("S",k);var I=e("T",(function(){C()}));var T=function(e){d("Store credit balance from session","info",e);k.availableBalance=e};var P=e("a3",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;T(i);return[2]}}))}))}));var E=e("y",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);k.error=n;return[2,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});k.isApplying=true;k.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}]}k.appliedAmount=a.amountApplied;k.remainingBalance=a.remainingBalance;k.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);k.error=s;k.isApplying=false;return[2,{error:s,success:false}];case 4:return[2]}}))}))}));var N=e("$",(function(e){k.isEnabled=e;k.error=null;if(!e){k.amountToApply=null}}));var j=e("a2",(function(e){if(e===null){k.amountToApply=null;k.error=null;return}if(e<=0){k.error="Amount must be greater than zero";return}if(k.availableBalance!==null&&e>k.availableBalance){k.error="Amount exceeds available balance";return}var r=Ze.total+(Ze.storeCredit||0);if(e>r){k.error="Amount exceeds order total";return}k.error=null;k.amountToApply=e}));var D=e("a0",(function(e){k.useFullBalance=e;k.error=null;if(e&&k.availableBalance!==null){var r=Ze.total+(Ze.storeCredit||0);var n=Math.min(k.availableBalance,r);k.amountToApply=n}else if(!e){k.amountToApply=null}}));var L=function(){if(!k.isEnabled||k.amountToApply===null){return{mode:"NONE"}}if(k.useFullBalance){return{mode:"FULL"}}return{amount:k.amountToApply,mode:"PARTIAL"}};var x=e("I",(function(){if(!k.isEnabled||k.availableBalance===null){return 0}if(k.useFullBalance){return Math.min(k.availableBalance,Ze.total+(Ze.storeCredit||0))}return k.amountToApply||0}));var R=e("z",(function(){return k.amountToApply!==null&&k.amountToApply>0&&Ze.storeCredit>0&&Ze.total<=0}));var U=e("B",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);k.error=i;return[2,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;k.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);k.error=l;return[2,{error:l,orderId:null,success:false}];case 4:return[2]}}))}))}));var z=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];var B={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var F=r({accepted:false,acceptedAt:null,locked:false,showError:false}),J=F.reset,M=F.state;e({p:J,E:M});var q=e("_",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return z.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(B[n]),url:a});return r}),[])}));var W=e("w",(function(){return q().length>0}));var Y=e("V",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));var H=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};var K=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=ce.stripeLinkEventData;var s=ce.stripeAddressEventData;var u=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}var d=H({currentAddress:s,translatedAddress:ce.translatedAddress.address});var l=Y({name:d.name}),c=l.firstName,v=l.lastName;var f=H({currentAddress:u,translatedAddress:ce.translatedAddress.address});var p=Y({name:f.name}),m=p.firstName,h=p.lastName;var w=a()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{firstName:m,lastName:h,phone:f.phone},cartCurrencyCode:(r=Ze.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||i.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Ze.promoCode?[{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var G=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var r=ce.stripeLinkEventData;var n=ce.stripeAddressEventData;var o=ce.stripeShippingSameAsBilling?ce.stripeAddressEventData:ce.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}var i=H({currentAddress:n,translatedAddress:ce.translatedAddress.address});var a=Y({name:i.name}),s=a.firstName,u=a.lastName;var l=H({currentAddress:o,translatedAddress:ce.translatedAddress.address});var c=Y({name:l.name}),v=c.firstName,f=c.lastName;var p=Ze.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Ze.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Ze.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:ce.companyName,email:r===null||r===void 0?void 0:r.value.email,firstName:s,lastName:u,phone:i.phone},isTest:e,items:Ze.items,landedCostAdjustments:m,shipToShortAddressCode:ce.shortAddressCode,shipToTaxId:ce.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=G();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Ze.promoCode})];case 1:s=v.sent();if(!s||!((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var X=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,V(t)];case 1:o=d.sent();return[2,o];case 2:return[4,c("/api/zonos-elements/calculate-landed-cost",{body:G(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}a.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2,s]}return[2,s]}}))}))};var Z=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,c("/api/zonos-elements/cart-calculate-landed-cost",{body:K(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var $=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3,2];return[4,X(e)];case 1:n=a.sent();return[2,n];case 2:return[4,Z({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var ee=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,a,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&!window.Zonos.zonosConversionTest){return[2]}d=i.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}});return[2]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:a}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:a}),organizationId:v};return[4,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var re=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}return Object.keys(t).length?t:undefined};var ne=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);if(!a||!s){return null}if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;var l=Y({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=Y({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:re({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),billingAddress:!i?re({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};var te=e("Z",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));var oe=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(i){switch(i.label){case 0:return[4,S()];case 1:r=i.sent(),n=r.errors,t=r.json;if(n.length||!t){v("Failed to retrieve checkout session info before confirming payment ",n);void h({endpoint:"validateCheckoutSession",errors:n.map((function(e){return e.message})),metadata:{allLogs:l}});return[2,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2,{errorMessage:o('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))}));var ie=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ae=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var se={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var ue=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),de=ue.onChange,le=ue.reset,ce=ue.state;e({H:de,b:ce});var ve=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},ie({theme:s||"LIGHT"})),theme:s?f:v,variables:Object.assign(Object.assign({},ae({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:m,customerSessionClientSecret:ce.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:i.selectedLocale}};var fe=e("q",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var pe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var me=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var he=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=ce.clientSecret;if(!ce.stripe){d("Skip. Stripe is not initialized");return[2]}o=ve({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(ce.stripeElementsOptions);if(!ce.stripeElements||!ce.stripeElementsForBillingAddress){ce.stripeElementsForBillingAddress=(r=ce.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");ce.stripeElements=(n=ce.stripe)===null||n===void 0?void 0:n.elements(o);ce.stripeElementsOptions=o;d("Stripe elements initialized");return[2]}if(!i){ce.stripeElements.update(o);ce.stripeElementsForBillingAddress.update(o);ce.stripeElementsOptions=o;void ce.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var we=e("F",(function(){sessionStorage.removeItem("zonos--client-secret");le();ce.stripe=window.Zonos.stripe}));var ye=function(){var e,r,n,t;var o=JSON.stringify((e=ce.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!ce.stripeShippingSameAsBilling&&JSON.stringify((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ge=function(){var e,r,n,t,o,i,a,s;var u=(e=Ze.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Ze.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;if(!u||!d){return false}if(ce.partyShippingId!==u||ce.partyBillingId!==d){return true}var l=JSON.stringify((n=ce.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=ce.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=ce.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!ce.stripeShippingSameAsBilling&&JSON.stringify((a=ce.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=ce.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=ce.taxIdUsedWhenAsyncAddressUpdate!==ce.taxId;var p=ce.companyNameUsedWhenAsyncAddressUpdate!==ce.companyName;return l||c||v||f||p};var be=e("K",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=Y({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var _e=e("W",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=ce.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!ce.stripeShippingSameAsBilling&&!((r=ce.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!ce.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!Ze.landedCostData){return[2,{partiesCreated:false}]}i=(n=Ze.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=ge();if(!a){return[2,{partiesCreated:false}]}s=be({address:ce.stripeAddressEventData.value.address,firstName:ce.stripeAddressEventData.value.firstName,lastName:ce.stripeAddressEventData.value.lastName,name:ce.stripeAddressEventData.value.name,phone:ce.stripeAddressEventData.value.phone});u=ce.stripeShippingSameAsBilling?s:be({address:ce.stripeBillingAddressEventData.value.address,firstName:ce.stripeBillingAddressEventData.value.firstName,lastName:ce.stripeBillingAddressEventData.value.lastName,name:ce.stripeBillingAddressEventData.value.name,phone:ce.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:ce.companyName,email:((o=ce.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:ce.shortAddressCode,taxId:ce.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2,{partiesCreated:false}]}ce.companyNameUsedWhenAsyncAddressUpdate=ce.companyName;ce.stripeAddressUsedWhenAsyncAddressUpdate=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenAsyncAddressUpdate=ce.stripeBillingAddressEventData;ce.taxIdUsedWhenAsyncAddressUpdate=ce.taxId;ce.partyBillingId=m.billToPartyId;ce.partyShippingId=m.shipToPartyId;Ze.partiesData=Ze.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2,{partiesCreated:true}]}}))}))}));var Se=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Ae=function(){var e,r;var n=JSON.stringify((e=ce.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=ce.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=ce.stripeAddressEventData&&JSON.stringify(Se(ce.stripeAddressEventData.value))!==JSON.stringify(ce.stripeAddressUsedWhenFetchingLC);var o=!ce.stripeShippingSameAsBilling&&ce.stripeBillingAddressEventData&&JSON.stringify(Se(ce.stripeBillingAddressEventData.value))!==JSON.stringify(ce.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};var Oe=function(){var e;var r=Ze.landedCostData&&((e=Ze.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Ze.subtotal;var n=Ae();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});return!Ze.landedCostData&&!ce.isFetchingLandedCost||n||r};var Ce=function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(Ze.addressFormRenderType==="stripe"){return a||s}return s};var ke=function(){var e,r,n,t;var o=!!((e=ce.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=ce.stripeShippingSameAsBilling?i:!!((n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ce(s);if(i&&a&&o){return true}if(!u||!ce.stripeAddressEventData){return i&&a&&o}var d=ce.stripeAddressEventData.value.address.line1.length>0;var l=ce.stripeAddressEventData.value.firstName&&ce.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&ce.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&ce.stripeAddressEventData.value.address.postal_code.length>=3;var f=ce.stripeAddressEventData.value.phone&&ce.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var Ie=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;ce.fetchingLandedCostAbortController=r;pr();return[4,$(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;Ze.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Ze.shippingData=te((d===null||d===void 0?void 0:d.filter(Boolean))||[]);rr(a);ce.fetchingLandedCostAbortController=null;Ze.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];Ze.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void ee({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Ze.promoCodeApplied&&!Ze.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Ze.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",Ze.promoCode)}return[2]}}))}))};var Te=e("u",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=ke();if(!u){return[2,{isRequestNotReady:true}]}if(s){(r=ce.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();ce.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){ce.isFetchingLandedCost=false;setTimeout((function(){ce.isFetchingLandedCost=true}),300)}else{ce.isFetchingLandedCost=true}if(ce.stripeAddressEventData){ce.stripeAddressUsedWhenFetchingLC={countryCode:ce.stripeAddressEventData.value.address.country,postalCode:ce.stripeAddressEventData.value.address.postal_code,state:ce.stripeAddressEventData.value.address.state}}if(ce.stripeBillingAddressEventData){ce.stripeBillingAddressUsedWhenFetchingLC={countryCode:ce.stripeBillingAddressEventData.value.address.country,postalCode:ce.stripeBillingAddressEventData.value.address.postal_code,state:ce.stripeBillingAddressEventData.value.address.state}}if(ce.stripeLinkEventData){ce.stripeLinkUsedWhenFetchingLC=Object.assign({},ce.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);pr();return[4,Ie()];case 2:w.sent();d=(n=Ze.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Ze.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){ir({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:f=w.sent();Ze.landedCostData=[];Ze.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3,6];if(!(i<1))return[3,5];return[4,Te(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=ce.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3,7];case 7:ce.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,Te({applyingPromocode:true})];case 1:o.sent();if(Ze.step==="payment"){wr()}return[4,_e()];case 2:o.sent();n=(e=Ze.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2]}return[4,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2]}}))}))}));var Ee=e("Q",(function(){Ze.promoCode="";sessionStorage.removeItem("zonos--promo-code");Ze.promoCodeError=false;Ze.promoCodeApplied=false}));var Ne=e("P",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(Ze.step==="payment"){wr()}Ee();return[4,Pe()];case 1:e.sent();return[2]}}))}))}));var je=e("R",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;switch(e){case"succeeded":{r=[o("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",o("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));var De=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3,2];return[4,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!u.available||u.status===204){return[2,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){ce.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4,t({items:Ze.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Ze.items}});throw l;case 6:return[2]}}))}))}));var Le=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2]}return[4,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var xe=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=je(f),n=r.isError,t=r.messages;return[2,{error:n,messages:t}]}i=c||ce.clientSecret;if(!ce.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[o("Something went wrong.")]}]}if(!i.includes("_secret_")){return[2,{error:true,messages:[o("Something went wrong.")]}]}return[4,ce.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=je(s),d=u.isError,l=u.messages;return[2,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("C",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=ce.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=ce.stripeElements;s=ce.stripe;u=ce.clientSecret;ce.customErrorMessage=null;if(!((n=Ze.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,oe()];case 1:l=h.sent();if(!l.valid){ce.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void ee({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var Ue=function(){if(!M.accepted){return null}var e=q();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({acceptedAt:M.acceptedAt||(new Date).toISOString(),locale:i.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};var ze=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(se).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var Be=e("n",(function(){var e;var r=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Ze.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:i.selectedLocale}],paymentProcessor:ze(),presentmentCountryCode:i.selectedCountryCode,skipPaymentIntent:ce.skipPaymentIntent,varianceTestInput:n};return o}));var Fe=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}return[4,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2]}sr(i.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var Je=e("j",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,a,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!i.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}ce.isFetchingSession=true;n=Be();d("Checkout session body","info",n);return[4,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,a=t.json;ce.isFetchingSession=false;if(o.length||!a){s=(e=o.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2,false]}u=a.checkoutSessionCreate;sr(u);ir({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Ze.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var Me=e("x",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){v("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:ce.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==ce.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var qe=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,a;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:ce.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Ze.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:i.selectedLocale}],presentmentCountryCode:m,shipToPartyId:ce.partyShippingId,skipPaymentIntent:ce.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:a}]}return[2,{errors:[],json:a}]}}))}))};var We=e("J",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=Ue();if(!e){return[2,{errors:[]}]}if(!t.checkoutSessionId){return[2,{errors:[]}]}return[4,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2,{errors:[]}]}}))}))}));var Ye=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};var He=e("U",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=ne({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:ce.stripeAddressEventData,stripeBillingAddressEventData:ce.stripeBillingAddressEventData,stripeShippingSameAsBilling:ce.stripeShippingSameAsBilling});if(!i){ce.translatedAddress={address:{},billingAddress:{}};return[2]}a=ye();if(!a){return[2]}return[4,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));ce.translatedAddress={address:{},billingAddress:{}};return[2]}ce.stripeAddressUsedWhenValidatingAddress=ce.stripeAddressEventData;ce.stripeBillingAddressUsedWhenValidatingAddress=ce.stripeBillingAddressEventData;l=(r=ce.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=ce.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;ce.translatedAddress={address:l?Ye({currentAddress:Object.assign(Object.assign({},l),{name:(t=ce.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!ce.stripeShippingSameAsBilling?Ye({currentAddress:Object.assign(Object.assign({},f),{name:(o=ce.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2]}}))}))}));de("clientSecret",(function(e){if(e&&ce.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var Ke=e("N",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ge.onChange,Xe=Ge.reset,Ze=Ge.state;e({G:Ve,d:Ze});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};var $e=e("X",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var er=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};var rr=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Ze.items.find((function(r){return er({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Ze.restrictedItems=r;Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return er({item1:r,item2:e})}))})}));return{cartItems:Ze.items,restrictedItems:r}};var nr=null;var tr=e("f",(function(){t.checkoutSessionId=null;if(nr){clearTimeout(nr);nr=null}I();Xe()}));var or=e("o",(function(e){var r=e.messages,n=e.title;tr();we();Ze.step="error";Ze.error={messages:r,title:n}}));var ir=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;Ze.exchangeRate=t.exchangeRate;Ze.adjustmentTotal=t.adjustments;Ze.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Ze.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Ze.subtotal=t.items;Ze.total=t.total;Ze.currency=t.presentmentCurrencyCode;Ze.dutiesTaxesFeesEstimate=r||null};var ar=e("M",(function(){var e=Ze.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var sr=e("r",(function(e){var r,n,o,i,a,c,v;ce.clientSecret=e.clientSecret;ce.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;ce.customerProfile=e.customerProfile;Ze.checkoutSession=e;T((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var f=s(e.varianceTestResults||[]);u(f);var p=((a=(i=(o=Ze.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||((v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Ze.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,a,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Ze.selectedLandedCost){n=Ze.selectedLandedCost.subtotals;ir({dutiesTaxesFeesEstimate:m,method:Ze.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,qe({adjustmentsAmount:c,billToPartyId:ce.partyBillingId,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:i.selectedCountryCode,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];v("Error occurs when updating checkout session.");if(!y)return[3,3];d("Initiating checkout session on failure","info");return[4,Je()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){or({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){ir({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Ze.exchangeRate)}sr(u.checkoutSessionUpdate);return[2,true]}}))}))};var dr=e("Y",(function(e,r){var t,o,i,a;if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=ce.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}if(Ke({deliveryType:r,landedCost:e,shipToCountry:(a=ce.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("L",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,A,O,C,k,I,T,P;var E=e.applySubtotalsOnly,N=e.landedCostId,j=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:N,selectedShippingOption:j});Ze.selectedShippingOption=j;h=$e(Ze.selectedShippingOption);if(h){w=h.maxTransit,y=h.minTransit,g=h.unit;Ze.selectedShippingOptionTransitTime="".concat(y,"-").concat(w," ").concat(g)}else{Ze.selectedShippingOptionTransitTime=""}b=(r=Ze.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===N}));Ze.selectedLandedCost=b||null;if(!b){return[2,false]}_=((o=b.landedCost.amountSubtotals)===null||o===void 0?void 0:o.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;A=_*S;if(A){d("DAP quote, using estimate: ".concat(A),"info")}Ze.landedCostMethod=dr(b.landedCost,(i=j.shippingProfile)===null||i===void 0?void 0:i.serviceLevel.deliveryType);Ze.shipping=b.subtotals.shipping;O=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Ze.isSelectedShippingAboveDeminimis=C;Ze.isSelectedShippingGuarantee=O;k=false;if(!E)return[3,1];I=b.subtotals;ir({dutiesTaxesFeesEstimate:A,method:Ze.landedCostMethod,subtotals:I});d("Exchange rate updated for cart items (landed cost subtotal)","info",Ze.exchangeRate);k=true;return[3,3];case 1:return[4,ur({adjustmentsAmount:Ze.adjustmentTotal,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:A,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:ce.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 2:k=e.sent();e.label=3;case 3:T=(c=Ze.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;P=((v=ce.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";ce.shouldRenderPayInUsdButton=T==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=Ze.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((m=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||m===void 0?void 0:m.includes(P));return[2,k]}}))}))}));var cr=e("m",(function(e){var r=e.isPreview,n=e.sessionTimeout;if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Ze.checkoutTimeoutInterval=setTimeout((function(){Ze.checkoutSessionTimeoutShow=true}),o)}));var vr=e("h",(function(){if(Ze.checkoutTimeoutInterval){clearTimeout(Ze.checkoutTimeoutInterval);Ze.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){Ze.items=Ze.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Ze.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var a=e.adjustments,s=e.cartItems,u=e.landedCostId,d=e.shouldInitSessionOnFailure,l=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:Ze.adjustments=a;Ze.items=fr(s);n=(r=s.find(Boolean))===null||r===void 0?void 0:r.currencyCode;o=s.reduce((function(e,r){return e+r.amount*r.quantity}),0);i=a.reduce((function(e,r){return e+r.amount}),0);if(!n||!o){return[2]}Ze.currency=n;ce.isFetchingSession=true;return[4,ur({adjustmentsAmount:i,billToPartyId:ce.partyBillingId,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:u,shipToPartyId:ce.partyShippingId,shouldInitSessionOnFailure:l,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();ce.isFetchingSession=false;return[2]}}))}))}));var hr=function(){Ze.selectedShippingOption=null;Ze.isSelectedShippingAboveDeminimis=false;Ze.isSelectedShippingGuarantee=false;Ze.selectedShippingOptionTransitTime="";Ze.dutiesTaxesFees=0;Ze.dutiesTaxesFeesEstimate=0;Ze.shipping=0;Ze.total=Ze.subtotal};var wr=function(){if(Ze.step==="shipping"){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="payment"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})})}else if(Ze.step==="finish"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false})})}};var yr=e("v",(function(){if(Ze.step==="customer-info"){Ze.step="shipping";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:true})})}else if(Ze.step==="shipping"){Ze.step="payment";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:true})})}else if(Ze.step==="payment"){Ze.step="finish"}}));var gr=e("g",(function(){Ze.step="customer-info";Ze.tabItems=Object.assign(Object.assign({},Ze.tabItems),{"customer-info":Object.assign(Object.assign({},Ze.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Ze.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Ze.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,a,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2]}n=Ze.selectedLandedCost;o=Ze.currency||((e=Ze.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";a=Ze.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Ze.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4,qe({adjustmentsAmount:a,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:i.selectedCountryCode,storeCreditApplication:L()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2]}ir({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2]}}))}))};var _r=e("a1",(function(){if(nr){clearTimeout(nr)}nr=setTimeout((function(){nr=null;void br()}),300)}))}}}));
@@ -1 +1 @@
1
- import{c as e,z as o}from"./p-9a417eeb.js";import{b as a,K as t,d as s,L as d}from"./p-67b2e46c.js";import{s as n}from"./p-3f8f4c78.js";import{h as r,s as i,l}from"./p-41dd1cb8.js";import{b as c}from"./p-0a377722.js";const{state:p}=e((()=>({amountTotalDue:null,isFetchingPayorInfo:!0,landedCostShortId:null,partyBillingId:null,payorAddress:null}))),u=async({landedCostId:e,retries:a=5})=>{var t,d,n;p.isFetchingPayorInfo=!0;const l=await r("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:e},method:"POST"});if(l.errors.length)return a>0?(await new Promise((e=>setTimeout(e,1e3))),u({landedCostId:e,retries:a-1})):null;p.landedCostShortId=(null===(t=l.json)||void 0===t?void 0:t.landedCostShortId)||null,p.isFetchingPayorInfo=!1,p.payorAddress=(null===(d=l.json)||void 0===d?void 0:d.payor)||null;const c=null===(n=s.checkoutSession)||void 0===n?void 0:n.subtotals;p.amountTotalDue=(null==c?void 0:c.items)||0,0===p.amountTotalDue&&i({endpoint:"INVOICE_NO_TOTAL_DUE",errors:[],metadata:{landedCostId:e,organizationId:o.organizationId}})},I=async()=>{var e,o,d,u;if(!(null===(e=a.stripeBillingAddressEventData)||void 0===e?void 0:e.complete))return{partiesCreated:!1};const I=null===(d=null===(o=s.checkoutSession)||void 0===o?void 0:o.landedCost)||void 0===d?void 0:d.rootId;if(!I)return i({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:n.checkoutSessionId}}),{partiesCreated:!1};if(!n.checkoutSessionId)return i({endpoint:"INVOICE_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:I}}),{partiesCreated:!1};const m=t({address:a.stripeBillingAddressEventData.value.address,firstName:a.stripeBillingAddressEventData.value.firstName,lastName:a.stripeBillingAddressEventData.value.lastName,name:a.stripeBillingAddressEventData.value.name,phone:a.stripeBillingAddressEventData.value.phone}),C="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:O,json:v}=await r("/api/zonos-elements/create-billing-party",{body:{billingAddress:m,checkoutSessionId:n.checkoutSessionId,companyName:a.companyName,email:(null===(u=a.stripeLinkEventData)||void 0===u?void 0:u.value.email)||"",isTest:C,rootId:I},method:"POST"});return O.length||!v?(l("Error occurs when creating billing party",JSON.stringify(O,null,2)),i({endpoint:"INVOICE_BILLING_PARTY_CREATE_FAILED",errors:["[INVOICE] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:n.checkoutSessionId,errors:O,json:v}}),{partiesCreated:!1}):(p.partyBillingId=v.billToPartyId,{partiesCreated:!0})},m=async e=>{const o=e.landedCost;return!!o&&(s.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},o),landedCostId:o.id})],d({applySubtotalsOnly:!0,landedCostId:o.id,selectedShippingOption:o.shipmentRating}))};export{u as a,I as b,p as c,m as i}
1
+ import{c as e,z as o}from"./p-9a417eeb.js";import{b as a,K as t,d as s,L as d}from"./p-8051403a.js";import{s as n}from"./p-9448d960.js";import{h as r,s as i,l}from"./p-41dd1cb8.js";import{b as c}from"./p-0a377722.js";const{state:p}=e((()=>({amountTotalDue:null,isFetchingPayorInfo:!0,landedCostShortId:null,partyBillingId:null,payorAddress:null}))),u=async({landedCostId:e,retries:a=5})=>{var t,d,n;p.isFetchingPayorInfo=!0;const l=await r("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:e},method:"POST"});if(l.errors.length)return a>0?(await new Promise((e=>setTimeout(e,1e3))),u({landedCostId:e,retries:a-1})):null;p.landedCostShortId=(null===(t=l.json)||void 0===t?void 0:t.landedCostShortId)||null,p.isFetchingPayorInfo=!1,p.payorAddress=(null===(d=l.json)||void 0===d?void 0:d.payor)||null;const c=null===(n=s.checkoutSession)||void 0===n?void 0:n.subtotals;p.amountTotalDue=(null==c?void 0:c.items)||0,0===p.amountTotalDue&&i({endpoint:"INVOICE_NO_TOTAL_DUE",errors:[],metadata:{landedCostId:e,organizationId:o.organizationId}})},I=async()=>{var e,o,d,u;if(!(null===(e=a.stripeBillingAddressEventData)||void 0===e?void 0:e.complete))return{partiesCreated:!1};const I=null===(d=null===(o=s.checkoutSession)||void 0===o?void 0:o.landedCost)||void 0===d?void 0:d.rootId;if(!I)return i({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:n.checkoutSessionId}}),{partiesCreated:!1};if(!n.checkoutSessionId)return i({endpoint:"INVOICE_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:c,cartId:window.Zonos.cartId,landedCostRootId:I}}),{partiesCreated:!1};const m=t({address:a.stripeBillingAddressEventData.value.address,firstName:a.stripeBillingAddressEventData.value.firstName,lastName:a.stripeBillingAddressEventData.value.lastName,name:a.stripeBillingAddressEventData.value.name,phone:a.stripeBillingAddressEventData.value.phone}),C="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:O,json:v}=await r("/api/zonos-elements/create-billing-party",{body:{billingAddress:m,checkoutSessionId:n.checkoutSessionId,companyName:a.companyName,email:(null===(u=a.stripeLinkEventData)||void 0===u?void 0:u.value.email)||"",isTest:C,rootId:I},method:"POST"});return O.length||!v?(l("Error occurs when creating billing party",JSON.stringify(O,null,2)),i({endpoint:"INVOICE_BILLING_PARTY_CREATE_FAILED",errors:["[INVOICE] Failed to create billing party"],metadata:{allLogs:c,cartId:window.Zonos.cartId,checkoutSessionId:n.checkoutSessionId,errors:O,json:v}}),{partiesCreated:!1}):(p.partyBillingId=v.billToPartyId,{partiesCreated:!0})},m=async e=>{const o=e.landedCost;return!!o&&(s.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},o),landedCostId:o.id})],d({applySubtotalsOnly:!0,landedCostId:o.id,selectedShippingOption:o.shipmentRating}))};export{u as a,I as b,p as c,m as i}
@@ -0,0 +1 @@
1
+ import{d as r}from"./p-8051403a.js";import{s as o}from"./p-9448d960.js";import{l as s,h as e}from"./p-41dd1cb8.js";const t=async()=>{var t,i;const d=null===(t=r.partiesData.find((r=>"DESTINATION"===r.type)))||void 0===t?void 0:t.id,n=null===(i=r.partiesData.find((r=>"PAYOR"===r.type)))||void 0===i?void 0:i.id,a=o.checkoutSessionId;if(!a||!n||!d)return s("Missing required data",{billToPartyId:n,checkoutSessionId:a,shipToPartyId:d}),{errors:["Missing required data"],json:null};const l={billToPartyId:n,checkoutSessionId:a,shipToPartyId:d},{errors:c,json:p}=await e("/api/zonos-elements/place-test-order",{body:l,method:"POST"});return c.length||!p?(s("Error occurs when placing test order",c),{errors:c.map((r=>r.message)),json:null}):{errors:[],json:p}};export{t as p}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,n){function i(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function r(e){try{a(n.next(e))}catch(e){s(e)}}function l(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?t(e.value):i(e.value).then(r,l)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function l(e){return function(o){return a([e,o])}}function a(l){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,l[0]&&(t=0)),t)try{if(n=1,i&&(s=l[0]&2?i["return"]:l[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;if(i=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:t.label++;return{value:l[1],done:false};case 5:t.label++;i=l[1];l=[0];continue;case 7:l=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1];s=l;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(l);break}if(s[2])t.ops.pop();t.trys.pop();continue}l=o.call(e,t)}catch(e){l=[6,e];i=0}finally{n=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-496accce.system.js","./p-fd2d4d04.system.js","./p-47a1d469.system.js","./p-23e7c655.system.js","./p-01174496.system.js","./p-bc7bf53e.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var o,t,n,i,s,r,l,a,h,d,u,c,f,w,m,v,z,g,p,b,x,y,k;return{setters:[function(e){o=e.r;t=e.h;n=e.a;i=e.g},function(e){s=e.d},function(e){r=e.l;l=e.k;a=e.t;h=e.g;d=e.n;u=e.o;c=e.p;f=e.q;w=e.h;m=e.r},function(e){v=e.z;z=e.g;g=e.m},function(e){p=e.c},function(e){b=e.h;x=e.l},function(e){y=e.g},function(e){k=e.l}],execute:function(){var _=this;var O=function(e){return __awaiter(_,[e],void 0,(function(e){var o,t,n,i,s;var r=e.items,l=e.shipFrom,a=e.shipTo;return __generator(this,(function(e){switch(e.label){case 0:t={items:r,shipFrom:l,shipTo:a};return[4,b("/api/zonos-elements/check-item-restrictions",{body:t,method:"POST"})];case 1:n=e.sent(),i=n.errors,s=n.json;if(i.length||!s){x("Error fetching item restrictions: ".concat((o=i.find(Boolean))===null||o===void 0?void 0:o.message));return[2,[]]}return[2,s.filter(Boolean)]}}))}))};var L=function(e){return __awaiter(_,void 0,void 0,(function(){var o,t,n,i;return __generator(this,(function(s){switch(s.label){case 0:if(!e.length){return[2,[]]}o=r.selectedCountryCode;if(!o){x("Hello could not check item restrictions - No country code selected");return[2,[]]}t=e.map((function(e){return{description:e.description,name:e.title}}));return[4,O({items:t,shipFrom:"AD",shipTo:o})];case 1:n=s.sent();i=n.map((function(e){var o;var n=((o=t.filter((function(o){return o.description===e.itemDescription})).find(Boolean))===null||o===void 0?void 0:o.name)||"";return Object.assign(Object.assign({},e),{name:n})}));return[2,i]}}))}))};var T=function(e){var o=e===null||e===void 0?void 0:e.replace("www.","").replace("https://","");return o&&new RegExp(o).test(window.location.href)};var j=function(){var e=v.helloSettings,o=e.cartUrlPattern,t=e.homepageUrlPattern,n=e.productDetailUrlPattern,i=e.productListUrlPattern;if(T(o)){return"cart"}if(T(n)){return"productDetail"}if(T(i)){return"productList"}if(T(t)){return"home"}return""};var D=18;var E=18;var I=64;var S=function(e){if(e==null||!Number.isFinite(e)||e<=0){return D}return Math.min(I,Math.max(E,e))};var X=function(){var e,o;var t=v.helloSettings,n=t.productAddToCartElementSelector,i=t.productDescriptionElementSelector,s=t.productTitleElementSelector,r=t.restrictionBehavior;if(!s||!i){k("Hello could not check item restrictions - must provide title and description selectors.")}var a=s&&l(s)&&document.querySelectorAll(s)||[];var h=i&&l(i)&&document.querySelectorAll(i)||[];if(a.length!==h.length){k("Hello could not check item restrictions - Title and description selectors do not match");return[]}var d=r==="RESTRICT_AND_BLOCK";var u=d&&n&&l(n)&&document.querySelectorAll(n)||[];if(d&&u.length!==h.length){k('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match')}var c=[];for(var f=0;f<a.length;f++){var w=a[f];var m=h[f];var z=u[f];if(w&&m){var g={cartButtonNode:z||null,description:((e=m.textContent)===null||e===void 0?void 0:e.trim())||"",title:((o=w.textContent)===null||o===void 0?void 0:o.trim())||""};c.push(g)}}return c};var C=":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:inline-block;--zonos-elements-hello-widget-size:18px;--zonos-elements-hello-bubble-padding:max(\n 6px,\n calc(var(--zonos-elements-hello-widget-size) * 0.22)\n );--zonos-elements-hello-bubble-size:calc(\n var(--zonos-elements-hello-widget-size) +\n var(--zonos-elements-hello-bubble-padding) * 2 + 2px\n )}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}@media screen and (min-width: 769px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px;width:auto;height:auto;z-index:1001}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:var(--zonos-elements-hello-bubble-padding);border-radius:9999px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);border-bottom-left-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);left:0;-webkit-transform:translateX(calc(-100% + var(--zonos-elements-hello-bubble-size) / 2));transform:translateX(calc(-100% + var(--zonos-elements-hello-bubble-size) / 2));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 calc(var(--zonos-elements-hello-bubble-size) / 2);border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:calc(var(--zonos-elements-hello-bubble-size) / 2);border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - var(--zonos-elements-hello-bubble-size) / 2));transform:translateX(calc(100% - var(--zonos-elements-hello-bubble-size) / 2));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);border-bottom-right-radius:calc(var(--zonos-elements-hello-bubble-size) / 2)}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center;height:var(--zonos-elements-hello-widget-size);width:var(--zonos-elements-hello-widget-size)}:host .zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}";var B=C;var M=3e3;var R=e("zonos_hello",function(){function e(e){var t=this;o(this,e);this.showPeekMessage=false;this.zonosStoreHelloSettings=v.helloSettings;this.showDialog=false;this.peekMessage="";this.initialUrl="";this.allRestrictedItems=[];this.allFoundProducts=[];this.productsOnPage=[];this.isHelloWidgetRendered=false;this.isMobile=false;this.getHelloPeekMessage=function(e){var o=v.currentHelloPage==="productDetail"||v.currentHelloPage==="productList";if(o&&t.allRestrictedItems.length){var n=a("click to learn more");var i=v.currentHelloPage==="productDetail"?a("Restricted item"):a("Restricted items found");return"".concat(i," - ").concat(n)}switch(v.currentHelloPage){case"cart":return a("Prepay duties and taxes at checkout");case"productList":case"productDetail":return a("See duty and tax thresholds");default:return a("Welcome to [storeName]",{storeName:e})}};this.enableShowPeekMessage=function(){if(t.peekMessage){t.showPeekMessage=true}};this.getNewItemRestrictions=function(e){return __awaiter(t,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:o=v.currentHelloPage==="productDetail"||v.currentHelloPage==="productList";if(!o||v.helloSettings.restrictionBehavior==="DISABLED"){return[2,[]]}return[4,L(e)];case 1:t=n.sent();return[2,t]}}))}))};this.triggerShowPeekMessage=function(){t.peekMessage=t.getHelloPeekMessage(v.organizationName);var e=v.helloSettings,o=e.peekMessageBehavior,n=e.peekMessageDelay;var i=n*1e3;if(o==="ENABLED"){setTimeout((function(){t.enableShowPeekMessage();var e=t.allRestrictedItems.some((function(e){return t.productsOnPage.some((function(o){return o.description===e.itemDescription}))}));if(!e){setTimeout((function(){t.showPeekMessage=false}),M)}}),i)}};this.disableAddToCartButtons=function(){if(t.productsOnPage.length){t.productsOnPage.forEach((function(e){var o,n;var i=t.allRestrictedItems.some((function(o){return o.itemDescription===e.description}));if(i){(o=e.cartButtonNode)===null||o===void 0?void 0:o.setAttribute("disabled","disabled")}else{(n=e.cartButtonNode)===null||n===void 0?void 0:n.removeAttribute("disabled")}}))}};this.handleItemRestrictions=function(){return __awaiter(t,void 0,void 0,(function(){var e,o;var t,n;var i=this;return __generator(this,(function(s){switch(s.label){case 0:this.productsOnPage=X();e=this.productsOnPage.filter((function(e){return!i.allFoundProducts.some((function(o){return o.title===e.title}))}));return[4,this.getNewItemRestrictions(e)];case 1:o=s.sent();(t=this.allRestrictedItems).push.apply(t,o);(n=this.allFoundProducts).push.apply(n,e);this.disableAddToCartButtons();return[2]}}))}))};this.reloadHelloData=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleItemRestrictions()];case 1:e.sent();this.triggerShowPeekMessage();return[2]}}))}))};this.handleProductCountChange=s((function(){var e=v.helloSettings.productTitleElementSelector;if(e){var o=X();if(t.allFoundProducts.length!==o.length&&window.location.href===t.initialUrl){if(!t.allFoundProducts.length){return}void t.reloadHelloData()}}}),1e3);this.watchProductCountChange=function(){var e;var o=new MutationObserver(t.handleProductCountChange);o.observe(document.body,{childList:true,subtree:true});(e=t.observerWatcher)===null||e===void 0?void 0:e.push(o)};this.watchPriceChange=function(){var e;var o=new MutationObserver((function(){return void t.displayCurrency()}));o.observe(document.body,{attributes:true,childList:true,subtree:true});(e=t.observerWatcher)===null||e===void 0?void 0:e.push(o)};this.updateHelloOnPageChange=function(){t.watchProductCountChange();setInterval((function(){if(window.location.href!==t.initialUrl){var e=t.initialUrl&&new URL(t.initialUrl);var o=e&&h(e.searchParams);if(o!==r.selectedCountryCode){t.allFoundProducts=[];t.allRestrictedItems=[];t.productsOnPage=[]}t.initialUrl=window.location.href;v.currentHelloPage=j();var n=new URL(window.location.href);var i=h(n.searchParams);if(!i){d(r.selectedCountryCode);return}void t.reloadHelloData()}}),1e3)};this.changeShowDialog=function(e){t.showDialog=e};this.shouldAnimateLeftDesktop=function(){var e=t.helloRef&&getComputedStyle(t.helloRef).position;if(t.helloRef&&e==="relative"){var o=y(t.helloRef);return o}}}e.prototype.showDialogHandler=function(e){var o;if(e){var t=(o=this.helloElement)===null||o===void 0?void 0:o.parentElement;if(t&&t.parentElement===document.body){t.style.zIndex="2147483647";document.body.appendChild(t)}}};e.prototype.getCountryList=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,r.helloCountryList]}))}))};e.prototype.componentWillLoad=function(){var e=this;var o=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.helloRef){return[2]}if(v.loadedConfig){this.helloRef.setAttribute("data-zonos-hello-loaded","");this.updateHelloOnPageChange();this.watchPriceChange();this.handleAppearanceSettingsOverrideChange();clearInterval(o)}return[2]}))}))}),100)};e.prototype.disconnectedCallback=function(){var e;(e=this.observerWatcher)===null||e===void 0?void 0:e.forEach((function(e){return e.disconnect()}))};e.prototype.displayCurrency=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(v.helloSettings.currencyBehavior==="DISABLED"){return[2]}if(!r.exchangeRate){k("Could not display currency. Exchange rate and format data is not available.","warn");return[2]}u();return[2]}))}))};e.prototype.convertAndFormat=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,c(e)]}))}))};e.prototype.convert=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,f(e)]}))}))};e.prototype.format=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,w({amount:e})]}))}))};e.prototype.openHelloDialog=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){this.changeShowDialog(e);return[2]}))}))};e.prototype.handleResize=function(){this.isMobile=window.innerWidth<=768};e.prototype.handleHelloWidgetInitializedState=function(e){var o=e.countryCode,t=e.currencyCode;var n,i;if(this.isHelloWidgetRendered){return}if(r.selectedCountryCode&&typeof v.helloSettings.onInitSuccess==="function"){this.isHelloWidgetRendered=true;void((i=(n=v.helloSettings).onInitSuccess)===null||i===void 0?void 0:i.call(n,{countryCode:o,currencyCode:t}))}};e.prototype.getHelloLocation=function(){var e=this.mobileLocationOverride||v.helloSettings.mobileLocation;var o=this.desktopLocationOverride||v.helloSettings.desktopLocation;var t=this.isMobile;switch(true){case t:{var n=this.animateFromLeftOverride||(e===null||e===void 0?void 0:e.includes("LEFT"));var i=e===null||e===void 0?void 0:e.includes("TOP");return{isMobileWindow:t,isOnLeft:n,isOnTop:i,shouldFloat:!!e}}default:case!t:{var s=!!this.desktopLocationOverride||!v.helloSettings.anchorElementSelector&&!!o;var n=this.animateFromLeftOverride||(o?o.includes("LEFT"):this.shouldAnimateLeftDesktop());var i=o===null||o===void 0?void 0:o.includes("TOP");return{isMobileWindow:t,isOnLeft:n,isOnTop:i,shouldFloat:s}}}};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=z(this.appearanceSettingsOverride.theme)}};e.prototype.componentDidLoad=function(){this.isMobile=window.innerWidth<=768};e.prototype.render=function(){var e=this;var o,i;var s=(o=v.helloSettings.excludedUrlPatterns)===null||o===void 0?void 0:o.some((function(e){return e&&new RegExp(e).test(window.location.href)}));if(s){k("Hello is excluded on this url","warn");return null}var l=r.selectedCountryCode,a=r.targetCurrency;var h=this.getHelloLocation(),d=h.isOnLeft,u=h.isOnTop,c=h.shouldFloat;var f=g(v.appearance,this.appearanceSettingsOverride||null);var w=f.theme;var z=(i=this.allRestrictedItems)===null||i===void 0?void 0:i.filter((function(o){return e.productsOnPage.some((function(e){return e.description===o.itemDescription}))}));this.peekMessage=this.getHelloPeekMessage(v.organizationName);var b=m()&&!!l;if(b&&!this.isHelloWidgetRendered){this.handleHelloWidgetInitializedState({countryCode:l,currencyCode:a})}var x=S(v.helloSettings.widgetSize);return t(n,{class:"zonos--hello zonos--elements","data-theme":w,style:{"--zonos-elements-hello-widget-size":"".concat(x,"px")}},b&&t("div",{class:p(["zonos--hello-wrapper",c&&"zonos--hello-widget-float"])},t("button",{class:p(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",d&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",u&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions",c&&"zonos--hello-widget-float"]),onClick:function(){void e.changeShowDialog(!e.showDialog)},onMouseEnter:function(){return e.enableShowPeekMessage()},onMouseLeave:function(){return e.showPeekMessage=false},ref:function(o){return o&&(e.helloRef=o)},type:"button"},t("zonos-text",{class:"zonos--hello-message"},this.peekMessage),l&&t("div",{class:"zonos--hello-country-flag-wrapper"},t("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:l}))),t("div",{class:p(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override",d&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",u&&"zonos--hello-widget-top",c&&"zonos--hello-widget-float"]),style:{height:this.showDialog?"fit-content":"0px"}},t("zonos-hello-dialog",{animateFromLeftOverride:d,appearanceSettings:f,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:z,setIsOpen:this.changeShowDialog}))))};Object.defineProperty(e.prototype,"helloElement",{get:function(){return i(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{showDialog:["showDialogHandler"],appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}},enumerable:false,configurable:true});return e}());R.style=B}}}));
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,n){function i(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function r(e){try{a(n.next(e))}catch(e){s(e)}}function l(e){try{a(n["throw"](e))}catch(e){s(e)}}function a(e){e.done?t(e.value):i(e.value).then(r,l)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,r;return r={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function l(e){return function(o){return a([e,o])}}function a(l){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,l[0]&&(t=0)),t)try{if(n=1,i&&(s=l[0]&2?i["return"]:l[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;if(i=0,s)l=[l[0]&2,s.value];switch(l[0]){case 0:case 1:s=l;break;case 4:t.label++;return{value:l[1],done:false};case 5:t.label++;i=l[1];l=[0];continue;case 7:l=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){t.label=l[1];break}if(l[0]===6&&t.label<s[1]){t.label=s[1];s=l;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(l);break}if(s[2])t.ops.pop();t.trys.pop();continue}l=o.call(e,t)}catch(e){l=[6,e];i=0}finally{n=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-496accce.system.js","./p-c345d1f5.system.js","./p-47a1d469.system.js","./p-23e7c655.system.js","./p-01174496.system.js","./p-bc7bf53e.system.js","./p-d938f42f.system.js"],(function(e){"use strict";var o,t,n,i,s,r,l,a,h,d,u,c,f,w,m,v,z,g,p,b,x,y,k;return{setters:[function(e){o=e.r;t=e.h;n=e.a;i=e.g},function(e){s=e.d},function(e){r=e.l;l=e.k;a=e.t;h=e.g;d=e.n;u=e.o;c=e.p;f=e.q;w=e.h;m=e.r},function(e){v=e.z;z=e.g;g=e.m},function(e){p=e.c},function(e){b=e.h;x=e.l},function(e){y=e.g},function(e){k=e.l}],execute:function(){var _=this;var O=function(e){return __awaiter(_,[e],void 0,(function(e){var o,t,n,i,s;var r=e.items,l=e.shipFrom,a=e.shipTo;return __generator(this,(function(e){switch(e.label){case 0:t={items:r,shipFrom:l,shipTo:a};return[4,b("/api/zonos-elements/check-item-restrictions",{body:t,method:"POST"})];case 1:n=e.sent(),i=n.errors,s=n.json;if(i.length||!s){x("Error fetching item restrictions: ".concat((o=i.find(Boolean))===null||o===void 0?void 0:o.message));return[2,[]]}return[2,s.filter(Boolean)]}}))}))};var L=function(e){return __awaiter(_,void 0,void 0,(function(){var o,t,n,i;return __generator(this,(function(s){switch(s.label){case 0:if(!e.length){return[2,[]]}o=r.selectedCountryCode;if(!o){x("Hello could not check item restrictions - No country code selected");return[2,[]]}t=e.map((function(e){return{description:e.description,name:e.title}}));return[4,O({items:t,shipFrom:"AD",shipTo:o})];case 1:n=s.sent();i=n.map((function(e){var o;var n=((o=t.filter((function(o){return o.description===e.itemDescription})).find(Boolean))===null||o===void 0?void 0:o.name)||"";return Object.assign(Object.assign({},e),{name:n})}));return[2,i]}}))}))};var T=function(e){var o=e===null||e===void 0?void 0:e.replace("www.","").replace("https://","");return o&&new RegExp(o).test(window.location.href)};var j=function(){var e=v.helloSettings,o=e.cartUrlPattern,t=e.homepageUrlPattern,n=e.productDetailUrlPattern,i=e.productListUrlPattern;if(T(o)){return"cart"}if(T(n)){return"productDetail"}if(T(i)){return"productList"}if(T(t)){return"home"}return""};var D=18;var E=18;var I=64;var S=function(e){if(e==null||!Number.isFinite(e)||e<=0){return D}return Math.min(I,Math.max(E,e))};var X=function(){var e,o;var t=v.helloSettings,n=t.productAddToCartElementSelector,i=t.productDescriptionElementSelector,s=t.productTitleElementSelector,r=t.restrictionBehavior;if(!s||!i){k("Hello could not check item restrictions - must provide title and description selectors.")}var a=s&&l(s)&&document.querySelectorAll(s)||[];var h=i&&l(i)&&document.querySelectorAll(i)||[];if(a.length!==h.length){k("Hello could not check item restrictions - Title and description selectors do not match");return[]}var d=r==="RESTRICT_AND_BLOCK";var u=d&&n&&l(n)&&document.querySelectorAll(n)||[];if(d&&u.length!==h.length){k('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match')}var c=[];for(var f=0;f<a.length;f++){var w=a[f];var m=h[f];var z=u[f];if(w&&m){var g={cartButtonNode:z||null,description:((e=m.textContent)===null||e===void 0?void 0:e.trim())||"",title:((o=w.textContent)===null||o===void 0?void 0:o.trim())||""};c.push(g)}}return c};var C=":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:inline-block;--zonos-elements-hello-widget-size:18px;--zonos-elements-hello-bubble-padding:max(\n 6px,\n calc(var(--zonos-elements-hello-widget-size) * 0.22)\n );--zonos-elements-hello-bubble-size:calc(\n var(--zonos-elements-hello-widget-size) +\n var(--zonos-elements-hello-bubble-padding) * 2 + 2px\n )}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}@media screen and (min-width: 769px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px;width:auto;height:auto;z-index:1001}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:var(--zonos-elements-hello-bubble-padding);border-radius:9999px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);border-bottom-left-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);left:0;-webkit-transform:translateX(calc(-100% + var(--zonos-elements-hello-bubble-size) / 2));transform:translateX(calc(-100% + var(--zonos-elements-hello-bubble-size) / 2));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 calc(var(--zonos-elements-hello-bubble-size) / 2);border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:calc(var(--zonos-elements-hello-bubble-size) / 2);border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - var(--zonos-elements-hello-bubble-size) / 2));transform:translateX(calc(100% - var(--zonos-elements-hello-bubble-size) / 2));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:calc(var(--zonos-elements-hello-bubble-size) / 2);border-bottom-right-radius:calc(var(--zonos-elements-hello-bubble-size) / 2)}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center;height:var(--zonos-elements-hello-widget-size);width:var(--zonos-elements-hello-widget-size)}:host .zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}";var B=C;var M=3e3;var R=e("zonos_hello",function(){function e(e){var t=this;o(this,e);this.showPeekMessage=false;this.zonosStoreHelloSettings=v.helloSettings;this.showDialog=false;this.peekMessage="";this.initialUrl="";this.allRestrictedItems=[];this.allFoundProducts=[];this.productsOnPage=[];this.isHelloWidgetRendered=false;this.isMobile=false;this.getHelloPeekMessage=function(e){var o=v.currentHelloPage==="productDetail"||v.currentHelloPage==="productList";if(o&&t.allRestrictedItems.length){var n=a("click to learn more");var i=v.currentHelloPage==="productDetail"?a("Restricted item"):a("Restricted items found");return"".concat(i," - ").concat(n)}switch(v.currentHelloPage){case"cart":return a("Prepay duties and taxes at checkout");case"productList":case"productDetail":return a("See duty and tax thresholds");default:return a("Welcome to [storeName]",{storeName:e})}};this.enableShowPeekMessage=function(){if(t.peekMessage){t.showPeekMessage=true}};this.getNewItemRestrictions=function(e){return __awaiter(t,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:o=v.currentHelloPage==="productDetail"||v.currentHelloPage==="productList";if(!o||v.helloSettings.restrictionBehavior==="DISABLED"){return[2,[]]}return[4,L(e)];case 1:t=n.sent();return[2,t]}}))}))};this.triggerShowPeekMessage=function(){t.peekMessage=t.getHelloPeekMessage(v.organizationName);var e=v.helloSettings,o=e.peekMessageBehavior,n=e.peekMessageDelay;var i=n*1e3;if(o==="ENABLED"){setTimeout((function(){t.enableShowPeekMessage();var e=t.allRestrictedItems.some((function(e){return t.productsOnPage.some((function(o){return o.description===e.itemDescription}))}));if(!e){setTimeout((function(){t.showPeekMessage=false}),M)}}),i)}};this.disableAddToCartButtons=function(){if(t.productsOnPage.length){t.productsOnPage.forEach((function(e){var o,n;var i=t.allRestrictedItems.some((function(o){return o.itemDescription===e.description}));if(i){(o=e.cartButtonNode)===null||o===void 0?void 0:o.setAttribute("disabled","disabled")}else{(n=e.cartButtonNode)===null||n===void 0?void 0:n.removeAttribute("disabled")}}))}};this.handleItemRestrictions=function(){return __awaiter(t,void 0,void 0,(function(){var e,o;var t,n;var i=this;return __generator(this,(function(s){switch(s.label){case 0:this.productsOnPage=X();e=this.productsOnPage.filter((function(e){return!i.allFoundProducts.some((function(o){return o.title===e.title}))}));return[4,this.getNewItemRestrictions(e)];case 1:o=s.sent();(t=this.allRestrictedItems).push.apply(t,o);(n=this.allFoundProducts).push.apply(n,e);this.disableAddToCartButtons();return[2]}}))}))};this.reloadHelloData=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleItemRestrictions()];case 1:e.sent();this.triggerShowPeekMessage();return[2]}}))}))};this.handleProductCountChange=s((function(){var e=v.helloSettings.productTitleElementSelector;if(e){var o=X();if(t.allFoundProducts.length!==o.length&&window.location.href===t.initialUrl){if(!t.allFoundProducts.length){return}void t.reloadHelloData()}}}),1e3);this.watchProductCountChange=function(){var e;var o=new MutationObserver(t.handleProductCountChange);o.observe(document.body,{childList:true,subtree:true});(e=t.observerWatcher)===null||e===void 0?void 0:e.push(o)};this.watchPriceChange=function(){var e;var o=new MutationObserver((function(){return void t.displayCurrency()}));o.observe(document.body,{attributes:true,childList:true,subtree:true});(e=t.observerWatcher)===null||e===void 0?void 0:e.push(o)};this.updateHelloOnPageChange=function(){t.watchProductCountChange();setInterval((function(){if(window.location.href!==t.initialUrl){var e=t.initialUrl&&new URL(t.initialUrl);var o=e&&h(e.searchParams);if(o!==r.selectedCountryCode){t.allFoundProducts=[];t.allRestrictedItems=[];t.productsOnPage=[]}t.initialUrl=window.location.href;v.currentHelloPage=j();var n=new URL(window.location.href);var i=h(n.searchParams);if(!i){d(r.selectedCountryCode);return}void t.reloadHelloData()}}),1e3)};this.changeShowDialog=function(e){t.showDialog=e};this.shouldAnimateLeftDesktop=function(){var e=t.helloRef&&getComputedStyle(t.helloRef).position;if(t.helloRef&&e==="relative"){var o=y(t.helloRef);return o}}}e.prototype.showDialogHandler=function(e){var o;if(e){var t=(o=this.helloElement)===null||o===void 0?void 0:o.parentElement;if(t&&t.parentElement===document.body){t.style.zIndex="2147483647";document.body.appendChild(t)}}};e.prototype.getCountryList=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,r.helloCountryList]}))}))};e.prototype.componentWillLoad=function(){var e=this;var o=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.helloRef){return[2]}if(v.loadedConfig){this.helloRef.setAttribute("data-zonos-hello-loaded","");this.updateHelloOnPageChange();this.watchPriceChange();this.handleAppearanceSettingsOverrideChange();clearInterval(o)}return[2]}))}))}),100)};e.prototype.disconnectedCallback=function(){var e;(e=this.observerWatcher)===null||e===void 0?void 0:e.forEach((function(e){return e.disconnect()}))};e.prototype.displayCurrency=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(v.helloSettings.currencyBehavior==="DISABLED"){return[2]}if(!r.exchangeRate){k("Could not display currency. Exchange rate and format data is not available.","warn");return[2]}u();return[2]}))}))};e.prototype.convertAndFormat=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,c(e)]}))}))};e.prototype.convert=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,f(e)]}))}))};e.prototype.format=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,w({amount:e})]}))}))};e.prototype.openHelloDialog=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){this.changeShowDialog(e);return[2]}))}))};e.prototype.handleResize=function(){this.isMobile=window.innerWidth<=768};e.prototype.handleHelloWidgetInitializedState=function(e){var o=e.countryCode,t=e.currencyCode;var n,i;if(this.isHelloWidgetRendered){return}if(r.selectedCountryCode&&typeof v.helloSettings.onInitSuccess==="function"){this.isHelloWidgetRendered=true;void((i=(n=v.helloSettings).onInitSuccess)===null||i===void 0?void 0:i.call(n,{countryCode:o,currencyCode:t}))}};e.prototype.getHelloLocation=function(){var e=this.mobileLocationOverride||v.helloSettings.mobileLocation;var o=this.desktopLocationOverride||v.helloSettings.desktopLocation;var t=this.isMobile;switch(true){case t:{var n=this.animateFromLeftOverride||(e===null||e===void 0?void 0:e.includes("LEFT"));var i=e===null||e===void 0?void 0:e.includes("TOP");return{isMobileWindow:t,isOnLeft:n,isOnTop:i,shouldFloat:!!e}}default:case!t:{var s=!!this.desktopLocationOverride||!v.helloSettings.anchorElementSelector&&!!o;var n=this.animateFromLeftOverride||(o?o.includes("LEFT"):this.shouldAnimateLeftDesktop());var i=o===null||o===void 0?void 0:o.includes("TOP");return{isMobileWindow:t,isOnLeft:n,isOnTop:i,shouldFloat:s}}}};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=z(this.appearanceSettingsOverride.theme)}};e.prototype.componentDidLoad=function(){this.isMobile=window.innerWidth<=768};e.prototype.render=function(){var e=this;var o,i;var s=(o=v.helloSettings.excludedUrlPatterns)===null||o===void 0?void 0:o.some((function(e){return e&&new RegExp(e).test(window.location.href)}));if(s){k("Hello is excluded on this url","warn");return null}var l=r.selectedCountryCode,a=r.targetCurrency;var h=this.getHelloLocation(),d=h.isOnLeft,u=h.isOnTop,c=h.shouldFloat;var f=g(v.appearance,this.appearanceSettingsOverride||null);var w=f.theme;var z=(i=this.allRestrictedItems)===null||i===void 0?void 0:i.filter((function(o){return e.productsOnPage.some((function(e){return e.description===o.itemDescription}))}));this.peekMessage=this.getHelloPeekMessage(v.organizationName);var b=m()&&!!l;if(b&&!this.isHelloWidgetRendered){this.handleHelloWidgetInitializedState({countryCode:l,currencyCode:a})}var x=S(v.helloSettings.widgetSize);return t(n,{class:"zonos--hello zonos--elements","data-theme":w,style:{"--zonos-elements-hello-widget-size":"".concat(x,"px")}},b&&t("div",{class:p(["zonos--hello-wrapper",c&&"zonos--hello-widget-float"])},t("button",{class:p(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",d&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",u&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions",c&&"zonos--hello-widget-float"]),onClick:function(){void e.changeShowDialog(!e.showDialog)},onMouseEnter:function(){return e.enableShowPeekMessage()},onMouseLeave:function(){return e.showPeekMessage=false},ref:function(o){return o&&(e.helloRef=o)},type:"button"},t("zonos-text",{class:"zonos--hello-message"},this.peekMessage),l&&t("div",{class:"zonos--hello-country-flag-wrapper"},t("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:l}))),t("div",{class:p(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override",d&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",u&&"zonos--hello-widget-top",c&&"zonos--hello-widget-float"]),style:{height:this.showDialog?"fit-content":"0px"}},t("zonos-hello-dialog",{animateFromLeftOverride:d,appearanceSettings:f,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:z,setIsOpen:this.changeShowDialog}))))};Object.defineProperty(e.prototype,"helloElement",{get:function(){return i(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{showDialog:["showDialogHandler"],appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}},enumerable:false,configurable:true});return e}());R.style=B}}}));
@@ -1 +1 @@
1
- import{r as s,d as t,h as o,a as e,g as i}from"./p-ce75b047.js";import{t as n}from"./p-3b479012.js";import{b as a,t as r,V as l,H as d,u as h,d as c}from"./p-67b2e46c.js";import{s as p,z as u,t as m,y as f,l as z}from"./p-3f8f4c78.js";import{z as b,g,f as y}from"./p-9a417eeb.js";import{l as v,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-63a383f4.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-6b361d2b.js";import{g as S}from"./p-f1aea919.js";import"./p-7bdce9d4.js";import"./p-34d6eb83.js";import"./p-1d42cd20.js";const D=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=n(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:a.stripeBillingAddressElement,stripeAddressEventData:a.stripeBillingAddressEventData,stripeElements:a.stripeElementsForBillingAddress}:{stripeAddressElement:a.stripeAddressElement,stripeAddressEventData:a.stripeAddressEventData,stripeElements:a.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?a.stripeBillingAddressEventData=s:a.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,r({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?a.stripeBillingAddressElement=s:a.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void v("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,i=e?Object.values(e).map((s=>s.code)):[],n=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),a="shipping"===this.type?i:[],r=(null==s?void 0:s.value.address.country)||u(a);A(`Stripe country code: ${r}`,"info");const d=t.create("address",{allowedCountries:n?[]:a,contacts:o.length&&!s?this.defaultAddress:[],defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:r}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=l({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?a.stripeAddressEventData=null:a.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:a.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:m(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:a.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{a.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:m("Short address code"),inputPlaceholder:"RRRD2929",inputValue:a.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{a.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:m("Company name (optional)"),inputValue:a.companyName,onInputChange:s=>{a.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[f("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"9e66c8b7ba80d28aa430d6f5397d5eca16596e1a",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"a731814dbada28f16699efe8bc23a18c7b6e04ff",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"138f499157a6628970042d14d89c3420936a5811",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"51451d40580d128e3c38ab5f3f2cd471c21aaf01",class:"zonos--address-component"}))}get el(){return i(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};D.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const L=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=m("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=g(b.appearance.theme);return o(e,{key:"a91852d7fabd934497c5a87ad42b206dcee15ae7",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":y()}},o("div",{key:"3074b85548fd1dc5023611423c52fbbd77a3e959",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"f326b54e65bddf562d4b9649b8964831d0545db6",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"0ab0ae9fecdca87acb7adc33c14408978a40a009",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"d168c39fa5a31a107cbe4ff325cf4184ee8b2ad3",class:"wrapper"},o("div",{key:"c7cdca4f45e22e36393616fa3970556477902ead",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"1dcf75c8657a414662271a4c93b0698bd174b010",class:"content"},o("div",{key:"191344284e3173b22a37c3383c49cb51e0fb54a5",class:"title"},o("zonos-text",{key:"539b24aa36afa5a6fe046ac37eda57ccc1170124",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"53d54141bdcc1f0df661df450f5393e657410025",class:"subtitle"},o("zonos-text",{key:"0a8b74eceb87355ad6869e1338a708bb0182cab8",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"68fd8147f7834074392be28f0053cf2f802faf69",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"a8be0abcfc980ec720d64ec0dc5cdacf5d19dadb",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||m("Cancel")),o("zonos-button",{key:"c72ea83faa9cd24c5e6f5894045e07d4639a5fc4",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return i(this)}};L.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const N=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),Z=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=a.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=N(s);a.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!a.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=a.stripeLinkElement||a.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void v("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;a.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),a.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(a.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=a.stripeLinkElement)||void 0===o||o.clear(),null===(e=a.stripeLinkElement)||void 0===e||e.destroy(),a.stripeLinkElement=null,a.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=a.clientSecret})),d("stripe",(async()=>{this.stripe=a.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:m("Email"),inputValue:this.defaultEmail||(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=N(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},m("Please enter a valid email address.")))}get el(){return i(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};Z.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const B=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"e9d9db9623f268cc66c39130607819fa8abede22",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"e766d339b90425e7379de4b773ae8f1da98992cb",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"32a61d38a106367bd4d54cffd8aba2e6c4b1e933",size:this.size,spinnerColor:this.spinnerColor})))}};B.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{D as zonos_address,L as zonos_confirm_dialog,Z as zonos_link_authentication,B as zonos_loading_overlay}
1
+ import{r as s,d as t,h as o,a as e,g as i}from"./p-ce75b047.js";import{t as n}from"./p-3b479012.js";import{b as a,t as r,V as l,H as d,u as h,d as c}from"./p-8051403a.js";import{s as p,z as u,t as m,y as f,l as z}from"./p-9448d960.js";import{z as b,g,f as y}from"./p-9a417eeb.js";import{l as v,i as k,s as x}from"./p-41dd1cb8.js";import{a as w,s as C}from"./p-a553e132.js";import{c as I}from"./p-b4b7f705.js";import{l as A}from"./p-0a377722.js";import{c as E,s as j}from"./p-bcf5cffb.js";import{g as S}from"./p-f1aea919.js";import"./p-7bdce9d4.js";import"./p-34d6eb83.js";import"./p-1d42cd20.js";const D=class{constructor(o){s(this,o),this.invalidCharacters=t(this,"invalidCharacters",7),this.taxIdChanged=t(this,"taxIdChanged",7),this.storeUnsubscribeList=[],this.isAutoCompleteAdjusted=!1,this.defaultAddress=[],this.taxIdErrorMessage="",this.shortAddressCodeErrorMessage="",this.stripe=window.Zonos.stripe,this.isDirtyAddress=!1,this.isAddressFilled=!1,this.checkoutSessionId=p.checkoutSessionId,this.prevCountry=null,this.prevPostalCode=null,this.trackingSent=!1,this.prefetchLandedCost=n(h,1e3)}getStripeAddressInstance(){return"billing"===this.type?{stripeAddressElement:a.stripeBillingAddressElement,stripeAddressEventData:a.stripeBillingAddressEventData,stripeElements:a.stripeElementsForBillingAddress}:{stripeAddressElement:a.stripeAddressElement,stripeAddressEventData:a.stripeAddressEventData,stripeElements:a.stripeElements}}updateAddressEventData({event:s,type:t}){"billing"===t?a.stripeBillingAddressEventData=s:a.stripeAddressEventData=s,"shipping"===t&&s.value.address.line1.length&&this.prefetchLandedCost()}isAddressFilledChanged(){p.checkoutSessionId&&this.isAddressFilled&&!this.trackingSent&&"shipping"===this.type&&(this.trackingSent=!0,r({checkoutSessionId:p.checkoutSessionId,eventName:"checkout_customerInfoFilled"}))}updateAddressElement({stripeAddressElement:s,type:t}){"shipping"!==t?a.stripeBillingAddressElement=s:a.stripeAddressElement=s}async watchInitStripe(){this.stripe=window.Zonos.stripe;const{stripeAddressEventData:s,stripeElements:t}=this.getStripeAddressInstance();if(!this.stripe||!t)return void v("Stripe is not initialized. Couldn't load stripe element.");const o=this.defaultAddress.map((s=>Object.assign(Object.assign({},s),{name:s.name,phone:s.phone||void 0}))),e=z.shippingZoneCountries,i=e?Object.values(e).map((s=>s.code)):[],n=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries"),a="shipping"===this.type?i:[],r=(null==s?void 0:s.value.address.country)||u(a);A(`Stripe country code: ${r}`,"info");const d=t.create("address",{allowedCountries:n?[]:a,contacts:o.length&&!s?this.defaultAddress:[],defaultValues:{address:Object.assign(Object.assign({},null==s?void 0:s.value.address),{country:r}),firstName:null==s?void 0:s.value.firstName,lastName:null==s?void 0:s.value.lastName,phone:null==s?void 0:s.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});d.mount(this.el.querySelector(".zonos--address-component")),(null==s?void 0:s.value.address)&&(this.prevCountry=s.value.address.country,this.prevPostalCode=s.value.address.postal_code),d.on("change",(s=>{const t=s.value;if(!this.isDirtyAddress&&t.address.line1.length>=3){if(this.isDirtyAddress=!0,!this.isAutoCompleteAdjusted){const s=this.el.querySelector('iframe[src*="autocomplete-suggestions"]');s&&(s.style.zIndex="3"),this.isAutoCompleteAdjusted=!0}setTimeout((()=>{if(k())this.el.scrollIntoView({behavior:"smooth",block:"end"});else{const s="shipping"===this.type?100:600,t=this.el.closest(".zonos--group"),o=this.el.getBoundingClientRect().top+s;null==t||t.scrollTo({behavior:"smooth",top:o})}}),600)}const{firstName:o,lastName:e}=l({firstName:t.firstName,lastName:t.lastName,name:t.name});this.updateAddressEventData({event:Object.assign(Object.assign({},s),{elementMode:this.type,elementType:"address",value:Object.assign(Object.assign({},t),{firstName:o,lastName:e})}),type:this.type})})),this.updateAddressElement({stripeAddressElement:d,type:this.type})}defaultAddressChanged(s,t){if(JSON.stringify(t)===JSON.stringify(s))return;A("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});const o=this.getStripeAddressInstance().stripeAddressElement;null==o||o.clear(),null==o||o.destroy(),"shipping"===this.type?a.stripeAddressEventData=null:a.stripeBillingAddressEventData=null,this.watchInitStripe()}isInTaxIdCountry(s){return E.includes(s)}renderTaxIdInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;if(!t)return null;if(!this.isInTaxIdCountry(t))return null;if(!w({companyName:a.companyName,countryCode:t}))return null;const e=j[t];return o("div",{class:"zonos--tax-id-input"},o("zonos-stripe-input",{inputLabel:m(e.friendlyName),inputPlaceholder:e.placeholder,inputValue:a.taxId||"",isError:!!this.taxIdErrorMessage,onInputChange:s=>{a.taxId=s.detail,this.taxIdChanged.emit(s.detail)}}),this.taxIdErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.taxIdErrorMessage))}renderShortAddressCodeInput(){var s;if("billing"===this.type)return null;const t=null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.value.address.country;return t&&C({countryCode:t})?o("div",{class:"zonos--short-address-code-input"},o("zonos-stripe-input",{inputLabel:m("Short address code"),inputPlaceholder:"RRRD2929",inputValue:a.shortAddressCode||"",isError:!!this.shortAddressCodeErrorMessage,onInputChange:s=>{a.shortAddressCode=s.detail}}),this.shortAddressCodeErrorMessage&&o("zonos-text",{textColor:"red-600",type:"caption"},this.shortAddressCodeErrorMessage)):null}renderCompanyNameInput(){return("billing"!==this.type||window.Zonos.isCollect||window.Zonos.isInvoice)&&("ENABLED"===b.checkoutSettings.companyFieldsStatus||window.Zonos.isCollect||window.Zonos.isInvoice)?o("zonos-stripe-input",{class:"zonos--company-name-input",inputLabel:m("Company name (optional)"),inputValue:a.companyName,onInputChange:s=>{a.companyName=s.detail}}):null}disconnectedCallback(){const s=this.getStripeAddressInstance().stripeAddressElement;null==s||s.destroy();try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){const s=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!s&&s.value.address.line1.length>0,this.watchInitStripe(),this.checkoutSessionId=p.checkoutSessionId,this.storeUnsubscribeList=[f("checkoutSessionId",(()=>{this.checkoutSessionId=p.checkoutSessionId})),d("stripeElements",(()=>{"shipping"===this.type&&this.watchInitStripe()})),d("stripeElementsForBillingAddress",(()=>{"billing"===this.type&&this.watchInitStripe()}))]}render(){var s;return this.checkoutSessionId=p.checkoutSessionId,(null===(s=a.stripeAddressEventData)||void 0===s?void 0:s.complete)&&(this.isAddressFilled=!0),o(e,{key:"9e66c8b7ba80d28aa430d6f5397d5eca16596e1a",class:I(["zonos--address","zonos--elements",`zonos--${this.type}-address`])},this.titleText&&o("zonos-text",{key:"a731814dbada28f16699efe8bc23a18c7b6e04ff",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("slot",{key:"138f499157a6628970042d14d89c3420936a5811",name:"below-title"}),this.renderCompanyNameInput(),this.renderTaxIdInput(),this.renderShortAddressCodeInput(),o("div",{key:"51451d40580d128e3c38ab5f3f2cd471c21aaf01",class:"zonos--address-component"}))}get el(){return i(this)}static get watchers(){return{checkoutSessionId:["isAddressFilledChanged"],isAddressFilled:["isAddressFilledChanged"],stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}}};D.style=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address,.sc-zonos-address-h .zonos--short-address-code-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";const L=class{constructor(o){s(this,o),this.confirmClicked=t(this,"confirmClicked",7),this.cancelClicked=t(this,"cancelClicked",7),this.dialogTitle=m("Are you sure?"),this.dialogIntent="info",this.dialogSubtitle=null,this.dialogWidth=350,this.dialogType="confirm",this.isMobile=!1,this.noClickOutside=!1,this.clickOutsideDialogHandler=s=>{s.target!==s.currentTarget||this.noClickOutside||this.closeDialogHandler()}}handleKeyDown(s){"Escape"===s.key&&this.closeDialogHandler()}focusDialog(){this.dialogOpen&&setTimeout((()=>{var s,t;null===(t=null===(s=this.el.shadowRoot)||void 0===s?void 0:s.querySelector(".zonos--backdrop"))||void 0===t||t.focus()}),100)}confirmDialogHandler(){this.dialogOpen&&this.confirmClicked.emit()}closeDialogHandler(){this.dialogOpen&&this.cancelClicked.emit()}renderIcon(){switch(this.dialogIntent){case"info":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>\n <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>\n</svg>',iconColor:"blue-800"});case"danger":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>\n <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"red-800"});case"warn":return o("zonos-icon",{content:'<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">\n <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>\n <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>\n</svg>',iconColor:"orange-800"})}}getButtonConfirmVariant(){switch(this.dialogIntent){case"warn":return"warning";case"danger":return"danger";default:return"primary"}}render(){this.focusDialog();const s=S(),t=g(b.appearance.theme);return o(e,{key:"a91852d7fabd934497c5a87ad42b206dcee15ae7",class:I([this.dialogOpen&&"open","zonos--elements"]),"data-dialog-type":this.dialogType,"data-theme":t,style:{"--zonos--border-radius":s,"--zonos--dialog-width":`${this.dialogWidth}px`,"--zonos--font-family":y()}},o("div",{key:"3074b85548fd1dc5023611423c52fbbd77a3e959",class:"zonos--backdrop",tabIndex:-1}),o("div",{key:"f326b54e65bddf562d4b9649b8964831d0545db6",class:I(["zonos--confirm-layout",this.dialogIntent]),onClick:s=>this.clickOutsideDialogHandler(s)},o("div",{key:"0ab0ae9fecdca87acb7adc33c14408978a40a009",class:"zonos--confirm-dialog",onBlur:()=>{this.focusDialog()}},o("div",{key:"d168c39fa5a31a107cbe4ff325cf4184ee8b2ad3",class:"wrapper"},o("div",{key:"c7cdca4f45e22e36393616fa3970556477902ead",class:"icon-wrapper"},this.renderIcon()),o("div",{key:"1dcf75c8657a414662271a4c93b0698bd174b010",class:"content"},o("div",{key:"191344284e3173b22a37c3383c49cb51e0fb54a5",class:"title"},o("zonos-text",{key:"539b24aa36afa5a6fe046ac37eda57ccc1170124",type:"subheader"},this.dialogTitle)),this.dialogSubtitle&&o("div",{key:"53d54141bdcc1f0df661df450f5393e657410025",class:"subtitle"},o("zonos-text",{key:"0a8b74eceb87355ad6869e1338a708bb0182cab8",textColor:"gray-800"},this.dialogSubtitle))),o("div",{key:"68fd8147f7834074392be28f0053cf2f802faf69",class:"footer"},"confirm"===this.dialogType&&o("zonos-button",{key:"a8be0abcfc980ec720d64ec0dc5cdacf5d19dadb",backgroundColor:"gray-0",class:"cancel-button",onClick:()=>this.closeDialogHandler(),size:"lg",withBoxShadow:!0},this.dialogCancelBtnText||m("Cancel")),o("zonos-button",{key:"c72ea83faa9cd24c5e6f5894045e07d4639a5fc4",class:"confirm-button",onClick:()=>this.confirmDialogHandler(),size:"lg",variant:this.getButtonConfirmVariant()},this.dialogConfirmBtnText))))))}static get assetsDirs(){return["assets"]}get el(){return i(this)}};L.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";const N=s=>/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/.test(s),Z=class{constructor(o){s(this,o),this.linkAuthenticationChange=t(this,"linkAuthenticationChange",7),this.storeUnsubscribeList=[],this.defaultEmail=null,this.isEmailError=!1,this.stripe=a.stripe,this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,this.retriesInitializeLink=0,this.setCustomEmailInputToLinkEvent=s=>{const t=N(s);a.stripeLinkEventData={complete:!!t,elementType:"linkAuthentication",empty:!s,value:{email:s}}},this.handleNormalEmailInput=s=>{var t;this.setCustomEmailInputToLinkEvent(s.detail),null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()}}watchIsStagingMode(){setTimeout((()=>{this.watchInitStripe()}),0)}async watchInitStripe(){if(!this.stripe||!a.stripeElements)return;if(c.isStagingMode||!this.clientSecret)return;const s=this.defaultEmail?{email:this.defaultEmail}:void 0;try{const t=a.stripeLinkElement||a.stripeElements.create("linkAuthentication",{defaultValues:s}),o=this.el.querySelector(".zonos--link-authentication-component");if(!o)return void v("Cannot find container element for linkAuthenticationElement");t.mount(o),t.on("change",(s=>{var t;a.stripeLinkEventData=s,null===(t=this.linkAuthenticationChange)||void 0===t||t.emit()})),a.stripeLinkElement=t,this.retriesInitializeLink=0,this.retriesInitializeLink>11&&(A("Stripe link element initialized","info",{retriesInitializeLink:this.retriesInitializeLink,stripe:this.stripe}),x({endpoint:"stripe-link-authentication-init-long-running",errors:["Stripe link element initialized after 20 retries - 10 seconds"],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}catch(s){s instanceof Error&&(this.retriesInitializeLink++,this.retriesInitializeLink<51&&(await new Promise((s=>setTimeout(s,500))),this.watchInitStripe()),51===this.retriesInitializeLink&&x({endpoint:"stripe-link-authentication-init-error",errors:[s.message],metadata:{retriesInitializeLink:this.retriesInitializeLink}}))}}watchDefaultEmail(s,t){var o,e;A("Default email is changed","info",{newDefaultEmail:s,oldDefaultEmail:t}),t!==s&&(s||(a.stripeLinkEventData=null),c.isStagingMode?this.setCustomEmailInputToLinkEvent(s||""):(null===(o=a.stripeLinkElement)||void 0===o||o.clear(),null===(e=a.stripeLinkElement)||void 0===e||e.destroy(),a.stripeLinkElement=null,a.stripeLinkEventData=null,A("Reset stripe link element when default email is changed","info",{defaultEmail:s}),this.watchInitStripe()))}disconnectedCallback(){try{this.storeUnsubscribeList.forEach((s=>s()))}catch(s){}}componentDidLoad(){this.storeUnsubscribeList=[d("stripeElements",(async()=>{this.watchInitStripe()})),d("clientSecret",(async()=>{this.clientSecret=a.clientSecret})),d("stripe",(async()=>{this.stripe=a.stripe}))],this.watchInitStripe(),this.defaultEmail&&this.setCustomEmailInputToLinkEvent(this.defaultEmail)}render(){return this.isStagingMode=c.isStagingMode,this.clientSecret=a.clientSecret,o(e,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":S()}},this.titleText&&o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),(()=>{var s;return c.isStagingMode?o("zonos-stripe-input",{inputLabel:m("Email"),inputValue:this.defaultEmail||(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isError:this.isEmailError,onBlur:()=>{var s;const t=(null===(s=a.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"";if(!t)return;const o=N(t);this.isEmailError=!o},onInputChange:this.handleNormalEmailInput}):o("div",{class:`zonos--link-authentication-component ${this.isEmailError&&"zonos--input-invalid"}`})})(),this.isEmailError&&o("zonos-text",{textColor:"red-600"},m("Please enter a valid email address.")))}get el(){return i(this)}static get watchers(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}}};Z.style=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";const B=class{constructor(t){s(this,t),this.open=!1,this.size=40}render(){return o(e,{key:"e9d9db9623f268cc66c39130607819fa8abede22",class:I(["zonos--elements",this.open&&"zonos--open"])},o("div",{key:"e766d339b90425e7379de4b773ae8f1da98992cb",class:"zonos--loading-overlay"},o("zonos-spinner",{key:"32a61d38a106367bd4d54cffd8aba2e6c4b1e933",size:this.size,spinnerColor:this.spinnerColor})))}};B.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";export{D as zonos_address,L as zonos_confirm_dialog,Z as zonos_link_authentication,B as zonos_loading_overlay}
@@ -0,0 +1 @@
1
+ import{l as o}from"./p-9448d960.js";const r="gkjqw123",v="Kq93wqw3",d=()=>{var d;return null===(d=o.inclusivePricingConfigurations)||void 0===d?void 0:d.some((o=>{var d,i;return"ENABLED"===(null===(d=o.configurations[r])||void 0===d?void 0:d.status)||"ENABLED"===(null===(i=o.configurations[v])||void 0===i?void 0:i.status)}))};export{r as D,v as T,d as h}