@zonos/elements 1.3.217 → 1.3.219

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 (411) hide show
  1. package/dist/cjs/buildCartItemsByTempCart-309fcebf.js +28 -0
  2. package/dist/cjs/{cart-54ff39d6.js → cart-9a2b32e4.js} +91 -48
  3. package/dist/cjs/cleanHtmlMarkdown-577d0a77.js +999 -0
  4. package/dist/cjs/{handleFetch-0313ebba.js → handleFetch-45f35cac.js} +2 -1
  5. package/dist/cjs/index.cjs.js +20 -10
  6. package/dist/cjs/isCollectMobileTablet-7e57fd90.js +172 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/localization-b12edb2a.js +738 -0
  9. package/dist/cjs/{paypal-e7504122.js → paypal-e80871d0.js} +13 -9
  10. package/dist/cjs/placeTestOrder-8222fe95.js +93 -0
  11. package/dist/cjs/{localization-721a5ec3.js → translationStore-20a6d8bf.js} +963 -734
  12. package/dist/cjs/{updateCheckoutSessionAttributes-8db49644.js → updateCheckoutSessionAttributes-c0853fdd.js} +1 -1
  13. package/dist/cjs/zonos-address_11.cjs.entry.js +103 -73
  14. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  15. package/dist/cjs/{zonos-banner.cjs.entry.js → zonos-banner_2.cjs.entry.js} +40 -0
  16. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  17. package/dist/cjs/{zonos-cart-items_14.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +75 -1294
  18. package/dist/cjs/zonos-checkout.cjs.entry.js +27 -50
  19. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +92 -0
  21. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +810 -0
  22. package/dist/cjs/zonos-collect.cjs.entry.js +468 -0
  23. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  24. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +168 -0
  25. package/dist/cjs/zonos-controller.cjs.entry.js +85 -29
  26. package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -2
  27. package/dist/cjs/zonos-country-select_4.cjs.entry.js +12 -11
  28. package/dist/cjs/zonos-elements.cjs.js +1 -1
  29. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +16 -6
  30. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +35 -34
  31. package/dist/cjs/zonos-hello.cjs.entry.js +9 -8
  32. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  33. package/dist/cjs/zonos-language-select_2.cjs.entry.js +7 -6
  34. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  35. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  36. package/dist/cjs/zonos-stripe-input.cjs.entry.js +8 -5
  37. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  38. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  39. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  40. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  41. package/dist/collection/collection-manifest.json +10 -0
  42. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +3 -0
  43. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
  44. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +5 -1
  45. package/dist/collection/components/checkout/zonos-collect/assets/ChevronDownIcon.svg +1 -0
  46. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/assets/empty-item.jpeg +0 -0
  47. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.css +60 -0
  48. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.js +39 -0
  49. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/RemoveIcon.svg +1 -0
  50. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/SuccessIcon.svg +1 -0
  51. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.css +84 -0
  52. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +403 -0
  53. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/chevronDownIcon.svg +1 -0
  54. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/globe.svg +3 -0
  55. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconDark.svg +10 -0
  56. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconLight.svg +10 -0
  57. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosWordmark.svg +7 -0
  58. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.css +152 -0
  59. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +164 -0
  60. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronDownIcon.svg +1 -0
  61. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronUpIcon.svg +1 -0
  62. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.css +109 -0
  63. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +194 -0
  64. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/CheckmarkLineIcon.svg +1 -0
  65. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/RemoveLineIcon.svg +1 -0
  66. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.css +98 -0
  67. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +369 -0
  68. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.css +68 -0
  69. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +151 -0
  70. package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.css +78 -0
  71. package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.js +115 -0
  72. package/dist/collection/components/checkout/zonos-collect/zonos-collect.css +349 -0
  73. package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +547 -0
  74. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  75. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  76. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  77. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  78. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  79. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  80. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  81. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  82. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  83. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  84. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.css +38 -0
  85. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +63 -0
  86. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  87. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  88. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  89. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  90. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  91. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  92. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  93. package/dist/collection/components/common/zonos-skeleton/assets/RemoveLineIcon.svg +3 -0
  94. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.css +40 -0
  95. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +102 -0
  96. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +8 -5
  97. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  98. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  99. package/dist/collection/components/common/zonos-text/zonos-text.css +1 -0
  100. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  101. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  102. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  103. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  104. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  105. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  106. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  107. package/dist/collection/components/main/zonos-controller.js +91 -25
  108. package/dist/collection/components/paypal/zonos-paypal-payment.js +13 -2
  109. package/dist/collection/components/store/checkout/cart.js +36 -15
  110. package/dist/collection/components/store/checkout/collect.js +157 -0
  111. package/dist/collection/components/store/checkout/paypal.js +4 -2
  112. package/dist/collection/components/store/checkout/stripe.js +31 -12
  113. package/dist/collection/components/store/translationStore/strings.arabic.js +48 -0
  114. package/dist/collection/components/store/translationStore/strings.base.js +48 -0
  115. package/dist/collection/components/store/translationStore/strings.chinese.js +48 -0
  116. package/dist/collection/components/store/translationStore/strings.danish.js +48 -0
  117. package/dist/collection/components/store/translationStore/strings.dutch.js +48 -0
  118. package/dist/collection/components/store/translationStore/strings.french.js +48 -0
  119. package/dist/collection/components/store/translationStore/strings.german.js +48 -0
  120. package/dist/collection/components/store/translationStore/strings.hebrew.js +48 -0
  121. package/dist/collection/components/store/translationStore/strings.indonesian.js +48 -0
  122. package/dist/collection/components/store/translationStore/strings.italian.js +48 -0
  123. package/dist/collection/components/store/translationStore/strings.japanese.js +48 -0
  124. package/dist/collection/components/store/translationStore/strings.korean.js +48 -0
  125. package/dist/collection/components/store/translationStore/strings.norwegian.js +48 -0
  126. package/dist/collection/components/store/translationStore/strings.polish.js +48 -0
  127. package/dist/collection/components/store/translationStore/strings.portuguese.js +48 -0
  128. package/dist/collection/components/store/translationStore/strings.russian.js +48 -0
  129. package/dist/collection/components/store/translationStore/strings.spanish.js +48 -0
  130. package/dist/collection/components/store/translationStore/strings.swedish.js +48 -0
  131. package/dist/collection/components/store/translationStore/strings.turkish.js +48 -0
  132. package/dist/collection/components/store/translationStore/strings.vietnamese.js +48 -0
  133. package/dist/collection/components/store/translationStore.js +2 -1
  134. package/dist/collection/components/stripe/zonos-address/zonos-address.js +35 -18
  135. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  136. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  137. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +15 -2
  138. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  139. package/dist/collection/components/utils/checkout/initCollect.js +15 -0
  140. package/dist/collection/components/utils/checkout/isCollectMobileTablet.js +10 -0
  141. package/dist/collection/components/utils/checkout/renderCheckoutCurrency.js +10 -1
  142. package/dist/collection/components/utils/getNextFallbackApi.js +1 -1
  143. package/dist/collection/components/utils/handleFetch.js +1 -0
  144. package/dist/collection/components/utils/renderFallback.js +7 -0
  145. package/dist/collection/scripts/_getZonosQaUrl.js +5 -1
  146. package/dist/collection/scripts/_zonosBase.js +7 -1
  147. package/dist/collection/types/checkout/api/PartyInfo.js +1 -0
  148. package/dist/collection/types/generated/graphql.internal.types.js +103 -0
  149. package/dist/collection/types/index.js +1 -0
  150. package/dist/esm/buildCartItemsByTempCart-c4488f73.js +26 -0
  151. package/dist/esm/{cart-010402f9.js → cart-acf4ebf5.js} +69 -28
  152. package/dist/esm/cleanHtmlMarkdown-b5b18743.js +997 -0
  153. package/dist/esm/{handleFetch-fa90f7f6.js → handleFetch-99218189.js} +2 -1
  154. package/dist/esm/index.js +20 -10
  155. package/dist/esm/isCollectMobileTablet-b72b81c5.js +165 -0
  156. package/dist/esm/loader.js +1 -1
  157. package/dist/esm/localization-8646f526.js +719 -0
  158. package/dist/esm/{paypal-70b140d9.js → paypal-2fa930eb.js} +8 -5
  159. package/dist/esm/placeTestOrder-d1ad9cf6.js +90 -0
  160. package/dist/esm/{localization-9db8b6e9.js → translationStore-c9743292.js} +963 -718
  161. package/dist/esm/{updateCheckoutSessionAttributes-691cdc6d.js → updateCheckoutSessionAttributes-92f42882.js} +1 -1
  162. package/dist/esm/zonos-address_11.entry.js +72 -42
  163. package/dist/esm/zonos-badge.entry.js +3 -3
  164. package/dist/esm/{zonos-banner.entry.js → zonos-banner_2.entry.js} +40 -1
  165. package/dist/esm/zonos-button_3.entry.js +3 -3
  166. package/dist/esm/{zonos-cart-items_14.entry.js → zonos-cart-items_12.entry.js} +24 -1241
  167. package/dist/esm/zonos-checkout.entry.js +8 -31
  168. package/dist/esm/zonos-collapse.entry.js +2 -2
  169. package/dist/esm/zonos-collect-cart-items_3.entry.js +86 -0
  170. package/dist/esm/zonos-collect-finish_6.entry.js +801 -0
  171. package/dist/esm/zonos-collect.entry.js +464 -0
  172. package/dist/esm/zonos-component.entry.js +1 -1
  173. package/dist/esm/zonos-confirm-dialog_2.entry.js +163 -0
  174. package/dist/esm/zonos-controller.entry.js +85 -29
  175. package/dist/esm/zonos-country-flag.entry.js +3 -2
  176. package/dist/esm/zonos-country-select_4.entry.js +12 -11
  177. package/dist/esm/zonos-elements.js +1 -1
  178. package/dist/esm/zonos-empty-state-payment_4.entry.js +16 -6
  179. package/dist/esm/zonos-hello-dialog.entry.js +7 -6
  180. package/dist/esm/zonos-hello.entry.js +3 -2
  181. package/dist/esm/zonos-input.entry.js +4 -4
  182. package/dist/esm/zonos-language-select_2.entry.js +7 -6
  183. package/dist/esm/zonos-link.entry.js +1 -1
  184. package/dist/esm/zonos-logo.entry.js +2 -2
  185. package/dist/esm/zonos-stripe-input.entry.js +9 -6
  186. package/dist/esm/zonos-text.entry.js +1 -1
  187. package/dist/esm/zonos-toggle.entry.js +2 -2
  188. package/dist/esm/zonos-tooltip.entry.js +2 -2
  189. package/dist/esm/zonos-v-stack.entry.js +2 -2
  190. package/dist/esm-es5/buildCartItemsByTempCart-c4488f73.js +1 -0
  191. package/dist/esm-es5/cart-acf4ebf5.js +1 -0
  192. package/dist/esm-es5/cleanHtmlMarkdown-b5b18743.js +1 -0
  193. package/dist/esm-es5/{handleFetch-fa90f7f6.js → handleFetch-99218189.js} +1 -1
  194. package/dist/esm-es5/index.js +1 -1
  195. package/dist/esm-es5/isCollectMobileTablet-b72b81c5.js +1 -0
  196. package/dist/esm-es5/loader.js +1 -1
  197. package/dist/esm-es5/localization-8646f526.js +1 -0
  198. package/dist/esm-es5/paypal-2fa930eb.js +17 -0
  199. package/dist/esm-es5/placeTestOrder-d1ad9cf6.js +1 -0
  200. package/dist/esm-es5/translationStore-c9743292.js +1 -0
  201. package/dist/esm-es5/{updateCheckoutSessionAttributes-691cdc6d.js → updateCheckoutSessionAttributes-92f42882.js} +1 -1
  202. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  203. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  204. package/dist/esm-es5/zonos-banner_2.entry.js +1 -0
  205. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  206. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
  207. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  208. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  209. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -0
  210. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -0
  211. package/dist/esm-es5/zonos-collect.entry.js +1 -0
  212. package/dist/esm-es5/zonos-component.entry.js +1 -1
  213. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -0
  214. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  215. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  216. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  217. package/dist/esm-es5/zonos-elements.js +1 -1
  218. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  219. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  220. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  221. package/dist/esm-es5/zonos-input.entry.js +1 -1
  222. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  223. package/dist/esm-es5/zonos-link.entry.js +1 -1
  224. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  225. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  226. package/dist/esm-es5/zonos-text.entry.js +1 -1
  227. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  228. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  229. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  230. package/dist/scripts/index.d.ts +471 -4
  231. package/dist/scripts/index.js +1 -1
  232. package/dist/scripts/loadZonos.js +1 -1
  233. package/dist/scripts/zonos.js +1 -1
  234. package/dist/types/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.d.ts +4 -0
  235. package/dist/types/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.d.ts +49 -0
  236. package/dist/types/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.d.ts +25 -0
  237. package/dist/types/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.d.ts +29 -0
  238. package/dist/types/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.d.ts +62 -0
  239. package/dist/types/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.d.ts +22 -0
  240. package/dist/types/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.d.ts +10 -0
  241. package/dist/types/components/checkout/zonos-collect/zonos-collect.d.ts +86 -0
  242. package/dist/types/components/common/zonos-h-stack/zonos-h-stack.d.ts +9 -0
  243. package/dist/types/components/common/zonos-skeleton/zonos-skeleton.d.ts +17 -0
  244. package/dist/types/components/main/zonos-controller.d.ts +5 -0
  245. package/dist/types/components/paypal/zonos-paypal-payment.d.ts +3 -0
  246. package/dist/types/components/store/checkout/cart.d.ts +23 -3
  247. package/dist/types/components/store/checkout/collect.d.ts +21 -0
  248. package/dist/types/components/store/checkout/paypal.d.ts +4 -3
  249. package/dist/types/components/store/checkout/stripe.d.ts +6 -2
  250. package/dist/types/components/store/translationStore/strings.arabic.d.ts +48 -0
  251. package/dist/types/components/store/translationStore/strings.base.d.ts +48 -0
  252. package/dist/types/components/store/translationStore/strings.chinese.d.ts +48 -0
  253. package/dist/types/components/store/translationStore/strings.danish.d.ts +48 -0
  254. package/dist/types/components/store/translationStore/strings.dutch.d.ts +48 -0
  255. package/dist/types/components/store/translationStore/strings.french.d.ts +48 -0
  256. package/dist/types/components/store/translationStore/strings.german.d.ts +48 -0
  257. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +48 -0
  258. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +48 -0
  259. package/dist/types/components/store/translationStore/strings.italian.d.ts +48 -0
  260. package/dist/types/components/store/translationStore/strings.japanese.d.ts +48 -0
  261. package/dist/types/components/store/translationStore/strings.korean.d.ts +48 -0
  262. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +48 -0
  263. package/dist/types/components/store/translationStore/strings.polish.d.ts +48 -0
  264. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +48 -0
  265. package/dist/types/components/store/translationStore/strings.russian.d.ts +48 -0
  266. package/dist/types/components/store/translationStore/strings.spanish.d.ts +48 -0
  267. package/dist/types/components/store/translationStore/strings.swedish.d.ts +48 -0
  268. package/dist/types/components/store/translationStore/strings.turkish.d.ts +48 -0
  269. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +48 -0
  270. package/dist/types/components/store/translationStore.d.ts +2 -1
  271. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +1 -2
  272. package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +2 -0
  273. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  274. package/dist/types/components/utils/checkout/initCollect.d.ts +1 -0
  275. package/dist/types/components/utils/checkout/isCollectMobileTablet.d.ts +4 -0
  276. package/dist/types/components/utils/getNextFallbackApi.d.ts +2 -2
  277. package/dist/types/components/utils/renderFallback.d.ts +6 -0
  278. package/dist/types/components.d.ts +401 -2
  279. package/dist/types/scripts/_zonosBase.d.ts +5 -0
  280. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
  281. package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
  282. package/dist/types/types/checkout/api/CreateParty.d.ts +24 -0
  283. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +6 -1
  284. package/dist/types/types/checkout/api/PartyInfo.d.ts +24 -0
  285. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  286. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  287. package/dist/types/types/generated/graphql.internal.types.d.ts +431 -9
  288. package/dist/types/types/generated/graphql.internal.types.ts +428 -10
  289. package/dist/types/types/index.d.ts +1 -0
  290. package/dist/zonos-elements/index.esm.js +1 -1
  291. package/dist/zonos-elements/{p-288761b1.system.entry.js → p-009c3ac5.system.entry.js} +1 -1
  292. package/dist/zonos-elements/{p-c7d5d45d.entry.js → p-03980f76.entry.js} +1 -1
  293. package/dist/zonos-elements/{p-c1d86f32.system.js → p-062430f9.system.js} +1 -1
  294. package/dist/zonos-elements/p-07bea979.system.js +1 -0
  295. package/dist/zonos-elements/p-0cec2dd2.system.entry.js +1 -0
  296. package/dist/zonos-elements/p-0d6c6a38.entry.js +1 -0
  297. package/dist/zonos-elements/p-0e28207a.js +1 -0
  298. package/dist/zonos-elements/{p-1efc348b.system.js → p-0ed63ce0.system.js} +1 -1
  299. package/dist/zonos-elements/p-0ef2a242.js +1 -0
  300. package/dist/zonos-elements/p-106ae0f1.entry.js +1 -0
  301. package/dist/zonos-elements/p-10797d2b.system.entry.js +1 -0
  302. package/dist/zonos-elements/p-195b33b6.system.entry.js +1 -0
  303. package/dist/zonos-elements/p-1fe5d4da.system.entry.js +1 -0
  304. package/dist/zonos-elements/{p-da4c01da.system.entry.js → p-2323ff0f.system.entry.js} +1 -1
  305. package/dist/zonos-elements/p-23293a0b.entry.js +1 -0
  306. package/dist/zonos-elements/{p-62813488.entry.js → p-23735db6.entry.js} +1 -1
  307. package/dist/zonos-elements/{p-ebaaaee9.entry.js → p-26573347.entry.js} +1 -1
  308. package/dist/zonos-elements/{p-e640e8b8.entry.js → p-29499a5f.entry.js} +1 -1
  309. package/dist/zonos-elements/p-29c80a34.js +1 -0
  310. package/dist/zonos-elements/{p-edc77ea1.entry.js → p-2a9681b4.entry.js} +1 -1
  311. package/dist/zonos-elements/{p-3f31901f.entry.js → p-2c9381be.entry.js} +1 -1
  312. package/dist/zonos-elements/p-2cc031b3.js +17 -0
  313. package/dist/zonos-elements/{p-7ab62a26.system.entry.js → p-34a37ce7.system.entry.js} +1 -1
  314. package/dist/zonos-elements/p-3c9714a8.system.entry.js +1 -0
  315. package/dist/zonos-elements/p-485416ec.js +1 -0
  316. package/dist/zonos-elements/p-56ee6d4b.system.entry.js +1 -0
  317. package/dist/zonos-elements/p-58afbe2b.entry.js +1 -0
  318. package/dist/zonos-elements/p-5e372fb9.entry.js +1 -0
  319. package/dist/zonos-elements/p-5ff4f9df.system.js +1 -0
  320. package/dist/zonos-elements/{p-92cc26b7.system.entry.js → p-60c61982.system.entry.js} +1 -1
  321. package/dist/zonos-elements/p-61c2c336.entry.js +1 -0
  322. package/dist/zonos-elements/p-6696617a.system.entry.js +1 -0
  323. package/dist/zonos-elements/p-6761091e.entry.js +1 -0
  324. package/dist/zonos-elements/p-6761286d.js +1 -0
  325. package/dist/zonos-elements/p-69451a50.system.js +1 -0
  326. package/dist/zonos-elements/p-69fd1b88.js +1 -0
  327. package/dist/zonos-elements/p-6dd63754.system.js +1 -0
  328. package/dist/zonos-elements/p-6e8aae27.system.entry.js +1 -0
  329. package/dist/zonos-elements/{p-1c45cd15.entry.js → p-70b81bbc.entry.js} +1 -1
  330. package/dist/zonos-elements/{p-eeb01de6.system.entry.js → p-750b7f32.system.entry.js} +1 -1
  331. package/dist/zonos-elements/p-772ac0b7.js +1 -0
  332. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  333. package/dist/zonos-elements/p-81e23f30.system.js +1 -0
  334. package/dist/zonos-elements/p-873b698a.entry.js +1 -0
  335. package/dist/zonos-elements/p-87e2a777.entry.js +1 -0
  336. package/dist/zonos-elements/p-8ca25e6c.entry.js +1 -0
  337. package/dist/zonos-elements/p-909d36bf.entry.js +1 -0
  338. package/dist/zonos-elements/p-95461a1b.system.entry.js +1 -0
  339. package/dist/zonos-elements/p-986ebccc.js +1 -0
  340. package/dist/zonos-elements/p-9c0b78bf.system.entry.js +1 -0
  341. package/dist/zonos-elements/p-a61a9b65.system.entry.js +1 -0
  342. package/dist/zonos-elements/p-a7204d41.entry.js +1 -0
  343. package/dist/zonos-elements/{p-d93ecc57.js → p-a8a312b2.js} +1 -1
  344. package/dist/zonos-elements/p-aca272ea.entry.js +1 -0
  345. package/dist/zonos-elements/p-b12ec9f2.system.entry.js +1 -0
  346. package/dist/zonos-elements/p-b1bd9fe7.system.entry.js +1 -0
  347. package/dist/zonos-elements/p-b2ae8eb7.system.js +1 -0
  348. package/dist/zonos-elements/{p-77666360.entry.js → p-b5406d26.entry.js} +1 -1
  349. package/dist/zonos-elements/p-bfbc081f.entry.js +1 -0
  350. package/dist/zonos-elements/p-c0a54cf6.system.js +1 -0
  351. package/dist/zonos-elements/p-c3c9b089.entry.js +1 -0
  352. package/dist/zonos-elements/p-c8784a01.system.entry.js +1 -0
  353. package/dist/zonos-elements/{p-7b5de646.entry.js → p-d045e2e5.entry.js} +1 -1
  354. package/dist/zonos-elements/p-d26cffba.entry.js +1 -0
  355. package/dist/zonos-elements/{p-544c173a.system.entry.js → p-d351ece6.system.entry.js} +1 -1
  356. package/dist/zonos-elements/p-d63696ac.system.js +17 -0
  357. package/dist/zonos-elements/p-ddb29c2a.system.entry.js +1 -0
  358. package/dist/zonos-elements/{p-d6fa2dc2.entry.js → p-dfb92907.entry.js} +1 -1
  359. package/dist/zonos-elements/{p-714c28b1.system.entry.js → p-e2a45188.system.entry.js} +1 -1
  360. package/dist/zonos-elements/{p-1ac8bfbb.system.entry.js → p-e455f060.system.entry.js} +1 -1
  361. package/dist/zonos-elements/p-eb54ece4.system.entry.js +1 -0
  362. package/dist/zonos-elements/{p-a98b1e8d.entry.js → p-efa6203f.entry.js} +1 -1
  363. package/dist/zonos-elements/{p-59eaebe3.system.entry.js → p-f0be0ca9.system.entry.js} +1 -1
  364. package/dist/zonos-elements/p-f129a83b.system.entry.js +1 -0
  365. package/dist/zonos-elements/p-f17fde5f.system.js +1 -0
  366. package/dist/zonos-elements/{p-47ffacd8.system.entry.js → p-f74a6b78.system.entry.js} +1 -1
  367. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  368. package/package.json +1 -1
  369. package/dist/cjs/zonos-card.cjs.entry.js +0 -49
  370. package/dist/esm/zonos-card.entry.js +0 -45
  371. package/dist/esm-es5/cart-010402f9.js +0 -1
  372. package/dist/esm-es5/localization-9db8b6e9.js +0 -1
  373. package/dist/esm-es5/paypal-70b140d9.js +0 -17
  374. package/dist/esm-es5/zonos-banner.entry.js +0 -1
  375. package/dist/esm-es5/zonos-card.entry.js +0 -1
  376. package/dist/esm-es5/zonos-cart-items_14.entry.js +0 -1
  377. package/dist/zonos-elements/p-043f57e8.system.entry.js +0 -1
  378. package/dist/zonos-elements/p-0a7ef032.entry.js +0 -1
  379. package/dist/zonos-elements/p-0e8bdf5c.js +0 -1
  380. package/dist/zonos-elements/p-164ba7ae.system.entry.js +0 -1
  381. package/dist/zonos-elements/p-242dd7ca.system.entry.js +0 -1
  382. package/dist/zonos-elements/p-300e0d47.system.entry.js +0 -1
  383. package/dist/zonos-elements/p-37aa481c.system.entry.js +0 -1
  384. package/dist/zonos-elements/p-3a1513ae.system.entry.js +0 -1
  385. package/dist/zonos-elements/p-425096c9.js +0 -1
  386. package/dist/zonos-elements/p-4cd33d08.entry.js +0 -1
  387. package/dist/zonos-elements/p-57f391e6.system.entry.js +0 -1
  388. package/dist/zonos-elements/p-58b3a0fc.entry.js +0 -1
  389. package/dist/zonos-elements/p-605a21ac.entry.js +0 -1
  390. package/dist/zonos-elements/p-608f965f.system.js +0 -1
  391. package/dist/zonos-elements/p-65c68531.js +0 -1
  392. package/dist/zonos-elements/p-680149ed.entry.js +0 -1
  393. package/dist/zonos-elements/p-6d44f441.system.js +0 -1
  394. package/dist/zonos-elements/p-7c88d2ac.entry.js +0 -1
  395. package/dist/zonos-elements/p-9ddb4533.system.entry.js +0 -1
  396. package/dist/zonos-elements/p-a91024b6.system.entry.js +0 -1
  397. package/dist/zonos-elements/p-a9d41e7c.system.entry.js +0 -1
  398. package/dist/zonos-elements/p-ad556be6.entry.js +0 -1
  399. package/dist/zonos-elements/p-ad8b1fe8.entry.js +0 -1
  400. package/dist/zonos-elements/p-afa4b4f0.js +0 -17
  401. package/dist/zonos-elements/p-b83b382e.system.js +0 -1
  402. package/dist/zonos-elements/p-b9ff6458.entry.js +0 -1
  403. package/dist/zonos-elements/p-d55aec11.system.entry.js +0 -1
  404. package/dist/zonos-elements/p-dcedcdda.entry.js +0 -1
  405. package/dist/zonos-elements/p-e11c61a5.entry.js +0 -1
  406. package/dist/zonos-elements/p-e17ac0d1.system.js +0 -17
  407. package/dist/zonos-elements/p-e1a7a85f.system.entry.js +0 -1
  408. package/dist/zonos-elements/p-ef1ce617.system.entry.js +0 -1
  409. package/dist/zonos-elements/p-ef34e1ce.entry.js +0 -1
  410. package/dist/zonos-elements/p-f54123b5.entry.js +0 -1
  411. package/dist/zonos-elements/p-f7300f5b.system.entry.js +0 -1
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-5fc34563.system.js","./p-6dd63754.system.js","./p-d63696ac.system.js","./p-07bea979.system.js","./p-81e23f30.system.js","./p-9d863a3b.system.js","./p-69451a50.system.js","./p-062430f9.system.js","./p-0ed63ce0.system.js","./p-40a4c8a2.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-e63b8b24.system.js","./p-e7f8595f.system.js","./p-1aa93d1e.system.js","./p-2770ba48.system.js","./p-5a2dd041.system.js","./p-cd1ebef9.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,h,f,v,m,p,z,g,w,k,b,y,_,C,x,S,T,O,A,I,E,N,j,P,L,D,U,R,B,Z,F,H,M,K,V,G,W,Y,q,J,Q,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,he,fe,ve,me,pe;return{setters:[function(e){o=e.r;t=e.h;n=e.H;r=e.F},function(e){i=e.s;s=e.a;c=e.b;a=e.c;u=e.i;d=e.d;l=e.e;h=e.f;f=e.g;v=e.h;m=e.j;p=e.k;z=e.l;g=e.m;w=e.t;k=e.n;b=e.o;y=e.p;_=e.q;C=e.r;x=e.u;S=e.v;T=e.w;O=e.x;A=e.y},function(e){I=e.p;E=e.s;N=e.a;j=e.b},function(e){P=e.f;L=e.l;D=e.a;U=e.g;R=e.s;B=e.V;Z=e.b;F=e.c;H=e.d},function(e){M=e.t},function(e){K=e.z;V=e.g;G=e.m},function(e){W=e.b},function(e){Y=e.h;q=e.l;J=e.b;Q=e.s;X=e.c;$=e.d;ee=e.e;oe=e.g;te=e.j;ne=e.a;re=e.i},function(e){ie=e.u},function(e){se=e._;ce=e.c;ae=e.a;ue=e.d;de=e.g},function(e){le=e.c},function(e){he=e.c},function(e){fe=e.g},function(e){ve=e.i},function(e){me=e.s},function(e){pe=e.R},function(){},function(){}],execute:function(){var ze=this;var ge=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,Y("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var we=function(e){return __awaiter(ze,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:if(i.length===0){return[2,null]}return[4,Y("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2,null]}r=P(n);return[2,r]}}))}))};var ke=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,h=e.customerZip,f=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var p=new URLSearchParams;p.set("tempCartUUID",o);if(a){p.set("customerFirstName",a)}if(u){p.set("customerLastName",u)}if(c){p.set("customerEmail",c)}if(d){p.set("customerPhone",d)}if(h){p.set("customerZip",h)}if(i){p.set("customerCity",i)}if(l){p.set("customerState",l)}if(s){p.set("zCountry",s)}if(n){p.set("customerAddress1",n)}if(r){p.set("customerAddress2",r)}if(v){p.set("zonosTestMode","1")}if(t){p.set("zonosCheckoutSessionId",t)}if(m){p.set("zonosVariantTest","1")}return"".concat(f,"?").concat(p.toString())};var be=function(e){if(e===void 0){e=true}if(!L.localizationLoaded){return true}if(L.isDisabledCountry){if(e){q("Checkout: disabled country")}return true}return false};var ye=function(e){if(e===void 0){e=true}if(!L.localizationLoaded){return false}if(!L.isShippableCountry){if(e){q("Checkout: not shippable country")}return false}return true};var _e=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(ze,void 0,void 0,(function(){var e,r,a,u,d;var l=this;return __generator(this,(function(h){e=document.querySelector(o);r=i();if(!e&&r){a=document.createElement("button");a.style.display="none";a.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(a);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}u=document.querySelector('select[name="shippingAddress.countryCode"]');d=document.querySelector("#checkout-shipping-continue");if(!u||!d){return[2]}n.disconnect();d.addEventListener("click",(function(e){return __awaiter(l,void 0,void 0,(function(){var o,t,n,r,i,a,d;return __generator(this,(function(l){n=u.value;if(!n){return[2]}D(n);if(!ye(false)){s();return[2]}r=document.querySelector("form");if(!r){return[2]}i=new FormData(r);a=document.querySelector("input#addressLine1Input");d={address1:(o=i.get("shippingAddress.address1"))!==null&&o!==void 0?o:a&&a.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:(t=i.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(d).some((function(e){return e===undefined||e===null}))){J("One or more shipping address field is missing",Object.entries(d));void Q({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(d))],metadata:{storeId:K.storeId}});return[2]}c({address1:d.address1,address2:d.address2,city:d.city,countryCode:d.countryCode,firstName:d.firstName,lastName:d.lastName,phone:d.phone,postalCode:d.postalCode,state:d.stateOrProvince});e.preventDefault();e.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var Ce=function(){var e=new URLSearchParams(window.location.search);q("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=U(e)||L.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var h=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:h,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var xe=0;var Se=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}q("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,Y("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);xe++;if(xe>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var Te=function(){return __awaiter(ze,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=X().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:$},ee()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void Y("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Oe=function(e){return __awaiter(ze,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:$},ee()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void Y("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Ae=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var Ie=function(e){var o;var t=(o=R.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Ee=function(e){return K.enabledVariantTestKeys.includes(e)};var Ne=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+B,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var je=function(e){return __awaiter(ze,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=oe();return[4,Y("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];q("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,je({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var Pe=function(e){return __awaiter(ze,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=se(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){J("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,je({cartId:e,retries:5})];case 1:r=i.sent();q("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){J("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Le='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var De=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h{z-index:2147483647;position:fixed}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var Ue=De;var Re=90*60*1e3;var Be=6*60*60*1e3;var Ze=e("zonos_checkout",function(){function e(e){var t=this;o(this,e);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.preview=false;this.hiddenMode=false;this.mobile=false;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.isOverlayLoading=false;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=a.clientSecret;this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||K.appearance.theme;return[4,u({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:I()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,c,u,l;var h=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=h===null||h===void 0?void 0:h.matches("#".concat(ce));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!o){q("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}q("Payment intent exist, checking stripe payment intent status");if(!r){q("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,d({clientSecret:r})];case 1:s=e.sent(),c=s.error,u=s.status;l=new URLSearchParams(window.location.search).get("redirect_status");if(l){if(!c){q("Payment intent is succeeded or in a good state to move forward, show success screen")}else{q("Payment intent failed, show status from error")}this.open=true;R.checkoutSessionId=i;a.clientSecret=r;void this.setToFinishStep(u);return[2,{shouldAllowOrder:false}]}if(!t){q("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}q("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.initializeTestKeys=function(){R.enabledVariantTestKeys=Ae(R.enabledVariantTestKeys||[]);var e=K.enabledVariantTestKeys.map((function(e){var o;var t=(o=R.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+B,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));Z(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){if(typeof K.checkoutSettings.createCartId!=="function"){return false}var e=K.enabledVariantTestKeys.includes("hosted_vs_native");if(!e){return false}return true};this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2]}q("[TEST] - Registering hosted vs native test");o=Ie("hosted_vs_native");if(o){q("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2]}return[4,we({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();if(!t){q("[TEST] - Failed to get selection for hosted vs native test");return[2]}n=Ne({baseTestObj:R.enabledVariantTestKeys||[],mergeTestObj:t});Z(n);return[2]}}))}))};this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2,{redirected:false}]}t=Ie("hosted_vs_native");q("[TEST] - hosted_vs_native: ".concat(t));if(typeof K.checkoutSettings.createCartId!=="function"){q("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2,{redirected:false}]}if(t!=="hosted"){q("[TEST] - Hosted vs native test is enabled for native, skipping");return[2,{redirected:false}]}if(!((e=K.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){q("[TEST] - Hosted checkout URL is not provided");return[2,{redirected:false}]}q('"createCartId" is provided, start building cart');return[4,K.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=Ce();c=ke(Object.assign(Object.assign({cartId:r,checkoutSessionId:R.checkoutSessionId||undefined,hostedCheckoutUrl:K.genericSettings.hostedCheckoutUrl,isTestMode:oe(),isVariantTest:true},s),i));q("[TEST] - Redirecting to: ".concat(c));window.open(c,"_blank");return[2,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=l.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.handleHostedOpenWindowCallback=function(e){var o;var t=(o=K.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;if(!origin){return}var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.includes(o)}));if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":R.checkoutSessionId=e.data.checkoutSessionId;break}};this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){R.checkoutSessionId=t}var n=R.enabledVariantTestKeys||[];if(window.Zonos.isLegacyCheckout){var r=Ie("hosted_vs_native");if(!r){n.push({expiresAt:Date.now()+B,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});Z(n)}else{Z(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void h({adjustments:l.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;E("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){f()}l.step="customer-info";v();m();(t=(o=K.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c,i,s,s,a,u,i,d;return __generator(this,(function(f){switch(f.label){case 0:if(!(typeof K.checkoutSettings.createCartId==="function"))return[3,4];q('"createCartId" is provided, start building cart');return[4,K.checkoutSettings.createCartId()];case 1:e=f.sent();o=void 0;if(typeof e==="object"){q("object detected, use cartId and prefill address from createCartId","info",e);o=e.cartId;this.useShippingDataFromCreateCartId(e.shippingData);l.customerAuthenticationToken=e.customerAuthenticationToken||null}else{o=e}window.Zonos.cartId=o;return[4,Pe(o)];case 2:t=f.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){J("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=W(n),i=r.adjustments,s=r.cartItems;return[4,h({adjustments:i,cartItems:s})];case 3:f.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];q("tempCartUUID is provided, start building cart");c=W(window.Zonos.cartData),i=c.adjustments,s=c.cartItems;return[4,h({adjustments:i,cartItems:s})];case 5:f.sent();return[3,9];case 6:if(!(K.checkoutSettings.buildCartDetail&&L.selectedCountryCode))return[3,9];q("build cart detail");return[4,K.checkoutSettings.buildCartDetail({countryCode:L.selectedCountryCode,currencyCode:L.targetCurrency})];case 7:s=f.sent();a=s.filter((function(e){return e.amount>=0}));u=s.filter((function(e){return e.amount<0}));q("cartItems","info",{cartItems:s});i=u.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,h({adjustments:i,cartItems:a})];case 8:f.sent();f.label=9;case 9:if(!!R.checkoutSessionId)return[3,11];return[4,p()];case 10:d=f.sent();q("stripeStoreInitCheckoutSession: ".concat(d));if(!d){return[2,false]}f.label=11;case 11:if(!l.isStagingMode){void z()}return[4,this.applyStripeTheme()];case 12:f.sent();this.isRedirectAfterOrder=K.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!l.externalConfirmationPageURL;return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=te(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;q("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Be;if(o>t){q("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;q("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!R.checkoutSessionId){return}void ie({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!R.checkoutSessionId){return}void ie({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!R.checkoutSessionId){return}void ie({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||K.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=K.checkoutSettings.placeOrderButtonSelector;var t=K.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;q("attach checkout ".concat(o));q("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData){return}var n=[o,t,"#".concat(ue),"#".concat(ce),"#".concat(ae)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}q("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,c,u,d,h,f,v,m,p,z,y,_,C;return __generator(this,(function(x){switch(x.label){case 0:i=performance.now();s=t&&n.matches(t);c=n.matches("#".concat(ae));u=n.matches("#".concat(ue))||n.matches("#".concat(ce));if(!window.Zonos.isLegacyCheckout&&(!ye()||be())&&!s&&!c&&!u){return[2]}o.preventDefault();o.stopPropagation();q("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=x.sent().shouldAllowOrder;if(!d){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void Se()}),2e3)}if(!Ee("hosted_vs_native"))return[3,4];this.isOverlayLoading=true;return[4,this.registerTestHostedVsNative()];case 2:x.sent();return[4,this.handleHostedVsNative()];case 3:h=x.sent().redirected;this.isOverlayLoading=false;if(h){return[2]}x.label=4;case 4:a.isFetchingSession=true;this.open=true;x.label=5;case 5:x.trys.push([5,8,,9]);return[4,this.buildCartAndInit()];case 6:f=x.sent();if(!f){throw new Error("Error building cart")}(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:R.checkoutSessionId,type:"zonos-checkout-session-update"},"*");g({isPreview:this.preview,sessionTimeout:Re});E("zonos-checkout-start");v=R.checkoutSessionId;void w({checkoutSessionId:v,eventName:"checkout_open"});return[4,ge()];case 7:m=x.sent().enabled;l.shouldHideDiscountInput=!m;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void Te()}else{p=performance.now();z=p-i;void Oe({loadTime:z})}this.recordCheckoutInfo();y=!!de();if(y){this.markTheSessionAsAbandonedCart()}return[3,9];case 8:_=x.sent();if(_ instanceof Error){C=_.message;if(C==="Cart is expired."){this.isCartExpired=true}}a.isFetchingSession=false;J(_);if(this.isCartExpired){a.isFetchingSession=true;return[2]}void Q({endpoint:"Error creating Checkout",errors:[_ instanceof Error?_.toString():"Unknown error"],metadata:{allLogs:$,cartId:window.Zonos.cartId,checkoutSessionBody:k(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||K.onlineStoreSettings.url}});b({messages:[M("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:M("Error creating Checkout")});return[3,9];case 9:return[2]}}))}))}),{capture:true,passive:false});if(!K.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(ue))){n.dispatchEvent(he("click"));s();n.remove()}if(n.matches("#".concat(ce))){n.dispatchEvent(he("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}q("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var h=new URLSearchParams(window.location.search);var f=r||U(h)||L.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:f,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);q("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=U(e)||L.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerFirstName");var u=o("customerLastName");var d=o("customerPhone");var l=o("customerZip");var h=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:a,customerLastName:u,customerName:c,customerPhone:d,customerState:h,customerZip:l})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!s||!c||!t){q("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&L.shippingZoneCountries&&!(t in L.shippingZoneCountries)){q('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];q("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){l.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){a.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;l.isStagingMode=ne();if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}_e({domesticRedirectedBtnSelector:ue,onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){a.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){q("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}q("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){l.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){y(e);return[2]}))}))};e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(ae));if(e){e.dispatchEvent(he("click"))}return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;var u=this;return __generator(this,(function(d){switch(d.label){case 0:E("zonos-checkout-customer-info");r=R.checkoutSessionId;void w({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,_()];case 1:i=d.sent().isRequestNotReady;if(i&&l.addressFormRenderType==="stripe"){void Q({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=a.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=a.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(l.step!=="customer-info"){clearInterval(e);return}if(!a.isFetchingLandedCost){if(l.landedCostData){void j({currency:l.currency});C()}u.submitLoading=false;if(e){clearInterval(e)}}};s();c=setInterval((function(){s(c)}),20);setTimeout((function(){clearInterval(c)}),1e4);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){C();return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=a.checkoutSettlementCurrency==="USD";if(e&&a.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;N.paypalErrorMessage=null;a.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;return[4,x()];case 1:o=i.sent();if(!o){a.hasPaymentError=true;a.customErrorMessage=M("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:a.checkoutSettlementCurrency});this.submitLoading=false;return[2]}i.label=2;case 2:i.trys.push([2,4,,5]);t=l;return[4,S()];case 3:t.inventoryCheckErrorMessage=i.sent();return[3,5];case 4:n=i.sent();l.inventoryCheckErrorMessage=M("Unable to check inventory. Please try again.");return[3,5];case 5:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i.label=6;case 6:i.trys.push([6,8,,9]);return[4,T()];case 7:i.sent();C();m();return[3,9];case 8:r=i.sent();J(r);E("zonos-checkout-payment-fail");a.hasPaymentError=true;if(a.shouldInventoryRefund){void O();a.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:A();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||K.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=re(this.mobile);void this.applyStripeTheme();q("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=re(this.mobile);void this.applyStripeTheme();q("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=V(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){A()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){q("No customer profile","info");this.defaultCustomerProfileAddress=[];return}q("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=a.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=a.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){q("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){window.Zonos.openHelloDialog(false);if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=re(this.mobile);this.isIframed=window.self!==window.top;q("iframed: ".concat(this.isIframed));if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=F("selectedLocale",(function(){void e.applyStripeTheme()}));this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);q("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){A();f();this.onChangeLocaleListener();window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,c;this.customerProfile=a.customerProfile;this.clientSecret=a.clientSecret;if(a.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret}var u=l.step!=="finish"&&l.step!=="error"&&!a.stripeElements||a.isFetchingSession;var d=G(K.appearance,this.appearanceSettingsOverride||null),h=d.colorPrimary,f=d.colorSecondary,v=d.logoUrl,m=d.style;var p=K.appearance.zonosAttribution==="ENABLED";var z=K.appearance.theme;var g=h&&ve(h)?"DARK":"LIGHT";var w=this.isMobile?z:g;var k=!this.isMobile?f:undefined;var b=L.customMessages;var y=(o=b.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var _=this.getCurrentLocalePageEnum();var C=b.filter((function(e){return e.pageName===_}));var x=this.getBaseCurrencySettlementInfo();var S=function(){var o=e.preview?"".concat(v,"?timestamp=").concat(Date.now()):v;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(K.organizationName," logo"),src:o}))};var T=oe();var O=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||ne();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},S(),T&&t("zonos-badge",{badgeColor:"orange",size:"small"},M("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},M("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),t("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),C.map((function(e){return t("zonos-custom-message",{icon:Le,message:e.message})})))};var A=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:M("Your checkout session has expired. Please reload the page to continue."),restStateTitle:M("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},M("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":fe({overrideBorderStyle:m})}},l.step!=="finish"&&l.step!=="error"&&t(r,null,t("div",{class:"zonos--left","data-theme":w,style:me({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&O(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:k}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:k}),l.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:k})),t("div",{class:"zonos--right","data-theme":z},e.isMobile&&O(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:pe}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:k}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Le,message:y})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Le,message:y}))))),(l.step==="finish"||l.step==="error")&&t("div",{class:"zonos--done","data-theme":z},t("div",{class:"zonos--header"},S(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:pe}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:z})),t("zonos-checkout-finish",{borderRadius:m,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":z,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return t(n,{class:le(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?A():t("zonos-dialog",{borderStyle:m,"data-theme":z,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},A()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:M("Don't close"),dialogConfirmBtnText:M("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:M("Would you like to close checkout and return to the site?"),dialogTitle:M("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:M("Return to merchant site"),dialogConfirmBtnText:M("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?M("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):M("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null)}),dialogTitle:M("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:M("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:M("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),x&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:M("Cancel"),dialogConfirmBtnText:M("Pay [orderTotal]",{orderTotal:H({amount:x.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:M("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:M("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:M("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:M("You are being sent back to the shop to re-add items to your cart."),dialogTitle:M("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}());Ze.style=Ue}}}));
@@ -1 +1 @@
1
- System.register(["./p-5fc34563.system.js"],(function(t){"use strict";var o,s;return{setters:[function(t){o=t.r;s=t.h}],execute:function(){function n(t,o,s){return(t||"")+(o?" ".concat(o):"")+(s?" ".concat(s):"")}var h=":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}div{color:red;font-size:large}";var i=h;var e=t("zonos_component",function(){function t(t){o(this,t);this.first="";this.middle="";this.last=""}t.prototype.getText=function(){return n(this.first,this.middle,this.last)};t.prototype.render=function(){return s("div",{key:"725c727348687e663e6225837a2a135d177b6d4a"},"Hello, World! I'm ",this.getText())};return t}());e.style=i}}}));
1
+ System.register(["./p-5fc34563.system.js"],(function(t){"use strict";var o,s;return{setters:[function(t){o=t.r;s=t.h}],execute:function(){function n(t,o,s){return(t||"")+(o?" ".concat(o):"")+(s?" ".concat(s):"")}var h=":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}div{color:red;font-size:large}";var i=h;var r=t("zonos_component",function(){function t(t){o(this,t);this.first="";this.middle="";this.last=""}t.prototype.getText=function(){return n(this.first,this.middle,this.last)};t.prototype.render=function(){return s("div",{key:"757e42d63a24b18216b900937089c2566dd44a93"},"Hello, World! I'm ",this.getText())};return t}());r.style=i}}}));
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as o,H as i}from"./p-b30c2ad9.js";import{c as n}from"./p-485416ec.js";import{i as s,e as r,s as c,a as l}from"./p-69fd1b88.js";import{z as a,e as d,f as h}from"./p-7ce093aa.js";import{g as u,i as p,a as m}from"./p-e7b0c156.js";import{h as f,b as v,l as w}from"./p-a8a312b2.js";import"./p-986ebccc.js";import"./p-56e0ed65.js";import"./p-2b9c124d.js";import"./p-04a01cb1.js";const g=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},y=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},b=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483647",document.body.appendChild(o),e},S=async t=>{if(window.Zonos.isLegacyCheckout)return void w("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=b({position:"bottom-right"});o=t}if(o&&s(o)){if(w("Hello init complete"),!g(o)){const e=new MutationObserver((()=>{g(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{g(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){w(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=b({position:y(t.notFoundElementFallback)});g(e)}}),3e3)}}else v(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class z{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,i;const n=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(i=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===i?void 0:i.defaultView);if(t.source!==s)return;if(!this.isValidMessage(n))return;const r=this.listeners.get(n.type);null==r||r.forEach((t=>{try{t(n.payload)}catch(t){v("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),w(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,i=this.listeners.get(t);return i&&i.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class j extends z{constructor(){w("=== [Google Places Service] Initializing","info"),super(p.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};w(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(i,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class O{constructor(){this.googlePlaceInitialized=!1,w("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new j,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{w("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{w("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{w(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{w(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const I=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7)}async initCheckoutElement(t){var e;t?(n.stripe=t,((e=a.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||s(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||s(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():v(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):v(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),w("init checkout element")):w("Stripe is not loaded yet - cannot init checkout element","warn")}async initCollectElement(t){t?(n.stripe=t,window.Zonos.cartData&&(()=>{if(!document.querySelector("zonos-collect")){const t=document.createElement("zonos-collect");document.body.appendChild(t)}})(),w("init Collect element")):w("Stripe is not loaded yet - cannot init Collect element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const i=t||h();if("Inter"===i){if(!t)return;w("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t})}const n=new URLSearchParams;n.set("family",i);const{errors:s,json:r}=await f(`/api/zonos-elements/get-font-detail?${n.toString()}`);if(s.length>0)return w(`Failed to load font ${i}`,"warn"),void(a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(w(`[FONT] ${t} font override applied`),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t}))}handleLocationChange(){S(a.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect)return void w("=== Skip injecting custom HTML for hosted checkout","info");w("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)}))}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&m({id:p.GOOGLE_PLACES,onload:()=>{a.checkoutAddressService=new O},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}buildBaseConfig(t){var e,o;const i=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0});if(window.Zonos.isCollect)return Object.assign(Object.assign({},this.config),{checkoutSettings:i,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})});if(!this.config.checkoutSettings)return Object.assign(Object.assign({},this.config),{checkoutSettings:void 0});const n=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(e=this.config.checkoutSettings)||void 0===e?void 0:e.successBehavior);return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},i),{successBehavior:n?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:n?(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||(null==t?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})}async componentWillLoad(){this.initHistoryListener(),a.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,i;const{errors:n,json:s,zonosMode:c}=await(async()=>{if(window.Zonos.cartSettings)return{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=u(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const{errors:o,json:i,zonosMode:n}=await f(`/api/zonos-elements/zonos-settings?${e.toString()}`);return o.length?(v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:i,zonosMode:n}})();if("403"===(null===(e=null===(t=n[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void w("Failed to load zonos settings. This domain may not have access","warn");const l=(null===(o=null==s?void 0:s.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(l),this.initZonosNotification();const h=this.buildBaseConfig(s),p=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==s?void 0:s.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()})}),h);d({overrideSettings:p,zonosSettings:s}),a.zonosMode=c,this.setupGoogleFont(),"DISABLED"===a.helloSettings.visibilityStatus&&w("=== Hello is disabled by store owner ===","warn"),a.helloSettings&&"ENABLED"===a.helloSettings.visibilityStatus&&(w("Initializing hello"),S(a.helloSettings)),await r();const m=(null===(i=null==s?void 0:s.checkoutSettings)||void 0===i?void 0:i.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(m&&this.stripeInitEvent){if(window.Zonos.isCollect)return this.stripeInitEvent.emit({publishableKey:m.token}),void this.initGooglePlacesService(s);if("INACTIVE"===a.checkoutSettings.subscriptionStatus)return w('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void w("zonos controller loaded");if("DISABLED"===a.checkoutSettings.visibilityStatus)return w("=== Checkout is disabled by store owner ===","warn"),void w("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:m.token}),this.initGooglePlacesService(s)}else w("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):w("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,n.clientSecret=""}async overrideConfig(t){d({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){w(`Override country code to ${t}`),l(t)}async getAppearanceSetting(){return a.appearance}async updateOrganizationName(t){a.organizationName=t}render(){return o(i,{key:"bfc37564859305654a77081919eaaed52387ab40",class:"zonos--elements"})}};I.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{visibility:hidden;opacity:0;height:0}";export{I as zonos_controller}
@@ -1 +1 @@
1
- import{r as o,c as s,h as t,H as e}from"./p-b30c2ad9.js";import{f as n}from"./p-7ce093aa.js";import{c as a}from"./p-b4b7f705.js";import"./p-04a01cb1.js";const r=class{constructor(t){o(this,t),this.toggleChanged=s(this,"toggleChanged",7),this.options=[]}render(){return t(e,{key:"9a526e8fee8e4c5af558442c82f7acbc634706c3",class:a(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":n()}},t("div",{key:"97ca281e8e782c3b08231c6ba705325bbf16d402",class:"wrapper"},this.options.map((o=>t("button",{class:a(["zonos--option",o.value===this.value&&"selected"]),key:o.value,onClick:()=>{this.toggleChanged.emit(o.value)}},o.label)))))}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";export{r as zonos_toggle}
1
+ import{r as o,c as s,h as t,H as e}from"./p-b30c2ad9.js";import{f as n}from"./p-7ce093aa.js";import{c as a}from"./p-b4b7f705.js";import"./p-04a01cb1.js";const r=class{constructor(t){o(this,t),this.toggleChanged=s(this,"toggleChanged",7),this.options=[]}render(){return t(e,{key:"1490dbdc9cc90d4d51ccc9e665fb5ee00455bf0e",class:a(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":n()}},t("div",{key:"af24e513fc988893be3dba1a08044d69c9493522",class:"wrapper"},this.options.map((o=>t("button",{class:a(["zonos--option",o.value===this.value&&"selected"]),key:o.value,onClick:()=>{this.toggleChanged.emit(o.value)}},o.label)))))}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";export{r as zonos_toggle}
@@ -1 +1 @@
1
- import{r as o,h as t,H as s}from"./p-b30c2ad9.js";import{c as e}from"./p-b4b7f705.js";const a=class{constructor(t){o(this,t),this.label="",this.subtitle="",this.showTooltip=!1}render(){return t(s,{key:"d984faacc8d79f2001c84fb69c30f3665dca44aa",class:"zonos--elements"},t("div",{key:"327f9d077f2400f05ff3c4337b566c461a2d05cf",class:"zonos--tooltip",onMouseEnter:()=>this.showTooltip=!0,onMouseLeave:()=>this.showTooltip=!1},t("slot",{key:"24315359176ca625f18a856d781624850d05de17"}),t("div",{key:"296041bbebddd0250c6d5d9649e6502571a08533",class:e([this.showTooltip&&"zonos--show-tooltip","zonos--tooltip-content"])},t("zonos-text",{key:"5a2828baf420acb666eb1f0029c8d0b9eadd55ce",size:"s",textColor:"gray-0",type:"boldLabel"},this.label),t("zonos-text",{key:"1bd8bf5085edfdc3d42db03e460062bf744c174b",size:"xs",textColor:"gray-0"},this.subtitle))))}};a.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--tooltip{position:relative}:host .zonos--tooltip .zonos--tooltip-content{position:absolute;bottom:100%;left:0;width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:12px;background-color:var(--zonos-elements-gray-1000);opacity:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:var(--zonos-elements-radius-4);z-index:100;-webkit-box-shadow:var(--zonos-elements-v3-shadow-large);box-shadow:var(--zonos-elements-v3-shadow-large)}:host .zonos--tooltip .zonos--tooltip-content.zonos--show-tooltip{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";export{a as zonos_tooltip}
1
+ import{r as o,h as t,H as s}from"./p-b30c2ad9.js";import{c as e}from"./p-b4b7f705.js";const a=class{constructor(t){o(this,t),this.label="",this.subtitle="",this.showTooltip=!1}render(){return t(s,{key:"10a391b40266e3f80d94f0870754fc1a5aaa1822",class:"zonos--elements"},t("div",{key:"31236e53e67d2199204894d02590bfa5e54eaf8e",class:"zonos--tooltip",onMouseEnter:()=>this.showTooltip=!0,onMouseLeave:()=>this.showTooltip=!1},t("slot",{key:"37a6de3ef4e6fdd64ecb3f3bdcc21f0dd091e4da"}),t("div",{key:"ecd0222cd1a712790b8864d265919278493e8252",class:e([this.showTooltip&&"zonos--show-tooltip","zonos--tooltip-content"])},t("zonos-text",{key:"afb6494edf8cbe4e3257a27cdc815b91995704e7",size:"s",textColor:"gray-0",type:"boldLabel"},this.label),t("zonos-text",{key:"8d7c0ce999a9ee7fe49dd506497343734c99f76e",size:"xs",textColor:"gray-0"},this.subtitle))))}};a.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--tooltip{position:relative}:host .zonos--tooltip .zonos--tooltip-content{position:absolute;bottom:100%;left:0;width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:12px;background-color:var(--zonos-elements-gray-1000);opacity:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:var(--zonos-elements-radius-4);z-index:100;-webkit-box-shadow:var(--zonos-elements-v3-shadow-large);box-shadow:var(--zonos-elements-v3-shadow-large)}:host .zonos--tooltip .zonos--tooltip-content.zonos--show-tooltip{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";export{a as zonos_tooltip}
@@ -1 +1 @@
1
- import{r as t,h as o}from"./p-b30c2ad9.js";const s=class{constructor(o){t(this,o),this.first="",this.middle="",this.last=""}getText(){return(this.first||"")+((t=this.middle)?` ${t}`:"")+((o=this.last)?` ${o}`:"");var t,o}render(){return o("div",{key:"725c727348687e663e6225837a2a135d177b6d4a"},"Hello, World! I'm ",this.getText())}};s.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}div{color:red;font-size:large}";export{s as zonos_component}
1
+ import{r as t,h as o}from"./p-b30c2ad9.js";const s=class{constructor(o){t(this,o),this.first="",this.middle="",this.last=""}getText(){return(this.first||"")+((t=this.middle)?` ${t}`:"")+((o=this.last)?` ${o}`:"");var t,o}render(){return o("div",{key:"757e42d63a24b18216b900937089c2566dd44a93"},"Hello, World! I'm ",this.getText())}};s.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}div{color:red;font-size:large}";export{s as zonos_component}
@@ -0,0 +1 @@
1
+ const t=t=>{const e=t.items.map((t=>({amount:t.amount,attributes:t.attributes||[],countryOfOrigin:t.countryOfOrigin||void 0,currencyCode:t.currencyCode,description:t.description||"",imageUrl:t.imageUrl||"",itemType:t.itemType||"PHYSICAL_GOOD",measurements:t.measurements||[],name:t.name||t.description||"",productId:t.productId||"",quantity:t.quantity||0,sku:t.sku||""})))||[];return{adjustments:t.adjustments,cartItems:e}};export{t as b}
@@ -1 +1 @@
1
- import{r as t,h as s,H as o,a as i}from"./p-b30c2ad9.js";import{f as e}from"./p-7ce093aa.js";import"./p-04a01cb1.js";const h=class{constructor(s){t(this,s),this.collapsed=!1,this.collapseSize=0,this.height=this.el.scrollHeight,this.iframe=null}getElementHeight(){return this.collapsed?`${this.collapseSize}px`:`${this.height}px`}componentDidLoad(){this.height=this.el.scrollHeight}componentDidRender(){var t,s,o;this.iframe=(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector("iframe"))||null,null===(o=null===(s=this.iframe)||void 0===s?void 0:s.contentWindow)||void 0===o||o.addEventListener("resize",(()=>{this.iframe&&(this.height=parseFloat(getComputedStyle(this.iframe).height))}))}render(){return this.collapsed?this.el.style.overflow="hidden":setTimeout((()=>{this.collapsed||(this.el.style.overflow="visible")}),300),s(o,{key:"f27608bd02d0800dda8273909aa3041311dda3eb",class:"zonos--elements zonos--collapse",style:{"--zonos--font-family":e(),height:this.getElementHeight()}},s("div",{key:"7901ab34757169767c99b46523e8cc353874a606"},s("iframe",{key:"1d1e735c535df07e209878f6d66089ab30b943a3",class:"height-change-listener",tabindex:"-1",title:"collapse-height-change-listener"}),s("slot",{key:"213bb5f472be8dfcd026207d706f8a0a3227f5cb"})))}get el(){return i(this)}};h.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;overflow:hidden}:host div{position:relative}:host iframe{width:0;height:100%;position:absolute;top:0;border:0}";export{h as zonos_collapse}
1
+ import{r as t,h as s,H as e,a as o}from"./p-b30c2ad9.js";import{f as i}from"./p-7ce093aa.js";import"./p-04a01cb1.js";const h=class{constructor(s){t(this,s),this.collapsed=!1,this.collapseSize=0,this.height=this.el.scrollHeight,this.iframe=null}getElementHeight(){return this.collapsed?`${this.collapseSize}px`:`${this.height}px`}componentDidLoad(){this.height=this.el.scrollHeight}componentDidRender(){var t,s,e;this.iframe=(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector("iframe"))||null,null===(e=null===(s=this.iframe)||void 0===s?void 0:s.contentWindow)||void 0===e||e.addEventListener("resize",(()=>{this.iframe&&(this.height=parseFloat(getComputedStyle(this.iframe).height))}))}render(){return this.collapsed?this.el.style.overflow="hidden":setTimeout((()=>{this.collapsed||(this.el.style.overflow="visible")}),300),s(e,{key:"617e4c1a39bae3c5765ba05c6c7d3585c1822aea",class:"zonos--elements zonos--collapse",style:{"--zonos--font-family":i(),height:this.getElementHeight()}},s("div",{key:"a4ef3763a3b2d802faacd4cc12dc84cfe9ad55a5"},s("iframe",{key:"f44ea760cb5c088241a737bd9b82ae0eac22f426",class:"height-change-listener",tabindex:"-1",title:"collapse-height-change-listener"}),s("slot",{key:"c01b886c941c6c50753d50cec244701c9854e589"})))}get el(){return o(this)}};h.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;overflow:hidden}:host div{position:relative}:host iframe{width:0;height:100%;position:absolute;top:0;border:0}";export{h as zonos_collapse}
@@ -1 +1 @@
1
- import{r as o,h as s,d as t,H as a}from"./p-b30c2ad9.js";import{f as e}from"./p-7ce093aa.js";import{c as r}from"./p-b4b7f705.js";import"./p-04a01cb1.js";const i=class{constructor(s){o(this,s),this.theme="LIGHT",this.width="auto"}render(){const o="DARK"===this.theme?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return s(a,{key:"c41a277084d4880e1f452a1f7ca097ad3507059f",class:r(["zonos--elements zonos--logo"]),style:{"--zonos--filter-color":o,"--zonos--font-family":e(),"--zonos--width":this.width}},s("img",{key:"01361446c08074a8f8b4cac206a999e381d5d903",alt:"Zonos Logo",src:t("./assets/ZonosLogo.png")}))}static get assetsDirs(){return["assets"]}};i.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--zonos--filter-color);filter:var(--zonos--filter-color);width:var(--zonos--width)}";export{i as zonos_logo}
1
+ import{r as o,h as s,d as t,H as e}from"./p-b30c2ad9.js";import{f as a}from"./p-7ce093aa.js";import{c as r}from"./p-b4b7f705.js";import"./p-04a01cb1.js";const i=class{constructor(s){o(this,s),this.theme="LIGHT",this.width="auto"}render(){const o="DARK"===this.theme?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return s(e,{key:"0b8e78167613096d36d1f500e21284194246974e",class:r(["zonos--elements zonos--logo"]),style:{"--zonos--filter-color":o,"--zonos--font-family":a(),"--zonos--width":this.width}},s("img",{key:"d657a31c178c580a90e268ebc4b06fb4d0e15eae",alt:"Zonos Logo",src:t("./assets/ZonosLogo.png")}))}static get assetsDirs(){return["assets"]}};i.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--zonos--filter-color);filter:var(--zonos--filter-color);width:var(--zonos--width)}";export{i as zonos_logo}
@@ -0,0 +1,17 @@
1
+ import{z as o,c as e}from"./p-7ce093aa.js";import{t as n,z as r,c as t,e as a,v as i,r as s,j as c}from"./p-485416ec.js";import{s as l}from"./p-69fd1b88.js";import{t as u}from"./p-986ebccc.js";import{h as d,l as p,b as v,j as y}from"./p-a8a312b2.js";import{t as f}from"./p-56e0ed65.js";
2
+ /*!
3
+ * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
+ * Copyright 2020-present, PayPal, Inc. All rights reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */function w(o,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=o,Object.keys(e).forEach((function(o){n.setAttribute(o,e[o]),"data-csp-nonce"===o&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function b(o){return window[o]}function h(o,e){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var n=o.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}const m=({backgroundColor1:o,backgroundColor2:e})=>f.readability(o,e)>2.5,P=e=>{const n=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));n&&"DISABLED"!==(null==n?void 0:n.status)&&"function"==typeof window.gtag&&(p("Zonos submits gtag event","log",e),window.gtag("event",e,{}))},{onChange:j,reset:k,state:g}=e((()=>({intent:"capture",orderIdCreated:null,paypal:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),I=({checkoutSessionId:e,onPaypalFail:l,onPaypalSessionDone:p,overrideBorderRaidus:f,overridePrimaryColor:w})=>({createOrder:async()=>{n({checkoutSessionId:e,eventName:"checkout_paymentInfoCompleted",metadata:{paymentMethod:"paypal"}});const o=await r();if(!o.valid)return g.paypalErrorMessage=o.errorMessage,t.hasPaymentError=!1,t.customErrorMessage=null,null==l||l(),"";try{g.paypalErrorMessage=null,a.inventoryCheckErrorMessage=null;try{a.inventoryCheckErrorMessage=await i()}catch(o){a.inventoryCheckErrorMessage=u("Unable to check inventory. Please try again.")}return a.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var e,n;const r=g.intent.toUpperCase(),{errors:t,json:a}=await(async({checkoutSessionId:o,intent:e})=>{const{errors:n,json:r}=await d("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o,intent:e},method:"POST"});return{errors:n,json:r}})({checkoutSessionId:o,intent:r}),i=null===(e=null==a?void 0:a.paypalOrderCreate)||void 0===e?void 0:e.paypalOrderId;if(t.length||!i)throw new Error((null===(n=t.find(Boolean))||void 0===n?void 0:n.message)||"An unexpected error occurred when creating paypal order.");return i})({checkoutSessionId:e})}catch(o){return v("Failed to create paypal order",o),g.paypalErrorMessage=u("Failed to create PayPal order. Please try again, or consider using an alternative method."),t.hasPaymentError=!1,t.customErrorMessage=null,null==l||l(),""}},onApprove:async()=>{try{g.paypalErrorMessage=null,P("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{var n,r;const{errors:t,json:a}=await(async({checkoutSessionId:o,paypalMockResponse:e})=>{const{errors:n,json:r}=await d("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:e},method:"POST"});return{errors:n,json:r}})({checkoutSessionId:o,paypalMockResponse:e}),i=null===(n=null==a?void 0:a.paypalOrderCapture.order)||void 0===n?void 0:n.id;if(t.length||!i)throw new Error((null===(r=t.find(Boolean))||void 0===r?void 0:r.message)||u("An unexpected error occurred when processing PayPal order."));return i})({checkoutSessionId:e,paypalMockResponse:window.Zonos._paypalMockResponse});g.orderIdCreated=o,null==p||p({orderId:o}),s(),c()}catch(o){if(v("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var e;const n=y(o.message),r=null===(e=null==n?void 0:n.errors.find(Boolean))||void 0===e?void 0:e.message,t=(null==r?void 0:r.match(/\[(.*?)\] (.*)/i))||[];t||(g.paypalErrorMessage=u("An unexpected error occurred when processing PayPal order."));const a=t[2]||u("An unexpected error occurred when processing PayPal order.");g.paypalErrorMessage=a})({error:o});null==l||l()}},style:{borderRadius:"SHARP"===f?0:10,color:m({backgroundColor1:"#ffc33a",backgroundColor2:w||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),E=async({currency:e})=>{var n;if(!(null===(n=o.checkoutSettings.externalPaymentMethods)||void 0===n?void 0:n.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void p("=== Paypal is disabled for this store","warn");const r=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!r)return void p("Failed to load paypal -- missing paypal publishable key","warn");const t=o.zonosMode&&"production"!==o.zonosMode||"LIVE"!==o.checkoutSettings.mode?"sandbox":"production";g.intent=o.checkoutSettings.captureDelay&&o.checkoutSettings.captureDelay>0?"authorize":"capture",p("==== Paypal order intent","info",g.intent),window.Zonos.paypal=await function(o,e){if(void 0===e&&(e=Promise),h(o,e),"undefined"==typeof document)return e.resolve(null);var n=function(o){var e="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(e=o.sdkBaseUrl,delete o.sdkBaseUrl);var n,r,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,e){var n=t[e].toString();return"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,e){return(e?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===e?o.attributes[e]=n:o.queryParams[e]=n,o}),{queryParams:{},attributes:{}}),i=a.queryParams,s=a.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(e,"?").concat((n=i,r="",Object.keys(n).forEach((function(o){0!==r.length&&(r+="&"),r+=o+"="+n[o]})),r)),attributes:s}}(o),r=n.url,t=n.attributes,a=t["data-namespace"]||"paypal",i=b(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,e){var n=document.querySelector('script[src="'.concat(o,'"]'));if(null===n)return null;var r=w(o,e),t=n.cloneNode();if(delete t.dataset.uidAuto,Object.keys(t.dataset).length!==Object.keys(r.dataset).length)return null;var a=!0;return Object.keys(t.dataset).forEach((function(o){t.dataset[o]!==r.dataset[o]&&(a=!1)})),a?n:null}(r,t)&&i?e.resolve(i):function(o,e){void 0===e&&(e=Promise),h(o,e);var n=o.url,r=o.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new e((function(o,e){if("undefined"==typeof document)return o();!function(o){var e=o.onSuccess,n=o.onError,r=w(o.url,o.attributes);r.onerror=n,r.onload=e,document.head.insertBefore(r,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(o)}})}))}({url:r,attributes:t},e).then((function(){var o=b(a);if(o)return o;throw new Error("The window.".concat(a," global variable is not available."))}))}({clientId:r.token,currency:e,environment:t,intent:g.intent}),g.paypal=window.Zonos.paypal,p("==== Paypal script loaded")},S=o=>{var e;const n=window.Zonos.paypal;if(!n)return p("Paypal is not available"),null;const r=l.checkoutSessionId;if(!r)return p("Paypal is not available due to checkoutSessionId is not available"),null;p("==== Loading Paypal buttons"),g.paypalButtons.length&&(g.paypalButtons.forEach((async o=>{await o.close()})),g.paypalButtons=[]);const t=[null===(e=n.FUNDING)||void 0===e?void 0:e.PAYPAL].filter(Boolean);return g.paypalButtons=t.map((e=>{var t;let a=null;try{a=(null===(t=n.Buttons)||void 0===t?void 0:t.call(n,Object.assign(Object.assign({},I(Object.assign({checkoutSessionId:r,fundingSource:e},o))),{fundingSource:e})))||null}catch(o){p(`===== Failed to load paypal's "${e}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(p(`==== Paypal button ${e} loaded`),a):null})).filter(Boolean),g.paypalButtons},A=()=>{var e,n;return"ENABLED"===(null===(n=null===(e=o.checkoutSettings.externalPaymentMethods)||void 0===e?void 0:e.find((o=>"PAYPAL"===o.type)))||void 0===n?void 0:n.status)||!!g.paypalButtons.length};export{g as a,E as b,k as c,S as d,j as e,m as i,A as p,P as s}
@@ -1 +1 @@
1
- System.register(["./p-5fc34563.system.js","./p-9d863a3b.system.js","./p-23e7c655.system.js","./p-5a2dd041.system.js"],(function(o){"use strict";var t,s,e,n,a,r;return{setters:[function(o){t=o.r;s=o.c;e=o.h;n=o.H},function(o){a=o.f},function(o){r=o.c},function(){}],execute:function(){var i=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";var l=i;var d=o("zonos_toggle",function(){function o(o){t(this,o);this.toggleChanged=s(this,"toggleChanged",7);this.options=[]}o.prototype.render=function(){var o=this;return e(n,{key:"9a526e8fee8e4c5af558442c82f7acbc634706c3",class:r(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":a()}},e("div",{key:"97ca281e8e782c3b08231c6ba705325bbf16d402",class:"wrapper"},this.options.map((function(t){var s=t.value===o.value;return e("button",{class:r(["zonos--option",s&&"selected"]),key:t.value,onClick:function(){o.toggleChanged.emit(t.value)}},t.label)}))))};return o}());d.style=l}}}));
1
+ System.register(["./p-5fc34563.system.js","./p-9d863a3b.system.js","./p-23e7c655.system.js","./p-5a2dd041.system.js"],(function(o){"use strict";var t,s,e,n,a,r;return{setters:[function(o){t=o.r;s=o.c;e=o.h;n=o.H},function(o){a=o.f},function(o){r=o.c},function(){}],execute:function(){var i=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";var l=i;var d=o("zonos_toggle",function(){function o(o){t(this,o);this.toggleChanged=s(this,"toggleChanged",7);this.options=[]}o.prototype.render=function(){var o=this;return e(n,{key:"1490dbdc9cc90d4d51ccc9e665fb5ee00455bf0e",class:r(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":a()}},e("div",{key:"af24e513fc988893be3dba1a08044d69c9493522",class:"wrapper"},this.options.map((function(t){var s=t.value===o.value;return e("button",{class:r(["zonos--option",s&&"selected"]),key:t.value,onClick:function(){o.toggleChanged.emit(t.value)}},t.label)}))))};return o}());d.style=l}}}));
@@ -0,0 +1 @@
1
+ var __extends=this&&this.__extends||function(){var t=function(n,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)if(Object.prototype.hasOwnProperty.call(n,e))t[e]=n[e]};return t(n,e)};return function(n,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(n,e);function i(){this.constructor=n}n.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function u(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(s,u)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(n){return c([t,n])}}function c(u){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,u[0]&&(e=0)),e)try{if(i=1,o&&(r=u[0]&2?o["return"]:u[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;if(o=0,r)u=[u[0]&2,r.value];switch(u[0]){case 0:case 1:r=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){e.label=u[1];break}if(u[0]===6&&e.label<r[1]){e.label=r[1];r=u;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(u);break}if(r[2])e.ops.pop();e.trys.pop();continue}u=n.call(t,e)}catch(t){u=[6,t];o=0}finally{i=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var i=0,o=n.length,r;i<o;i++){if(r||!(i in n)){if(!r)r=Array.prototype.slice.call(n,0,i);r[i]=n[i]}}return t.concat(r||Array.prototype.slice.call(n))};System.register(["./p-5fc34563.system.js","./p-6dd63754.system.js","./p-07bea979.system.js","./p-9d863a3b.system.js","./p-4160bbc2.system.js","./p-062430f9.system.js","./p-81e23f30.system.js","./p-e7f8595f.system.js","./p-e63b8b24.system.js","./p-5a2dd041.system.js"],(function(t){"use strict";var n,e,i,o,r,s,u,c,a,f,l,d,h,v,w,p,m,g;return{setters:[function(t){n=t.r;e=t.c;i=t.h;o=t.H},function(t){r=t.c},function(t){s=t.i;u=t.e;c=t.s;a=t.a},function(t){f=t.z;l=t.e;d=t.f},function(t){h=t.g;v=t.i;w=t.a},function(t){p=t.h;m=t.b;g=t.l},function(){},function(){},function(){},function(){}],execute:function(){var _=this;var b=function(){return __awaiter(_,void 0,void 0,(function(){var t,n,e,i,o,r;return __generator(this,(function(s){switch(s.label){case 0:if(window.Zonos.cartSettings){return[2,{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode}]}t=h();n=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){n.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}return[4,p("/api/zonos-elements/zonos-settings?".concat(n.toString()))];case 1:e=s.sent(),i=e.errors,o=e.json,r=e.zonosMode;if(i.length){m("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:i,json:null,zonosMode:r}]}return[2,{errors:[],json:o,zonosMode:r}]}}))}))};var y=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var S=function(t){if(!t.placeOrderButtonSelector&&!t.alwaysTriggerInternationalCheckoutSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!s(t.placeOrderButtonSelector)){m('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}if(t.alwaysTriggerInternationalCheckoutSelector&&!s(t.alwaysTriggerInternationalCheckoutSelector)){m('Selector alwaysTriggerInternationalCheckoutSelector "'.concat(t.alwaysTriggerInternationalCheckoutSelector,'" is not a valid selector'));return}y()};var j=function(){var t=document.querySelector("zonos-collect");if(!t){var n=document.createElement("zonos-collect");document.body.appendChild(n)}};var z=function(){if(!window.Zonos.cartData){return}j()};var O=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var k=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var I=function(t){var n=t.position,e=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var o=document.querySelector(i);if(o){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(e==="top-right"){r.style.top="72px";r.style.right="24px"}if(e==="top-left"){r.style.top="72px";r.style.left="24px"}if(e==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(e==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483647";document.body.appendChild(r);return i};var A=function(t){return __awaiter(_,void 0,void 0,(function(){var n,e,i,o,r;return __generator(this,(function(u){if(window.Zonos.isLegacyCheckout){g("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;e=n;if(!t.anchorElementSelector&&t.desktopLocation){i=I({position:"bottom-right"});e=i}if(!e||!s(e)){m('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}g("Hello init complete");o=O(e);if(!o){r=new MutationObserver((function(){var t=O(e);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){O(e)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){g("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=I({position:k(t.notFoundElementFallback)});O(n)}}),3e3)}return[2]}))}))};var T=function(){function t(t,n){var e=this;this.targetId=t;this.allowedEvents=n;this.listeners=new Map;this.handleMessage=function(t){var n,i,o;var r=t.data;var s=((n=e.iframe)===null||n===void 0?void 0:n.contentWindow)||((o=(i=e.iframe)===null||i===void 0?void 0:i.contentDocument)===null||o===void 0?void 0:o.defaultView);if(t.source!==s){return}if(!e.isValidMessage(r)){return}var u=e.listeners.get(r.type);u===null||u===void 0?void 0:u.forEach((function(t){try{t(r.payload)}catch(t){m("Error in event listener:",t)}}))};this.initializeEventListeners();this.iframe=document.getElementById(this.targetId)}t.prototype.initializeEventListeners=function(){window.addEventListener("message",this.handleMessage)};t.prototype.isValidMessage=function(t){if(!t||typeof t!=="object")return false;var n=t;return n.id===this.targetId&&typeof n.type==="string"&&this.allowedEvents.includes(n.type)&&n.payload!==undefined};t.prototype.on=function(t,n){var e=this;if(!this.listeners.has(t)){this.listeners.set(t,new Set)}g("[CheckoutAddressService] listening to ".concat(t),"info");var i=n;var o=this.listeners.get(t);if(o){o.add(i)}return function(){var n=e.listeners.get(t);if(n){n.delete(i)}}};t.prototype.destroy=function(){window.removeEventListener("message",this.handleMessage);this.listeners.clear()};return t}();var C=function(t){__extends(n,t);function n(){g("=== [Google Places Service] Initializing","info");return t.call(this,v.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])||this}n.prototype.sendMessage=function(t,n){var e;if(!((e=this.iframe)===null||e===void 0?void 0:e.contentWindow)){return}var i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:n,type:t};g("GooglePlacesService] parent --\x3e ".concat(t),"info",n);this.iframe.contentWindow.postMessage(i,"*")};n.prototype.initialize=function(){this.sendMessage("initializeGooglePlacesService",{})};n.prototype.fetchSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!n){return}this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[n],input:e},type:i})};n.prototype.selectPlace=function(t){var n=t.placeId,e=t.type;this.sendMessage("placeSelected",{placeId:n,type:e})};return n}(T);var E=function(){function t(){var t=this;this.googlePlaceInitialized=false;g("=== [CheckoutAddressService] Initializing","info");this.googlePlaces=new C;this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info");t.googlePlaceInitialized=true}));this.initialize()}t.prototype.initialize=function(){this.googlePlaces.initialize()};t.prototype.onInitializeGooglePlacesService=function(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(function(){g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService");t()}))};t.prototype.isGooglePlaceInitialized=function(){return this.googlePlaceInitialized};t.prototype.onAddressSuggestions=function(t){this.suggestionsCallback=t;return this.googlePlaces.on("onFetchAutocompleteSuggestions",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.onAddressSelected=function(t){this.placeSelectedCallback=t;return this.googlePlaces.on("onPlaceSelected",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}g.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onPlaceSelected ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.getAddressSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!this.googlePlaceInitialized){return}this.googlePlaces.fetchSuggestions({country:n,query:e,type:i})};t.prototype.selectAddress=function(t){var n=t.placeId,e=t.type;this.googlePlaces.selectPlace({placeId:n,type:e})};t.prototype.destroy=function(){this.googlePlaces.destroy();if(this.suggestionsCallback){this.suggestionsCallback=undefined}if(this.placeSelectedCallback){this.placeSelectedCallback=undefined}};return t}();var P=":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{visibility:hidden;opacity:0;height:0}";var x=P;var L=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=e(this,"paypalInitEvent",7);this.stripeInitEvent=e(this,"stripeInitEvent",7)}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){g("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}r.stripe=t;void S(f.checkoutSettings);g("init checkout element");return[2]}))}))};t.prototype.initCollectElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){g("Stripe is not loaded yet - cannot init Collect element","warn");return[2]}r.stripe=t;void z();g("init Collect element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,i,o,r,s,u,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||d();if(i==="Inter"){if(!t){return[2]}g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t})}o=new URLSearchParams;o.set("family",i);return[4,p("/api/zonos-elements/get-font-detail?".concat(o.toString()))];case 1:r=a.sent(),s=r.errors,u=r.json;if(s.length>0){g("Failed to load font ".concat(i),"warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:"Inter"});return[2]}c=u===null||u===void 0?void 0:u.fontUrl;if(c){(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,c)}if(!t){return[2]}g("[FONT] ".concat(t," font override applied"));f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void A(f.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect){g("=== Skip injecting custom HTML for hosted checkout","info");return}g("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var e=n.content.querySelectorAll("script");e.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}))};t.prototype.initGooglePlacesService=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;return __generator(this,(function(i){n=t===null||t===void 0?void 0:t.genericSettings;if(!n){return[2]}e=n.signedTokenGooglePlaces;if(!e){return[2]}w({id:v.GOOGLE_PLACES,onload:function(){f.checkoutAddressService=new E},src:"".concat("https://route.elements.zonos.com","/iframe/google-maps?signedToken=").concat(e)});return[2]}))}))};t.prototype.buildBaseConfig=function(t){var n,e;var i=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined});if(window.Zonos.isCollect){return Object.assign(Object.assign({},this.config),{checkoutSettings:i,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})})}if(!this.config.checkoutSettings){return Object.assign(Object.assign({},this.config),{checkoutSettings:undefined})}var o=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((n=this.config.checkoutSettings)===null||n===void 0?void 0:n.successBehavior)==="CLOSE_MODAL";return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},i),{successBehavior:o?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:o?((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||(t===null||t===void 0?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();f.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,i,o,r,s,c,a,d,h,v,w;var p=this;return __generator(this,(function(m){switch(m.label){case 0:return[4,b()];case 1:o=m.sent(),r=o.errors,s=o.json,c=o.zonosMode;if(((n=(t=r[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){g("Failed to load zonos settings. This domain may not have access","warn");return[2]}a=((e=s===null||s===void 0?void 0:s.checkoutSettings)===null||e===void 0?void 0:e.customHTML)||"";this.injectCustomHTML(a);this.initZonosNotification();d=function(){var t,n,e;if(window.Zonos.isLegacyCheckout){return((t=s===null||s===void 0?void 0:s.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=p.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(e=p.config.appearance)===null||e===void 0?void 0:e.logoUrl};h=this.buildBaseConfig(s);v=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:d()})}),h);l({overrideSettings:v,zonosSettings:s});f.zonosMode=c;void this.setupGoogleFont();if(f.helloSettings.visibilityStatus==="DISABLED"){g("=== Hello is disabled by store owner ===","warn")}if(f.helloSettings&&f.helloSettings.visibilityStatus==="ENABLED"){g("Initializing hello");void A(f.helloSettings)}return[4,u()];case 2:m.sent();w=((i=s===null||s===void 0?void 0:s.checkoutSettings)===null||i===void 0?void 0:i.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!w||!this.stripeInitEvent){g("Checkout failed to load -- missing publishable key","warn");return[2]}if(window.Zonos.isCollect){this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(s);return[2]}if(f.checkoutSettings.subscriptionStatus==="INACTIVE"){g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");g("zonos controller loaded");return[2]}if(f.checkoutSettings.visibilityStatus==="DISABLED"){g("=== Checkout is disabled by store owner ===","warn");g("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(s);return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){g("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){c.checkoutSessionId=null;r.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){l({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){g("Override country code to ".concat(t));void a(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,f.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){f.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(o,{key:"bfc37564859305654a77081919eaaed52387ab40",class:"zonos--elements"})};return t}());L.style=x}}}));
@@ -0,0 +1 @@
1
+ import{z as e,c as t}from"./p-7ce093aa.js";import{s as o,l as n,f as s,b as r}from"./p-69fd1b88.js";import{t as i}from"./p-986ebccc.js";import{l as a,f as d,h as l,g as c,a as u,s as m,d as p,b as v,j as h}from"./p-a8a312b2.js";import{i as y}from"./p-56e0ed65.js";import{g}from"./p-2b9c124d.js";const w=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const s=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=s[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||s.slice(1).join(" ").trim()||""}},f=({currentAddress:e,translatedAddress:t})=>{var o,n,s,r,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(s=t.line2)||void 0===s?void 0:s[u||""])||u||"",name:(null===(r=t.name)||void 0===r?void 0:r[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},b=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),s=P.stripeLinkEventData,r=P.stripeAddressEventData,i=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(!r||!i)throw new Error("Missing stripe address data");const a=f({currentAddress:r,translatedAddress:P.translatedAddress.address}),{firstName:d,lastName:l}=w({name:a.name}),c=f({currentAddress:i,translatedAddress:P.translatedAddress.address}),{firstName:u,lastName:m}=w({name:c.name});return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:u,lastName:m,phone:c.phone},cartCurrencyCode:null===(t=ne.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==s?void 0:s.value.email,firstName:d,lastName:l,phone:a.phone},isTest:!!n,landedCostAdjustments:ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:P.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}},S=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=P.stripeLinkEventData,n=P.stripeAddressEventData,s=P.stripeShippingSameAsBilling?P.stripeAddressEventData:P.stripeBillingAddressEventData;if(a({stripeAddressData:n,stripeBillingAddressData:s},"info"),!n||!s)throw new Error("Missing stripe address data");const r=f({currentAddress:n,translatedAddress:P.translatedAddress.address}),{firstName:i,lastName:d}=w({name:r.name}),l=f({currentAddress:s,translatedAddress:P.translatedAddress.address}),{firstName:c,lastName:u}=w({name:l.name}),m=ne.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),p=ne.promoCode?[{amount:0,productId:null,promoCode:ne.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:P.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:d,phone:r.phone},isTest:e,items:ne.items,landedCostAdjustments:p,shipToTaxId:P.taxId,shippingAddress:{addressLine1:r.line1,addressLine2:r.line2,city:r.city,country:r.country,postalCode:r.postal_code,state:r.state}}};const C=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,s,r;const i=S(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:d.vercel});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(s=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===s?void 0:s.message)||"Unknown error"}`);const{errors:c,json:u}=await l("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(r=c.find(Boolean))||void 0===r?void 0:r.message)||"Unknown error"}`);return a})(n);return e}const{errors:s,json:r}=await l("/api/zonos-elements/calculate-landed-cost",{body:S(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r){if("The user aborted a request."===(null===(o=s[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(s.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!r)throw new Error("Failed to calculate landed cost");return r}return r})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n,s,r,i;const{errors:a,json:d}=await l("/api/zonos-elements/cart-calculate-landed-cost",{body:b(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(s=a[0])||void 0===s?void 0:s.message.includes("signal is aborted"))||(null===(r=a[0])||void 0===r?void 0:r.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:t,cartId:o}),{cartWorkflow:s}=n,r=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},r),{itemCreateWorkflow:s.items})},O=async({checkoutSessionId:t,eventName:o,metadata:s})=>{var r,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const v=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(r=window.Zonos)||void 0===r?void 0:r.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((c()||u()||v)&&!window.Zonos.zonosConversionTest)return;const h=n.selectedCountryCode,y=e.organizationId;if(!t)return void m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:p,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:d}});y||m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:p,checkoutSessionId:t,eventName:o,metadata:s,organizationId:y,trackEventLogs:d}});const g={checkoutSessionId:t,countryCode:h,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},s),{trackEventLogs:d}),organizationId:y};await l("/api/zonos-elements/track-conversion-event",{body:g,method:"POST"})},A=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},k=e=>e.sort(((e,t)=>e.amount-t.amount)),I=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await l(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(v("Failed to retrieve checkout session info before confirming payment ",t),m({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:p}}),{errorMessage:i("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(v("Landed cost is not found in the checkout session before confirming payment."),m({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:p}}),{errorMessage:i('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},N=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".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"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},j=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:g({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:g({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:T,reset:E,state:P}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),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:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),L=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},D=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},x=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return h(e)},R=async t=>{var o,s;const r=P.clientSecret;if(!P.stripe)return void a("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:s,overrideSecondaryColor:r,overrideTheme:i,paypalEnabled:a})=>{const d=s||e.appearance.colorPrimary,l=r||e.appearance.colorSecondary,c=d&&y(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},N({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},j({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:P.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:r,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),d=JSON.stringify(i)===JSON.stringify(P.stripeElementsOptions);if(!P.stripeElements||!P.stripeElementsForBillingAddress)return P.stripeElementsForBillingAddress=null===(o=P.stripe)||void 0===o?void 0:o.elements(i),a("Stripe elements for billing address initialized"),P.stripeElements=null===(s=P.stripe)||void 0===s?void 0:s.elements(i),P.stripeElementsOptions=i,void a("Stripe elements initialized");d||(P.stripeElements.update(i),P.stripeElementsForBillingAddress.update(i),P.stripeElementsOptions=i,P.stripeElements.fetchUpdates()),a("Stripe elements updated")},_=()=>{sessionStorage.removeItem("zonos--client-secret"),E(),P.stripe=window.Zonos.stripe},z=({address:e,firstName:t,lastName:n,name:s,phone:r})=>{const{firstName:i,lastName:a}=w({firstName:t,lastName:n,name:s});return i&&a||m({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:s}}),r||m({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:r}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:r||"",postal_code:e.postal_code,state:e.state}},U=async()=>{var e,t,n,s;if(!(null===(e=P.stripeAddressEventData)||void 0===e?void 0:e.complete)||!P.stripeShippingSameAsBilling&&!(null===(t=P.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!P.stripeBillingAddressEventData)return{partiesCreated:!1};if(!ne.landedCostData)return{partiesCreated:!1};const r=null===(n=ne.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!r)return m({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,s,r;const i=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=P.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeAddressEventData)||void 0===n?void 0:n.value),d=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(s=P.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===s?void 0:s.value)!==JSON.stringify(null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value);return i||a||d||P.taxIdUsedWhenAsyncAddressUpdate!==P.taxId||P.companyNameUsedWhenAsyncAddressUpdate!==P.companyName})();if(!i)return{partiesCreated:!1};const a=z({address:P.stripeAddressEventData.value.address,firstName:P.stripeAddressEventData.value.firstName,lastName:P.stripeAddressEventData.value.lastName,name:P.stripeAddressEventData.value.name,phone:P.stripeAddressEventData.value.phone}),d=P.stripeShippingSameAsBilling?a:z({address:P.stripeBillingAddressEventData.value.address,firstName:P.stripeBillingAddressEventData.value.firstName,lastName:P.stripeBillingAddressEventData.value.lastName,name:P.stripeBillingAddressEventData.value.name,phone:P.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:u,json:h}=await l("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:P.companyName,email:(null===(s=P.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isTest:c,rootId:r,taxId:P.taxId},method:"POST"});return u.length||!h?(v("Error occurs when creating parties",JSON.stringify(u,null,2)),m({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:u,json:h}}),{partiesCreated:!1}):(P.companyNameUsedWhenAsyncAddressUpdate=P.companyName,P.stripeAddressUsedWhenAsyncAddressUpdate=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenAsyncAddressUpdate=P.stripeBillingAddressEventData,P.taxIdUsedWhenAsyncAddressUpdate=P.taxId,P.partyBillingId=h.billToPartyId,P.partyShippingId=h.shipToPartyId,{partiesCreated:!0})},B=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),F=async t=>{var n,s,r,i;const d=(null==t?void 0:t.retries)||0,l=!!(null==t?void 0:t.applyingPromocode),c=(()=>{var e;const t=ne.landedCostData&&(null===(e=ne.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==ne.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=P.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.value),n=P.stripeAddressEventData&&JSON.stringify(B(P.stripeAddressEventData.value))!==JSON.stringify(P.stripeAddressUsedWhenFetchingLC),s=!P.stripeShippingSameAsBilling&&P.stripeBillingAddressEventData&&JSON.stringify(B(P.stripeBillingAddressEventData.value))!==JSON.stringify(P.stripeBillingAddressUsedWhenFetchingLC);return o||n||s})();return a("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!ne.landedCostData&&!P.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,s;const r=!!(null===(t=P.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.complete),a=P.stripeShippingSameAsBilling?i:!!(null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const s=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,r=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===ne.addressFormRenderType&&(r&&t in r?r[t]:null)||(s&&t in s?s[t]:null)})((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US");return!!(i&&a&&r)||(d&&P.stripeAddressEventData?r&&P.stripeAddressEventData.value.firstName&&P.stripeAddressEventData.value.lastName&&P.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&P.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&P.stripeAddressEventData.value.address.postal_code.length>=3)&&P.stripeAddressEventData.value.phone&&P.stripeAddressEventData.value.phone.length>0:i&&a&&r)})())return{isRequestNotReady:!0};if(c&&(null===(n=P.fetchingLandedCostAbortController)||void 0===n||n.abort(),P.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};d?(P.isFetchingLandedCost=!1,setTimeout((()=>{P.isFetchingLandedCost=!0}),300)):P.isFetchingLandedCost=!0,P.stripeAddressEventData&&(P.stripeAddressUsedWhenFetchingLC={countryCode:P.stripeAddressEventData.value.address.country,postalCode:P.stripeAddressEventData.value.address.postal_code,state:P.stripeAddressEventData.value.address.state}),P.stripeBillingAddressEventData&&(P.stripeBillingAddressUsedWhenFetchingLC={countryCode:P.stripeBillingAddressEventData.value.address.country,postalCode:P.stripeBillingAddressEventData.value.address.postal_code,state:P.stripeBillingAddressEventData.value.address.state}),P.stripeLinkEventData&&(P.stripeLinkUsedWhenFetchingLC=Object.assign({},P.stripeLinkEventData));try{we(),await(async()=>{var e;const t=new AbortController;P.fetchingLandedCostAbortController=t,we();const{checkoutSessionWorkflow:n,errors:s,itemCreateWorkflow:r,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await C(t);ne.customQuotingError=(null===(e=null==s?void 0:s.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,ne.shippingData=k((null==d?void 0:d.filter(Boolean))||[]),ae(r),P.fetchingLandedCostAbortController=null,ne.partiesData=(null==a?void 0:a.filter(Boolean))||[],ne.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&O({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=ne.promoCodeApplied&&!ne.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));ne.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",ne.promoCode)})();const e=null===(s=ne.shippingData)||void 0===s?void 0:s.find(Boolean),t=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ce({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(ne.landedCostData=[],ne.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(d<1)return await F(Object.assign(Object.assign({},t),{retries:(d||0)+1})),{isRequestNotReady:!1};const o=null===(i=P.stripeAddressEventData)||void 0===i?void 0:i.value;m({endpoint:`Failed to fetch landed cost (${d} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}v(e)}return P.isFetchingLandedCost=!1,{isRequestNotReady:!1}},J=async()=>{var e,t;await F({applyingPromocode:!0}),"payment"===ne.step&&be(),await U();const o=null===(e=ne.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=ne.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await he({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},M=()=>{ne.promoCode="",sessionStorage.removeItem("zonos--promo-code"),ne.promoCodeError=!1,ne.promoCodeApplied=!1},W=async()=>{"payment"===ne.step&&be(),M(),await J()},$=e=>{let t=[],o=!0;const n=window.Zonos.isCollect;switch(e){case"succeeded":t=[i("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."),"",i("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.")],n&&(t=[i("Thank you for submitting your payment. We appreciate your prompt attention."),"",i("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.")]),o=!1;break;case"requires_capture":case"processing":t=[i("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[i("Payment failed. Please try another payment method.")],n&&(t=[i("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[i("Something went wrong.")]}return{isError:o,messages:t}},q=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(v("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(P.shouldInventoryRefund=!0,null):null:i("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:ne.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw m({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:ne.items}}),e}},Y=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},H=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=$(t);return{error:e,messages:o}}const o=e||P.clientSecret;if(!P.stripe||!o)return v("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[i("Something went wrong.")]};const{paymentIntent:n}=await P.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:r,messages:a}=$(s);return{error:r,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},K=async e=>{var t,n;const s=!!(null===(t=P.stripePaymentEventData)||void 0===t?void 0:t.complete),r=P.stripeElements,d=P.stripe,l=P.clientSecret;if(P.customErrorMessage=null,!(null===(n=ne.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await I();if(!c.valid)throw P.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(d&&r&&s&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),O({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await d.confirmPayment({confirmParams:{return_url:e.toString()},elements:r,redirect:"if_required"});if(a("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(i("Payment failed. Please try another payment method."))}},G=()=>{var e;const t=ne.items.reduce(((e,t)=>e+t.amount*t.quantity),0),s=o.enabledVariantTestKeys||[];return{adjustmentsAmount:ne.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=ne.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:ne.customerAuthenticationToken||void 0,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:s}},V=async()=>{var e;if(!o.checkoutSessionId)return m({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:p,cartId:window.Zonos.cartId}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});const{errors:t,json:n}=await l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return v("Error occurs when getting payment intent",JSON.stringify(t,null,2)),m({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});me(n.checkoutSessionPaymentIntentCreate)},Z=async()=>{var e,t;if(!n.targetCurrency)return v("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;P.isFetchingSession=!0;const o=G();a("Checkout session body","info",o);const{errors:s,json:r}=await l("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(P.isFetchingSession=!1,s.length||!r){const t=null===(e=s.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return v("Error occurred when creating checkout session",JSON.stringify(s,null,2)),!1}const i=r.checkoutSessionCreate;return me(i),ce({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),a("Exchange rate updated for cart items (checkout session create)","info",ne.exchangeRate),a("done-init-checkout-session"),!0},Q=async()=>{const t=o.checkoutSessionId;if(!t)return v("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return a('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:P.checkoutSettlementCurrency},method:"POST"}),s=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&s===P.checkoutSettlementCurrency?(a(`Updated checkout session to settlement currency "${s}".`),!0):(v("Failed to update checkout session base currency"),!1)},X=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:s,line2:r,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&s&&(o.line1={[e.line1]:s}),e.line2&&r&&(o.line2={[e.line2]:r}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},ee=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,s,r;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:s})=>{const r=!!(null==o?void 0:o.complete);if(!r||!(s?r:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=w({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=w({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:A({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:s?void 0:A({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:P.stripeAddressEventData,stripeBillingAddressEventData:P.stripeBillingAddressEventData,stripeShippingSameAsBilling:P.stripeShippingSameAsBilling});if(!i)return void(P.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const s=JSON.stringify(null===(e=P.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=P.stripeAddressEventData)||void 0===t?void 0:t.value),r=!P.stripeShippingSameAsBilling&&JSON.stringify(null===(o=P.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=P.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return s||r})();if(!a)return;const{errors:d,json:c}=await l("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!c)return v("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(P.translatedAddress={address:{},billingAddress:{}});P.stripeAddressUsedWhenValidatingAddress=P.stripeAddressEventData,P.stripeBillingAddressUsedWhenValidatingAddress=P.stripeBillingAddressEventData;const u=null===(o=P.stripeAddressEventData)||void 0===o?void 0:o.value.address,m=null===(n=P.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;P.translatedAddress={address:u?X({currentAddress:Object.assign(Object.assign({},u),{name:null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:P.stripeShippingSameAsBilling?{}:X({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=P.stripeBillingAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.billingAddress||null})}};T("clientSecret",(e=>{e&&P.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:te,reset:oe,state:ne}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:u(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),se=e=>{switch(e){case"DAYS":return i("days");case"WEEKS":return i("weeks");default:return i("business days")}},re=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:se(o.type)}:null},ie=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),ae=e=>{a("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=ne.items.find((t=>ie({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return ne.restrictedItems=t,ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>ie({item1:t,item2:e})))}))),{cartItems:ne.items,restrictedItems:t}},de=()=>{o.checkoutSessionId=null,oe()},le=({messages:e,title:t})=>{de(),_(),ne.step="error",ne.error={messages:e,title:t}},ce=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{ne.exchangeRate=o.exchangeRate,ne.adjustmentTotal=o.adjustments,ne.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,ne.subtotal=o.items,ne.total=o.total,ne.currency=o.presentmentCurrencyCode,ne.dutiesTaxesFeesEstimate=e||null},ue=()=>!!ne.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),me=e=>{var t,n,i,d,l;P.clientSecret=e.clientSecret,P.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,P.customerProfile=e.customerProfile,ne.checkoutSession=e,e.id||m({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:p,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const c=s(e.varianceTestResults||[]);r(c);const u=(null===(i=null===(n=null===(t=ne.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===i?void 0:i.value)||(null===(l=null===(d=window.Zonos.cartData)||void 0===d?void 0:d.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===l?void 0:l.value)||null;u&&(a(`Found externalConfirmationPageURL: ${u}`),ne.externalConfirmationPageURL=u)},pe=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:r,itemsAmount:d,landedCostId:c,shouldInitSessionOnFailure:u})=>{var m;if(c&&ne.selectedLandedCost&&(ce({dutiesTaxesFeesEstimate:r,method:ne.landedCostMethod,subtotals:ne.selectedLandedCost.subtotals}),a("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate)),!o.checkoutSessionId)return a("Could not update cart total without checkout session id","info"),!1;const{errors:p,json:h}=await(async({adjustmentsAmount:e,cartId:t,currency:s,id:r,itemsAmount:i,landedCostId:a,presentmentCountryCode:d})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:m}=await l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,customerAuthenticationToken:ne.customerAuthenticationToken||void 0,id:r,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:P.partyShippingId,skipPaymentIntent:P.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!m?(v("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:m}):{errors:[],json:m}})({adjustmentsAmount:e,billToPartyId:P.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:d,landedCostId:c,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(p.length>0||!h){if(v("Error occurs when updating checkout session."),u){a("Initiating checkout session on failure","info");const e=await Z();return a(`stripeStoreInitCheckoutSession: ${e}`),!!e||(le({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")}),!1)}return!1}return c||(ce({method:(null===(m=h.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:h.checkoutSessionUpdate.subtotals}),a("Exchange rate updated for cart items (checkout session update)","info",ne.exchangeRate)),me(h.checkoutSessionUpdate),!0},ve=t=>{var o,n,s;return"DAP"===t.method&&(null===(n=null===(o=e.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(s=P.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US"))||"DAP"===t.method&&t.remittance.length&&"ZONOS"===t.landedCostGuaranteeCode?"DDP":t.method},he=async({applySubtotalsOnly:t,landedCostId:n,selectedShippingOption:s})=>{var r,i,d,l,c,u,m,p,v,h,y;a("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:s}),ne.selectedShippingOption=s;const g=re(ne.selectedShippingOption);if(g){const{maxTransit:e,minTransit:t,unit:o}=g;ne.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else ne.selectedShippingOptionTransitTime="";const w=null===(r=ne.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(ne.selectedLandedCost=w||null,!w)return!1;const f=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;f&&a(`DAP quote, using estimate: ${f}`,"info"),ne.landedCostMethod=ve(w.landedCost),ne.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==w?void 0:w.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));ne.isSelectedShippingAboveDeminimis=S,ne.isSelectedShippingGuarantee=b;let C=!1;t?(ce({dutiesTaxesFeesEstimate:f,method:ne.landedCostMethod,subtotals:w.subtotals}),a("Exchange rate updated for cart items (landed cost subtotal)","info",ne.exchangeRate),C=!0):C=await pe({adjustmentsAmount:ne.adjustmentTotal,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:f,landedCostId:null===(u=w.landedCost)||void 0===u?void 0:u.id,shipToPartyId:P.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=ne.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(p=P.stripeAddressEventData)||void 0===p?void 0:p.value.address.country)||"US";return P.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=ne.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=e.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},ye=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;a(`==START CHECKOUT TIMEOUT - ${n}==`),ne.checkoutTimeoutInterval=setTimeout((()=>{ne.checkoutSessionTimeoutShow=!0}),n)},ge=()=>{ne.checkoutTimeoutInterval&&(clearTimeout(ne.checkoutTimeoutInterval),ne.checkoutTimeoutInterval=null)},we=()=>{ne.items=ne.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),ne.restrictedItems=[]},fe=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:s=!0})=>{var r;ne.adjustments=e,ne.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(r=t.find(Boolean))||void 0===r?void 0:r.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(ne.currency=i,P.isFetchingSession=!0,await pe({adjustmentsAmount:d,billToPartyId:P.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:P.partyShippingId,shouldInitSessionOnFailure:s,varianceTestInput:o.enabledVariantTestKeys||[]}),P.isFetchingSession=!1)},be=()=>{"shipping"===ne.step?(ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"payment"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})})):"finish"===ne.step&&(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1})}))},Se=()=>{"customer-info"===ne.step?(ne.step="shipping",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!0})})):"shipping"===ne.step?(ne.step="payment",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!0})})):"payment"===ne.step&&(ne.step="finish")},Ce=()=>{ne.step="customer-info",ne.tabItems=Object.assign(Object.assign({},ne.tabItems),{"customer-info":Object.assign(Object.assign({},ne.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},ne.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},ne.tabItems.shipping),{isDone:!1})}),ne.selectedShippingOption=null,ne.isSelectedShippingAboveDeminimis=!1,ne.isSelectedShippingGuarantee=!1,ne.selectedShippingOptionTransitTime="",ne.dutiesTaxesFees=0,ne.dutiesTaxesFeesEstimate=0,ne.shipping=0,ne.total=ne.subtotal};export{T as A,z as B,he as C,ue as D,J as E,W as F,M as G,$ as H,ee as I,w as J,te as K,U as L,re as M,ve as N,k as O,L as a,D as b,P as c,H as d,ne as e,fe as f,de as g,Ce as h,R as i,ge as j,Z as k,V as l,ye as m,G as n,le as o,me as p,F as q,Se as r,x as s,O as t,Q as u,q as v,K as w,Y as x,_ as y,I as z}