@zonos/elements 1.3.265 → 1.3.267

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 (264) hide show
  1. package/dist/cjs/{cart-c325b9e4.js → cart-ed2de167.js} +1 -1
  2. package/dist/cjs/getContrastColor-ce80dbe7.js +54 -0
  3. package/dist/cjs/{hasInclusivePrice-40358cb1.js → hasInclusivePrice-bf31fbdb.js} +1 -1
  4. package/dist/cjs/index.cjs.js +7 -7
  5. package/dist/cjs/{invoice-ac9414df.js → invoice-542c23e7.js} +2 -2
  6. package/dist/cjs/{isCollectMobileTablet-92fa5e8f.js → isCollectMobileTablet-fe8149a5.js} +2 -2
  7. package/dist/cjs/{localization-06cc0379.js → localization-66d378ab.js} +52 -1
  8. package/dist/cjs/{paypal-b52e1f24.js → paypal-d8282578.js} +2 -2
  9. package/dist/cjs/{placeTestOrder-d93a6f2b.js → placeTestOrder-0a4b9dd7.js} +2 -2
  10. package/dist/cjs/{renderCheckoutCurrency-1f521ea7.js → renderCheckoutCurrency-ac9083d9.js} +2 -2
  11. package/dist/cjs/zonos-address-display_8.cjs.entry.js +19 -19
  12. package/dist/cjs/zonos-address_4.cjs.entry.js +6 -6
  13. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  14. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  15. package/dist/cjs/zonos-card_5.cjs.entry.js +7 -7
  16. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +20 -20
  17. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +3 -3
  18. package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
  19. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +6 -6
  21. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +19 -19
  22. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  23. package/dist/cjs/zonos-controller.cjs.entry.js +122 -3
  24. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  25. package/dist/cjs/zonos-country-select_4.cjs.entry.js +6 -6
  26. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  27. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  28. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  29. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +8 -8
  30. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +14 -14
  31. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  32. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
  33. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  34. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  35. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -1
  36. package/dist/cjs/zonos-store-credit.cjs.entry.js +3 -3
  37. package/dist/cjs/zonos-stripe-input.cjs.entry.js +4 -4
  38. package/dist/collection/collection-manifest.json +1 -1
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +4 -4
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +1 -1
  41. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +4 -4
  42. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +2 -2
  43. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.js +1 -1
  44. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +2 -2
  45. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +3 -3
  46. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +3 -3
  47. package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.js +5 -5
  48. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +2 -2
  49. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +2 -2
  50. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +3 -3
  51. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +3 -3
  52. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +2 -2
  53. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  54. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  55. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  56. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  57. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  58. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  59. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  60. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  61. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  62. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  63. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
  64. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  65. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  66. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  67. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  68. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  69. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  70. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  71. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
  72. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +4 -4
  73. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +6 -6
  74. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +8 -7
  75. package/dist/collection/components/hello/zonos-hello/zonos-hello.css +2 -0
  76. package/dist/collection/components/main/zonos-controller.js +6 -2
  77. package/dist/collection/components/store/hello/localization.js +6 -0
  78. package/dist/collection/components/utils/checkout/injectDomesticElementHideStyle.js +116 -0
  79. package/dist/collection/components/utils/getContrastColor.js +27 -10
  80. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +1 -1
  81. package/dist/collection/types/generated/graphql.internal.types.js +287 -73
  82. package/dist/collection/utils/toggleBigcommerceNativeCurrencySelector.js +48 -0
  83. package/dist/esm/{cart-0625a766.js → cart-49082718.js} +1 -1
  84. package/dist/esm/getContrastColor-0aa643c1.js +52 -0
  85. package/dist/esm/{hasInclusivePrice-afc0dd6e.js → hasInclusivePrice-2323d514.js} +1 -1
  86. package/dist/esm/index.js +7 -7
  87. package/dist/esm/{invoice-0daa7f74.js → invoice-16c688e7.js} +2 -2
  88. package/dist/esm/{isCollectMobileTablet-8d3fb5f4.js → isCollectMobileTablet-910aea2e.js} +2 -2
  89. package/dist/esm/{localization-ee06df70.js → localization-33a9f7ff.js} +52 -1
  90. package/dist/esm/{paypal-78c3572c.js → paypal-2e9aa4ba.js} +2 -2
  91. package/dist/esm/{placeTestOrder-18de7b6f.js → placeTestOrder-35c9b460.js} +2 -2
  92. package/dist/esm/{renderCheckoutCurrency-ba1702db.js → renderCheckoutCurrency-b84a6da7.js} +2 -2
  93. package/dist/esm/zonos-address-display_8.entry.js +19 -19
  94. package/dist/esm/zonos-address_4.entry.js +6 -6
  95. package/dist/esm/zonos-badge.entry.js +3 -3
  96. package/dist/esm/zonos-button_3.entry.js +3 -3
  97. package/dist/esm/zonos-card_5.entry.js +7 -7
  98. package/dist/esm/zonos-cart-items_12.entry.js +20 -20
  99. package/dist/esm/zonos-checkbox_2.entry.js +3 -3
  100. package/dist/esm/zonos-checkout.entry.js +3 -3
  101. package/dist/esm/zonos-collapse.entry.js +2 -2
  102. package/dist/esm/zonos-collect-cart-items_3.entry.js +6 -6
  103. package/dist/esm/zonos-collect-finish_6.entry.js +19 -19
  104. package/dist/esm/zonos-collect.entry.js +4 -4
  105. package/dist/esm/zonos-controller.entry.js +122 -3
  106. package/dist/esm/zonos-country-flag.entry.js +1 -1
  107. package/dist/esm/zonos-country-select_4.entry.js +6 -6
  108. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  109. package/dist/esm/zonos-hello.entry.js +2 -2
  110. package/dist/esm/zonos-input.entry.js +4 -4
  111. package/dist/esm/zonos-invoice-cart-items_2.entry.js +8 -8
  112. package/dist/esm/zonos-invoice-finish_5.entry.js +14 -14
  113. package/dist/esm/zonos-invoice.entry.js +4 -4
  114. package/dist/esm/zonos-language-select_2.entry.js +5 -5
  115. package/dist/esm/zonos-link.entry.js +1 -1
  116. package/dist/esm/zonos-logo.entry.js +2 -2
  117. package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -1
  118. package/dist/esm/zonos-store-credit.entry.js +3 -3
  119. package/dist/esm/zonos-stripe-input.entry.js +4 -4
  120. package/dist/esm-es5/{cart-0625a766.js → cart-49082718.js} +1 -1
  121. package/dist/esm-es5/getContrastColor-0aa643c1.js +1 -0
  122. package/dist/esm-es5/{hasInclusivePrice-afc0dd6e.js → hasInclusivePrice-2323d514.js} +1 -1
  123. package/dist/esm-es5/index.js +1 -1
  124. package/dist/esm-es5/{invoice-0daa7f74.js → invoice-16c688e7.js} +1 -1
  125. package/dist/esm-es5/{isCollectMobileTablet-8d3fb5f4.js → isCollectMobileTablet-910aea2e.js} +1 -1
  126. package/dist/esm-es5/{localization-ee06df70.js → localization-33a9f7ff.js} +1 -1
  127. package/dist/esm-es5/{paypal-78c3572c.js → paypal-2e9aa4ba.js} +1 -1
  128. package/dist/esm-es5/{placeTestOrder-18de7b6f.js → placeTestOrder-35c9b460.js} +1 -1
  129. package/dist/esm-es5/{renderCheckoutCurrency-ba1702db.js → renderCheckoutCurrency-b84a6da7.js} +1 -1
  130. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  131. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  132. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  133. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  134. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  135. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  136. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
  137. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  138. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  139. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  140. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  141. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  142. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  143. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  144. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  145. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  146. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  147. package/dist/esm-es5/zonos-input.entry.js +1 -1
  148. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  149. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  150. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  151. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  152. package/dist/esm-es5/zonos-link.entry.js +1 -1
  153. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  154. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  155. package/dist/esm-es5/zonos-store-credit.entry.js +1 -1
  156. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  157. package/dist/scripts/index.d.ts +38 -13
  158. package/dist/scripts/index.js +1 -1
  159. package/dist/scripts/loadZonos.js +1 -1
  160. package/dist/scripts/zonos.js +1 -1
  161. package/dist/types/components/common/zonos-stripe-select/zonos-stripe-select.d.ts +1 -2
  162. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  163. package/dist/types/components/utils/checkout/injectDomesticElementHideStyle.d.ts +18 -0
  164. package/dist/types/components.d.ts +2 -0
  165. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +14 -13
  166. package/dist/types/types/checkout/CheckoutConfig.d.ts +9 -0
  167. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  168. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  169. package/dist/types/types/generated/graphql.internal.types.d.ts +341 -106
  170. package/dist/types/types/generated/graphql.internal.types.ts +419 -141
  171. package/dist/types/types/utils/ZonosSettings.d.ts +9 -0
  172. package/dist/types/utils/toggleBigcommerceNativeCurrencySelector.d.ts +17 -0
  173. package/dist/zonos-elements/index.esm.js +1 -1
  174. package/dist/zonos-elements/{p-41f2e301.entry.js → p-01497a20.entry.js} +1 -1
  175. package/dist/zonos-elements/p-029be4a8.entry.js +1 -0
  176. package/dist/zonos-elements/{p-72058aac.system.entry.js → p-034ab928.system.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-b32cd0c5.system.js → p-07a76716.system.js} +1 -1
  178. package/dist/zonos-elements/{p-e89a411c.system.entry.js → p-087520f2.system.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-e6cc5a25.system.entry.js → p-0b46f3bd.system.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-d1ff24f5.entry.js → p-0e8c4a29.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-eaa79ed8.entry.js → p-0ed70279.entry.js} +1 -1
  182. package/dist/zonos-elements/{p-407b49f1.system.entry.js → p-1325bbd6.system.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-f4f71ae4.system.js → p-175c04a4.system.js} +1 -1
  184. package/dist/zonos-elements/{p-34dc7755.entry.js → p-180d3e3d.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-0529a06b.system.entry.js → p-1957af5a.system.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-ac54de99.entry.js → p-1ec9b3b0.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-d2b91bb9.entry.js → p-1f256673.entry.js} +1 -1
  188. package/dist/zonos-elements/{p-4477556a.system.entry.js → p-22ba60f6.system.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-32ecece3.entry.js → p-26c85188.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-cc481c69.entry.js → p-27061873.entry.js} +1 -1
  191. package/dist/zonos-elements/{p-59aa5785.entry.js → p-28e2ac3b.entry.js} +1 -1
  192. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  193. package/dist/zonos-elements/{p-8a21ed2d.entry.js → p-2a6be4a5.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-26374593.system.entry.js → p-2a8fcb71.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-2c854197.system.entry.js +1 -0
  196. package/dist/zonos-elements/{p-a054c5eb.system.js → p-311ba000.system.js} +1 -1
  197. package/dist/zonos-elements/{p-aaf9d8a4.system.entry.js → p-3516340a.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-8753cb36.system.js → p-3b1b3598.system.js} +1 -1
  199. package/dist/zonos-elements/p-40284821.system.js +1 -0
  200. package/dist/zonos-elements/p-458df669.js +1 -0
  201. package/dist/zonos-elements/{p-66edcaa4.entry.js → p-46071125.entry.js} +1 -1
  202. package/dist/zonos-elements/{p-59e16c6f.system.js → p-4f718ef9.system.js} +1 -1
  203. package/dist/zonos-elements/{p-3a23ec5f.system.entry.js → p-55fb4ea3.system.entry.js} +1 -1
  204. package/dist/zonos-elements/p-5d823ea7.system.js +1 -0
  205. package/dist/zonos-elements/{p-4baa51ef.entry.js → p-5e1799bc.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-86ed51fd.entry.js → p-601bb27e.entry.js} +1 -1
  207. package/dist/zonos-elements/{p-f9c715ad.entry.js → p-648f3ada.entry.js} +1 -1
  208. package/dist/zonos-elements/{p-dfe45cfd.js → p-6987f9c9.js} +1 -1
  209. package/dist/zonos-elements/{p-5678c044.system.entry.js → p-6b6cfc59.system.entry.js} +1 -1
  210. package/dist/zonos-elements/{p-6b9ad020.entry.js → p-703fc360.entry.js} +1 -1
  211. package/dist/zonos-elements/p-71c7a1ff.entry.js +1 -0
  212. package/dist/zonos-elements/{p-e5582c35.entry.js → p-71fb6126.entry.js} +1 -1
  213. package/dist/zonos-elements/{p-24aae506.system.js → p-77c2e465.system.js} +1 -1
  214. package/dist/zonos-elements/{p-0f9a04fe.system.entry.js → p-79e5a629.system.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-3686190f.js → p-843ced6c.js} +1 -1
  216. package/dist/zonos-elements/{p-3d6ce58a.js → p-84dbf474.js} +1 -1
  217. package/dist/zonos-elements/{p-9bd63d7a.system.js → p-8570e88a.system.js} +1 -1
  218. package/dist/zonos-elements/{p-4a4c3af1.system.entry.js → p-8d5f413c.system.entry.js} +1 -1
  219. package/dist/zonos-elements/p-8f9e95c2.entry.js +1 -0
  220. package/dist/zonos-elements/{p-c3ee352b.entry.js → p-90c932fd.entry.js} +1 -1
  221. package/dist/zonos-elements/{p-1cc651e8.entry.js → p-928291e5.entry.js} +1 -1
  222. package/dist/zonos-elements/{p-a52ddeb5.js → p-9a5a2043.js} +1 -1
  223. package/dist/zonos-elements/{p-85cc83e5.system.entry.js → p-9b0a6fe5.system.entry.js} +1 -1
  224. package/dist/zonos-elements/{p-19a1cc70.system.entry.js → p-9e0cb5b3.system.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-8a01157e.system.entry.js → p-a1bad0c3.system.entry.js} +1 -1
  226. package/dist/zonos-elements/{p-72833da8.system.entry.js → p-a49ba3ae.system.entry.js} +1 -1
  227. package/dist/zonos-elements/{p-3fbdb83f.entry.js → p-a6db8883.entry.js} +1 -1
  228. package/dist/zonos-elements/{p-30a0aed1.entry.js → p-a78bc004.entry.js} +1 -1
  229. package/dist/zonos-elements/{p-37f47658.js → p-adb9827c.js} +1 -1
  230. package/dist/zonos-elements/p-b2d276e1.js +1 -0
  231. package/dist/zonos-elements/p-b5a26334.system.entry.js +1 -0
  232. package/dist/zonos-elements/{p-62db5d7c.system.js → p-b6a36c25.system.js} +1 -1
  233. package/dist/zonos-elements/{p-274a7c0e.system.entry.js → p-b6df4cc2.system.entry.js} +1 -1
  234. package/dist/zonos-elements/{p-90a19f4c.system.entry.js → p-b7e4a020.system.entry.js} +1 -1
  235. package/dist/zonos-elements/{p-ec6472c9.system.entry.js → p-baf0b24c.system.entry.js} +1 -1
  236. package/dist/zonos-elements/p-becac995.js +1 -0
  237. package/dist/zonos-elements/{p-e98e4c0b.system.entry.js → p-bf5c3dd7.system.entry.js} +1 -1
  238. package/dist/zonos-elements/{p-6ef88d96.system.entry.js → p-c9c17d08.system.entry.js} +1 -1
  239. package/dist/zonos-elements/{p-42518502.system.entry.js → p-cb966d16.system.entry.js} +1 -1
  240. package/dist/zonos-elements/{p-a5f5993f.system.entry.js → p-ce103c66.system.entry.js} +1 -1
  241. package/dist/zonos-elements/p-cfb0059f.js +1 -0
  242. package/dist/zonos-elements/{p-7c312bc2.entry.js → p-d950b0b4.entry.js} +1 -1
  243. package/dist/zonos-elements/{p-1ed2827f.entry.js → p-db5f6b8c.entry.js} +1 -1
  244. package/dist/zonos-elements/{p-2555ba6b.system.entry.js → p-deaf0e38.system.entry.js} +1 -1
  245. package/dist/zonos-elements/{p-bb0ce525.entry.js → p-e056ae6b.entry.js} +1 -1
  246. package/dist/zonos-elements/{p-281063f4.system.entry.js → p-e850e6e7.system.entry.js} +1 -1
  247. package/dist/zonos-elements/{p-105b7ebe.entry.js → p-fb712719.entry.js} +1 -1
  248. package/dist/zonos-elements/zonos-elements.css +1 -1
  249. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  250. package/package.json +1 -1
  251. package/dist/cjs/getContrastColor-68058615.js +0 -37
  252. package/dist/esm/getContrastColor-2340485f.js +0 -35
  253. package/dist/esm-es5/getContrastColor-2340485f.js +0 -1
  254. package/dist/zonos-elements/p-1ce71a7d.entry.js +0 -1
  255. package/dist/zonos-elements/p-349bdc03.system.entry.js +0 -1
  256. package/dist/zonos-elements/p-5353cfa4.entry.js +0 -1
  257. package/dist/zonos-elements/p-595e2a7d.system.entry.js +0 -1
  258. package/dist/zonos-elements/p-69e2a7dd.js +0 -1
  259. package/dist/zonos-elements/p-6f8abf4f.js +0 -1
  260. package/dist/zonos-elements/p-9b2d6f06.entry.js +0 -1
  261. package/dist/zonos-elements/p-9f7e7148.system.js +0 -1
  262. package/dist/zonos-elements/p-a901d002.js +0 -1
  263. package/dist/zonos-elements/p-c9a1f774.js +0 -1
  264. package/dist/zonos-elements/p-e755ab57.system.js +0 -1
@@ -1 +1 @@
1
- import{r as o,h as e,F as t,a as s}from"./p-ce75b047.js";import{s as n,a as i,b as c,i as r,c as a,d,e as l,f as u,g as h,h as m,j as p,k as g,l as f,t as w,m as z,n as k,o as v,p as y,q as C,r as b,u as S,v as x,w as I,x as T,y as A,z as O,A as _,B,C as L,D as P,E,F as U}from"./p-dfe45cfd.js";import{p as D,s as j,a as N,b as $}from"./p-3d6ce58a.js";import{f as R,l as F,a as M,g as H,s as K,V as Z,b as V,t as G,c as W,d as Q}from"./p-37f47658.js";import{z as Y,g as q,m as J}from"./p-f3cfd8fa.js";import{b as X}from"./p-83666056.js";import{h as oo,l as eo,g as to,j as so,b as no,s as io,a as co,i as ro}from"./p-41dd1cb8.js";import{u as ao}from"./p-367a72bc.js";import{l as lo,g as uo,b as ho}from"./p-0a377722.js";import{_ as mo,c as po,a as go,d as fo,g as wo}from"./p-b2d81c98.js";import{c as zo}from"./p-b4b7f705.js";import{c as ko}from"./p-595f5dd2.js";import{g as vo}from"./p-db3b101a.js";import{i as yo}from"./p-d28be518.js";import{s as Co}from"./p-96d77739.js";import{R as bo}from"./p-08e7107d.js";import"./p-6d81901a.js";import"./p-4c89d04a.js";import"./p-ab0b23f2.js";const So=async()=>{var o,e;try{const t=await fetch("/api/storefront/cart",{credentials:"same-origin",headers:{Accept:"application/json"}});if(!t.ok)return lo(`Failed to fetch BigCommerce cart: ${String(t.status)}`,"error"),null;const s=await t.json();return null!==(e=null===(o=null==s?void 0:s[0])||void 0===o?void 0:o.id)&&void 0!==e?e:null}catch(o){return eo("Error fetching BigCommerce cart data",o),null}},xo=async o=>{try{const e=await fetch(`/api/storefront/checkouts/${o}?include=customer.customerGroup,customer.addresses`,{credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}});return e.ok?await e.json():(lo(`Failed to fetch BigCommerce checkout: ${String(e.status)}`,"error"),null)}catch(o){return eo("Error fetching BigCommerce checkout data",o),null}},Io=o=>{var e;return!!(null===(e=null==o?void 0:o.customer)||void 0===e?void 0:e.id)},To="isInternationalCheckout",Ao=({action:o}={})=>{const e=new URL("/login.php",window.location.origin);o&&e.searchParams.set("action",o);const t=new URLSearchParams(window.location.search),s=t.get("zonosQaUrl");s&&e.searchParams.set("zonosQaUrl",s);const n=t.get("zonosQaUrlApi");return n&&e.searchParams.set("zonosQaUrlApi",n),to()&&e.searchParams.set("zonosTestMode","1"),e.searchParams.set("from",(()=>{const o=new URLSearchParams;o.set(To,"true");const e=new URLSearchParams(window.location.search),t=e.get("zonosQaUrl");t&&o.set("zonosQaUrl",t);const s=e.get("zonosQaUrlApi");return s&&o.set("zonosQaUrlApi",s),to()&&o.set("zonosTestMode","1"),`cart.php?${o.toString()}`})()),e.toString()},Oo=o=>{const e=new URL(o,window.location.origin),t=new URLSearchParams(window.location.search).get("zonosQaUrl");return t&&e.searchParams.set("zonosQaUrl",t),to()&&e.searchParams.set("zonosTestMode","1"),e.toString()},_o={customerGroupId:null,shouldBypass:!1};let Bo=null;const Lo=o=>{const e=(async o=>{var e,t,s,n;if(!window.Zonos.isBigCommerce)return{conclusive:!0,result:_o};const i=null===(e=Y.genericSettings)||void 0===e?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(null==i?void 0:i.length))return Y.loadedConfig?{conclusive:!0,result:_o}:{conclusive:!1,result:_o};const c=o?o.checkoutId:await So();if(!c)return lo("BigCommerce bypass check: no active cart yet, will retry on next call","info"),{conclusive:!1,result:_o};const r=o?o.checkout:await xo(c);if(!r)return lo("BigCommerce bypass check: failed to fetch checkout data, will retry","info"),{conclusive:!1,result:_o};const a=null!==(n=null===(s=null===(t=r.customer)||void 0===t?void 0:t.customerGroup)||void 0===s?void 0:s.id)&&void 0!==n?n:null;if(null===a)return lo("BigCommerce bypass check: no customer group found (guest user)","info"),{conclusive:!0,result:_o};const d=i.includes(a),l={customerGroupId:a,shouldBypass:d};return lo(d?`BigCommerce bypass check: customer group ${String(a)} is in bypass list; caller should keep the user on BC native checkout`:`BigCommerce bypass check: customer group ${String(a)} is not in bypass list`,"info"),{conclusive:!0,result:l}})(o),t=e.then((({conclusive:o,result:e})=>(o||Bo!==t||(Bo=null),e)));return Bo=t,t},Po=async(o={})=>o.forceRefresh||!Bo?Lo(o.preFetched):Bo,Eo={guestCheckoutType:null},Uo="zonos--bc-checkout-settings",Do={redirectUrl:null,shouldForceLogin:!1};let jo=null;const No=()=>{if(!jo){const o=(async()=>{var o;if(!window.Zonos.isBigCommerce)return Eo;const e=null===(o=Y.checkoutSettings.bigCommerceConfig)||void 0===o?void 0:o.storeHash;if(!e)return lo("BigCommerce checkout settings: no storeHash provided — skipping fetch","info"),Eo;const t=(o=>{try{const e=window.localStorage.getItem(Uo);if(!e)return null;const t=so(e);return t?t.storeHash!==o||t.expiresAt<Date.now()?null:{guestCheckoutType:t.guestCheckoutType}:null}catch(o){return null}})(e);if(t)return t;const{errors:s,json:n}=await oo("/api/bigcommerce/checkout-settings",{body:{storeHash:e},method:"POST"});if(s.length||!n)return lo("BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior","info"),Eo;const i={guestCheckoutType:n.guestCheckoutType};return((o,e)=>{try{const t={expiresAt:Date.now()+36e5,guestCheckoutType:e.guestCheckoutType,storeHash:o};window.localStorage.setItem(Uo,JSON.stringify(t))}catch(o){}})(e,i),i})().then((({guestCheckoutType:e})=>e?"no_guest_checkout"===e:(jo===o&&(jo=null),!1))).catch((()=>(jo===o&&(jo=null),!1)));jo=o}return jo},$o=async({preFetched:o}={})=>{if(!window.Zonos.isBigCommerce)return Do;if(!await No())return Do;const e=o?o.checkoutId:await So();if(!e)return Do;const t=o?o.checkout:await xo(e);return t?Io(t)?Do:(lo("BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php","info"),{redirectUrl:Ao(),shouldForceLogin:!0}):(lo("BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue","info"),Do)},Ro="data-zonos-login-from-rewritten",Fo='a[href*="login.php?action=create_account"]:not(['+Ro+"])",Mo=()=>{const o=document.querySelectorAll(Fo);if(!o.length)return;const e=Ao({action:"create_account"});o.forEach((o=>{o.setAttribute("href",e),o.setAttribute(Ro,"true")}))},Ho=(o,e)=>{if(!o.address1||!o.countryCode)return null;const t=[o.firstName,o.lastName].filter(Boolean).join(" ").trim();return{address:{city:o.city||"",country:o.countryCode,line1:o.address1,line2:o.address2||"",postal_code:o.postalCode||"",state:o.stateOrProvinceCode||o.stateOrProvince||""},email:e,name:t,phone:o.phone||""}},Ko=o=>[o.address.line1,o.address.line2||"",o.address.postal_code,o.address.country].join("|").toLowerCase(),Zo=(o=!0,e)=>{var t;if(!F.localizationLoaded)return!1;if(e){const s=!!(null===(t=F.shippingZoneCountries)||void 0===t?void 0:t[e])&&!Y.disabledCountries.includes(e);return o&&!s&&lo(`Checkout: ${e} is not a shippable country: ${s}`),s}return!!F.isShippableCountry||(o&&lo("Checkout: not shippable country"),!1)},Vo='select[name="shippingAddress.countryCode"]';let Go=0;const Wo=o=>{var e;const t=null===(e=K.enabledVariantTestKeys)||void 0===e?void 0:e.find((e=>e.testKey===o));return(null==t?void 0:t.selectedVariantKey)||null},Qo=async({cartId:o,retries:e})=>{const t=to(),{errors:s,json:n}=await oo("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!n||s.length;return i&&e?(lo("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),Qo({cartId:o,retries:e-1})):i?null:n},Yo='<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',qo=class{constructor(e){o(this,e),this.storeUnsubscribeList=[],this.isRedirectAfterOrder=!1,this.preview=!1,this.hiddenMode=!1,this.mobile=!1,this.defaultAddress=[],this.forceDialogOpen=!1,this.defaultAddressParams=[],this.defaultCustomerProfileAddress=[],this.customerProfile=null,this.open=this.forceDialogOpen,this.isOverlayLoading=!1,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.isIframed=!1,this.isLegacyCheckout=window.Zonos.isLegacyCheckout,this.confirmDialogOpen=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.placedOrderInfo=null,this.shouldShowFedexShippingConsentDialog=!1,this.detectedDomesticCheckoutDialogOpen=!1,this.redirectToDomesticCheckoutDialogOpen=!1,this.loggedInIntlAddressConfirmDialogOpen=!1,this.loggedInIntlAddressResolver=null,this.clientSecret=c.clientSecret,this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret,this.applyStripeTheme=async()=>{var o,e,t,s;const n=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||Y.appearance.theme;await r({overrideBorderRadius:null===(e=this.appearanceSettingsOverride)||void 0===e?void 0:e.style,overridePrimaryColor:null===(t=this.appearanceSettingsOverride)||void 0===t?void 0:t.colorPrimary,overrideSecondaryColor:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.colorSecondary,overrideTheme:this.isMobile?n:void 0,paypalEnabled:D()})},this.checkStripePaymentIntentStatus=async({triggeredButton:o})=>{const e=null==o?void 0:o.matches(`#${po}`),t=!!window.Zonos.cartData,s=new URL(window.location.href).searchParams,n=s.get("payment_intent_client_secret"),i=s.get("zonosCheckoutSessionId");if(!e)return lo("Checkout is triggered by user, no need to check stripe payment intent status"),{shouldAllowOrder:!0};if(lo("Payment intent exist, checking stripe payment intent status"),!n)return lo("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:t};const{error:r,status:d}=await a({clientSecret:n});return new URLSearchParams(window.location.search).get("redirect_status")?(lo(r?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen"),this.open=!0,K.checkoutSessionId=i,c.clientSecret=n,this.setToFinishStep(d),{shouldAllowOrder:!1}):t?(lo("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(lo("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})},this.initializeTestKeys=()=>{var o;K.enabledVariantTestKeys=(null==(o=K.enabledVariantTestKeys||[])?void 0:o.filter((o=>!(o.expiresAt&&o.expiresAt<Date.now()||!o.expiresAt))))||[];const e=Y.enabledVariantTestKeys.map((o=>{var e;const t=null===(e=K.enabledVariantTestKeys)||void 0===e?void 0:e.find((({testKey:e})=>e===o));return{expiresAt:(null==t?void 0:t.expiresAt)||Date.now()+Z,selectedVariantKey:(null==t?void 0:t.selectedVariantKey)||null,testKey:o}}));return V(e),{allSelected:!1}},this.shouldAllowHostedVsNativeTest=()=>"function"==typeof Y.checkoutSettings.createCartId&&!!Y.enabledVariantTestKeys.includes("hosted_vs_native"),this.registerTestHostedVsNative=async()=>{if(!this.shouldAllowHostedVsNativeTest())return;lo("[TEST] - Registering hosted vs native test");const o=Wo("hosted_vs_native");if(o)return void lo(`[TEST] - Hosted vs native test already has variant selected: ${o}`);const e=await(async({testKeys:o})=>{if(0===o.length)return null;const{errors:e,json:t}=await oo("/api/zonos-elements/select-variance-test",{body:{testKeys:o},method:"POST"});return e.length||!t?null:R(t)})({testKeys:["hosted_vs_native"]});if(!e)return void lo("[TEST] - Failed to get selection for hosted vs native test");const t=(({baseTestObj:o,mergeTestObj:e})=>o.map((({testKey:o})=>{const t=e.find((({testKey:e})=>e===o));return{expiresAt:(null==t?void 0:t.expiresAt)||Date.now()+Z,selectedVariantKey:(null==t?void 0:t.selectedVariantKey)||null,testKey:o}})))({baseTestObj:K.enabledVariantTestKeys||[],mergeTestObj:e});V(t)},this.handleHostedVsNative=async()=>{var o;if(!this.shouldAllowHostedVsNativeTest())return{redirected:!1};const e=Wo("hosted_vs_native");if(lo(`[TEST] - hosted_vs_native: ${e}`),"function"!=typeof Y.checkoutSettings.createCartId)return lo("[TEST] - createCartId is not provided, skipping hosted vs native test"),{redirected:!1};if("hosted"!==e)return lo("[TEST] - Hosted vs native test is enabled for native, skipping"),{redirected:!1};if(!(null===(o=Y.genericSettings)||void 0===o?void 0:o.hostedCheckoutUrl))return lo("[TEST] - Hosted checkout URL is not provided"),{redirected:!1};lo('"createCartId" is provided, start building cart');const t=await Y.checkoutSettings.createCartId();let s,n=null;"object"==typeof t?(s=t.cartId,n=t.shippingData||null):s=t;const i=(()=>{const o=new URLSearchParams(window.location.search);lo("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:""},t=H(o)||F.selectedCountryCode||"US",s=e("customerCity"),n=e("customerEmail"),i=e("customerAddress1"),c=e("customerAddress2"),r=e("customerName"),a=e("customerPhone"),d=e("customerZip"),l=e("customerState");return{customerAddress1:i,customerAddress2:c,customerCity:s,customerCountry:t,customerEmail:n,customerFirstName:e("customerFirstName"),customerLastName:e("customerLastName"),customerName:r,customerPhone:a,customerState:l,customerZip:d}})(),c=(({cartId:o,checkoutSessionId:e,customerAddress1:t,customerAddress2:s,customerCity:n,customerCountry:i,customerEmail:c,customerFirstName:r,customerLastName:a,customerPhone:d,customerState:l,customerZip:u,hostedCheckoutUrl:h,isTestMode:m,isVariantTest:p})=>{const g=new URLSearchParams;return g.set("tempCartUUID",o),r&&g.set("customerFirstName",r),a&&g.set("customerLastName",a),c&&g.set("customerEmail",c),d&&g.set("customerPhone",d),u&&g.set("customerZip",u),n&&g.set("customerCity",n),l&&g.set("customerState",l),i&&g.set("zCountry",i),t&&g.set("customerAddress1",t),s&&g.set("customerAddress2",s),m&&g.set("zonosTestMode","1"),e&&g.set("zonosCheckoutSessionId",e),p&&g.set("zonosVariantTest","1"),`${h}?${g.toString()}`})(Object.assign(Object.assign({cartId:s,checkoutSessionId:K.checkoutSessionId||void 0,hostedCheckoutUrl:Y.genericSettings.hostedCheckoutUrl,isTestMode:to(),isVariantTest:!0},i),n));return lo(`[TEST] - Redirecting to: ${c}`),window.open(c,"_blank"),{redirected:!0}},this.formatDate=o=>o?new Date(o).toLocaleDateString():"",this.formatTime=o=>o?new Date(o).toLocaleTimeString():"",this.getCurrentLocalePageEnum=()=>{switch(d.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=()=>{const o=d.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:e}}=o;return e?{settlementAmount:(e.discounts||0)+e.items+e.landedCostTotal+e.shipping}:null},this.prefillBigCommerceCustomerAddresses=async()=>{if(!window.Zonos.isBigCommerce)return;if(this.defaultCustomerProfileAddress.length)return;if(Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&"object"==typeof this.defaultAddress&&null!==this.defaultAddress)return;const o=await So();if(!o)return;const e=await xo(o);if(!Io(e))return;const t=((o,e)=>{var t,s,n,i;if(!(null===(t=null==o?void 0:o.customer)||void 0===t?void 0:t.id))return[];const{isShippable:c,selectedCountryCode:r}=e,a=o.customer.email||"",d=null!==(n=null===(s=o.consignments)||void 0===s?void 0:s.flatMap((o=>o.shippingAddress?[o.shippingAddress]:[])))&&void 0!==n?n:[],l=null!==(i=o.customer.addresses)&&void 0!==i?i:[],u=new Set,h=[];for(const o of[...l,...d]){const e=Ho(o,a);if(!e)continue;if(!c(e.address.country))continue;const t=Ko(e);u.has(t)||(u.add(t),h.push(e))}return r?h.map(((o,e)=>({index:e,option:o}))).sort(((o,e)=>{const t=o.option.address.country===r;return t===(e.option.address.country===r)?o.index-e.index:t?-1:1})).map((o=>o.option)):h})(e,{isShippable:o=>Zo(!1,o),selectedCountryCode:F.selectedCountryCode||void 0});t.length&&(this.defaultCustomerProfileAddress.length||(this.defaultCustomerProfileAddress=t,lo(`Prefilled ${String(t.length)} BigCommerce customer address(es) for logged-in shopper`,"info")))},this.getDefaultAddress=()=>this.defaultCustomerProfileAddress.length?this.defaultCustomerProfileAddress:Array.isArray(this.defaultAddress)&&this.defaultAddress.length?this.defaultAddress:Array.isArray(this.defaultAddress)||"object"!=typeof this.defaultAddress?this.defaultAddressParams:[this.defaultAddress],this.handleHostedOpenWindowCallback=o=>{var e;const t=null===(e=Y.genericSettings)||void 0===e?void 0:e.hostedCheckoutUrl;if(!origin)return;const s=["dev.checkout.elements.zonos.com"].some((e=>o.origin.includes(e)));o.origin!==t&&!s||"zonos-checkout-session-update"!==o.data.type||(K.checkoutSessionId=o.data.checkoutSessionId)},this.captureParamsRedirectedForVariantTest=()=>{const o=new URL(window.location.href);if("1"!==o.searchParams.get("zonosVariantTest"))return;const e=o.searchParams.get("zonosCheckoutSessionId");e&&(K.checkoutSessionId=e);const t=K.enabledVariantTestKeys||[];window.Zonos.isLegacyCheckout&&(Wo("hosted_vs_native")?V(t.map((o=>"hosted_vs_native"===o.testKey?Object.assign(Object.assign({},o),{selectedVariantKey:"hosted"}):o))):(t.push({expiresAt:Date.now()+Z,selectedVariantKey:"hosted",testKey:"hosted_vs_native"}),V(t))),o.searchParams.delete("zonosCheckoutSessionId"),o.searchParams.delete("zonosVariantTest"),window.history.replaceState({},"",o.toString())}}async initCartInfoHandler(o){l({adjustments:d.adjustments,cartItems:o.detail})}async handleKeyPress(o){"Escape"===o.key&&this.closeDialogHandler()}async closeDialogHandler(o){var e,t;this.open&&((null==o?void 0:o.confirmed)?(this.confirmDialogOpen=!1,j({event:"zonos-checkout-close",metadata:{checkoutSessionId:K.checkoutSessionId}}),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==d.step||u(),d.step="customer-info",h(),m(),null===(t=(e=Y.checkoutSettings).onClose)||void 0===t||t.call(e)):this.confirmDialogOpen=!0)}async buildCartAndInit(){if("function"==typeof Y.checkoutSettings.createCartId){lo('"createCartId" is provided, start building cart'),d.customMessage=[];const o=await Y.checkoutSettings.createCartId();let e;"object"==typeof o?(lo("object detected, use cartId and prefill address from createCartId","info",o),e=o.cartId,this.useShippingDataFromCreateCartId(o.shippingData),d.customerAuthenticationToken=o.customerAuthenticationToken||null,d.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((o=>"string"==typeof o)):[]):e=o,window.Zonos.cartId=e;const t=await(async o=>{const{isDgsCartId:e,isLegacyCartId:t}=mo(o);if(!t&&!e)return eo("[ZONOS - loadZonos] invalid cart id"),null;const s=await Qo({cartId:o,retries:5});return lo("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(eo("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(e),s=null==t?void 0:t.cartData;if(!s)return eo("Failed to build cart, please try again."),!1;window.Zonos.cartData=s;const{adjustments:n,cartItems:i}=X(s);await l({adjustments:n,cartItems:i})}else if(window.Zonos.cartData){lo("tempCartUUID is provided, start building cart");const{adjustments:o,cartItems:e}=X(window.Zonos.cartData);await l({adjustments:o,cartItems:e})}else if(Y.checkoutSettings.buildCartDetail&&F.selectedCountryCode){lo("build cart detail");const o=await Y.checkoutSettings.buildCartDetail({countryCode:F.selectedCountryCode,currencyCode:F.targetCurrency}),e=o.filter((o=>o.amount>=0)),t=o.filter((o=>o.amount<0));lo("cartItems","info",{cartItems:o});const s=t.map((o=>({amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"})));await l({adjustments:s,cartItems:e})}if(!K.checkoutSessionId){const o=await p();if(lo(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}d.isStagingMode||g(),await this.applyStripeTheme();const{successBehavior:o,successRedirectUrl:e}=Y.checkoutSettings;return this.isRedirectAfterOrder="REDIRECT_TO_SUCCESS_PAGE"===o||"CLOSE_MODAL"===o&&!!e||!!d.externalConfirmationPageURL,!0}reloadCheckoutSession(){window.location.reload()}handleOrderDuplication(){const o=so(localStorage.getItem("zonos--placed-order-info"));if(!o)return void localStorage.removeItem("zonos--placed-order-info");const e=Date.now()-o.time;lo(`=== Existing placed order info: ${o.orderId} - ${this.formatDate(o.time)} - elapsed in hh:ss format: ${new Date(e).toISOString().substring(11,8)}`,"warn");const t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||216e5;if(e>t)return lo(`=== Existing placed order info is older than ${t}ms, cleaning localStorage`,"warn"),void localStorage.removeItem("zonos--placed-order-info");this.placedOrderInfo=o,lo("=== Showing order duplication confirmation","warn")}recordCheckoutInfo(){K.checkoutSessionId&&ao({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:K.checkoutSessionId})}confirmProceedWithOrderDuplication(){this.placedOrderInfo=null,K.checkoutSessionId&&ao({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:K.checkoutSessionId})}markTheSessionAsAbandonedCart(){K.checkoutSessionId&&ao({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:K.checkoutSessionId})}handleCancelOrderDuplication(){var o;if(this.placedOrderInfo=null,this.isLegacyCheckout){const e=(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||Y.onlineStoreSettings.url;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}this.closeDialogHandler({confirmed:!0})}attachCheckout(){const o=Y.checkoutSettings.placeOrderButtonSelector,e=Y.checkoutSettings.alwaysTriggerInternationalCheckoutSelector,t=!!document.querySelector(`#${po}`);if(lo(`attach checkout ${o}`),lo(`attach checkout to always trigger international checkout selector: ${e}`),!(o||e||window.Zonos.cartData||t))return;const s=[o,e,`#${fo}`,`#${po}`,`#${go}`].filter(Boolean);document.querySelectorAll(s.join(",")).forEach((t=>{t.getAttribute("data-zonos-checkout-attached")||(lo(`attached event to button ${o}`,"info",{button:t}),t.addEventListener("click",(async o=>{var s,n;const i=performance.now(),r=e&&t.matches(e),a=t.matches(`#${go}`),l=t.matches(`#${fo}`)||t.matches(`#${po}`);if(!window.Zonos.isLegacyCheckout&&(!Zo()||((o=!0)=>!F.localizationLoaded||!!F.isDisabledCountry&&(o&&lo("Checkout: disabled country"),!0))())&&!r&&!a&&!l)return;o.preventDefault(),o.stopPropagation(),lo("zonos checkout button clicked");const{shouldAllowOrder:u}=await this.checkStripePaymentIntentStatus({triggeredButton:o.target});if(u){if(window.Zonos.logIntervalId||(window.Zonos.logIntervalId=setInterval((()=>{(async()=>{if(0===window.Zonos.loadTimeApiInfoList.length)return;lo("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});const o={data:[...window.Zonos.loadTimeApiInfoList],storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;const{errors:e}=await oo("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"});e.length&&(window.Zonos.loadTimeApiInfoList.push(...o.data),Go++,Go>5&&window.Zonos.logIntervalId&&clearInterval(window.Zonos.logIntervalId))})()}),2e3)),Y.enabledVariantTestKeys.includes("hosted_vs_native")){this.isOverlayLoading=!0,await this.registerTestHostedVsNative();const{redirected:o}=await this.handleHostedVsNative();if(this.isOverlayLoading=!1,o)return}if(window.Zonos.isBigCommerce){const{shouldBypass:o}=await Po();if(o)return lo("Bypass customer group detected, redirecting to BigCommerce native checkout","info"),void(window.location.href=Oo("/checkout"));const e=await $o();if(e.shouldForceLogin&&e.redirectUrl)return void(window.location.href=e.redirectUrl)}c.isFetchingSession=!0,this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");null===(s=window.opener)||void 0===s||s.postMessage({checkoutSessionId:K.checkoutSessionId,type:"zonos-checkout-session-update"},"*"),f({isPreview:this.preview,sessionTimeout:54e5}),j({event:"zonos-checkout-start",metadata:{checkoutSessionId:K.checkoutSessionId}}),w({checkoutSessionId:K.checkoutSessionId,eventName:"checkout_open"});const{enabled:o}=await(async()=>{const{errors:o,json:e}=await oo("/api/zonos-elements/get-store-discount-enabled-status");return o.length||!(null==e?void 0:e.enabled)?{enabled:!1}:{enabled:!0}})();if(d.shouldHideDiscountInput=!o,this.handleOrderDuplication(),window.Zonos.isLegacyCheckout)(async()=>{const{elapsedTime:o}=uo(),e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:ho},no()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};oo("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})();else{(async({loadTime:o})=>{const e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:ho},no()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};oo("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})({loadTime:performance.now()-i})}this.recordCheckoutInfo(),wo()&&this.markTheSessionAsAbandonedCart()}catch(o){if(o instanceof Error&&"Cart is expired."===o.message&&(this.isCartExpired=!0),c.isFetchingSession=!1,eo(o),this.isCartExpired)return void(c.isFetchingSession=!0);io({endpoint:"Error creating Checkout",errors:[o instanceof Error?o.toString():"Unknown error"],metadata:{allLogs:ho,cartId:window.Zonos.cartId,checkoutSessionBody:z(),href:window.location.href,storeBaseUrl:(null===(n=window.Zonos.cartData)||void 0===n?void 0:n.storeBaseUrl)||Y.onlineStoreSettings.url}}),k({messages:[G("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:G("Error creating Checkout")})}}}),{capture:!0,passive:!1}),Y.checkoutSettings.disablePlaceOrderButtonActivation||t.removeAttribute("disabled"),t.setAttribute("data-zonos-checkout-attached","true"),t.matches(`#${fo}`)&&(t.dispatchEvent(ko("click")),v(),t.remove()),t.matches(`#${po}`)&&(t.dispatchEvent(ko("click")),t.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useShippingDataFromCreateCartId(o){if(!o)return;lo("shipping data from createCartId result","info",Object.entries(o));const{customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:n,customerEmail:i,customerFirstName:c,customerLastName:r,customerName:a,customerPhone:d,customerState:l,customerZip:u}=o,h=new URLSearchParams(window.location.search),m=n||H(h)||F.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:m,customerEmail:i,customerFirstName:c,customerLastName:r,customerName:a,customerPhone:d,customerState:l,customerZip:u})}useLegacyQueryParams(){const o=new URLSearchParams(window.location.search);lo("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:null},t=H(o)||F.selectedCountryCode,s=e("customerCity"),n=e("customerEmail"),i=e("customerAddress1"),c=e("customerAddress2"),r=e("customerName"),a=e("customerFirstName"),d=e("customerLastName"),l=e("customerPhone"),u=e("customerZip"),h=e("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:c,customerCity:s,customerCountry:t,customerEmail:n,customerFirstName:a,customerLastName:d,customerName:r,customerPhone:l,customerState:h,customerZip:u})}applyPrefillAddress(o){const e=o.customerAddress1||"",t=o.customerCountry||"",s=o.customerAddress2||"",n=o.customerCity||"",i=o.customerEmail||"",c=o.customerFirstName&&o.customerLastName?`${o.customerFirstName} ${o.customerLastName}`:o.customerName||"",r=o.customerPhone||"",a=o.customerZip||"",d=o.customerState||"";e&&c&&r&&t?t&&F.shippingZoneCountries&&!(t in F.shippingZoneCountries)?lo(`Country "${t}" is not in the shipping zone, so it can not be prefilled`,"warn"):(this.defaultAddressParams=[{address:{city:n||"",country:t,line1:e,line2:s,postal_code:a,state:d},email:i,name:c,phone:r}],lo("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})):lo("Missing required query params so it can not be prefilled","info",[!e&&"line1",!c&&"name",!r&&"phone",!t&&"country"].filter(Boolean).join(", "))}overrideStagingModeChanged(){d.isStagingMode=!!this.overrideStagingMode}async init(){c.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,d.isStagingMode=co(),void 0!==this.overrideStagingMode&&(d.isStagingMode=this.overrideStagingMode),(()=>{var o;if(!window.Zonos.isBigCommerce)return;const e=null===(o=Y.genericSettings)||void 0===o?void 0:o.bigcommerceBypassCustomerGroupIds;(null==e?void 0:e.length)&&Lo()})(),window.Zonos.isBigCommerce&&No(),(()=>{if(!window.Zonos.isBigCommerce)return;if(!window.location.pathname.includes("/login.php"))return;Mo();const o=new MutationObserver((()=>{Mo()}));o.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>o.disconnect()),1e4)})(),this.handleBigcommerceInternationalResumeFlag(),this.prefillBigCommerceCustomerAddresses(),(({domesticRedirectedBtnSelector:o,onInternationalCheckoutSelected:e,onLoggedInInternationalAddressDetected:t,onShippingAddressSessionFound:s})=>{if(!window.Zonos.isBigCommerce)return;const c=async o=>{var t;const s=document.querySelector((null===(t=Y.genericSettings)||void 0===t?void 0:t.bigcommerceDomesticCheckoutCountrySelector)||Vo),n=(null==s?void 0:s.value)||o;if(!n)return!1;if(!Zo(!1,n))return!1;const c=await So(),r={checkout:c?await xo(c):null,checkoutId:c},{shouldBypass:a}=await Po({forceRefresh:!0,preFetched:r});if(a)return lo("Bypass customer group detected on BC checkout, stopping interval","info"),!0;const d=await $o({preFetched:r});if(d.shouldForceLogin&&d.redirectUrl)return window.location.href=d.redirectUrl,!0;e&&await e(),M({isInitializing:!1,newSelectedCountryCode:n});const l={address1:"",address2:"",city:"",countryCode:n,firstName:"",lastName:"",phone:"",postalCode:"",stateOrProvince:""};return i({address1:l.address1,address2:l.address2,city:l.city,countryCode:l.countryCode,firstName:l.firstName,lastName:l.lastName,phone:l.phone,postalCode:l.postalCode,state:l.stateOrProvince}),window.location.href=Oo("/"),!0};let r=!1,a=!1,d=!1,l=!1,u=!1;const h=new MutationObserver((async()=>{var m;const p=document.querySelector(o),g=n();if(!p&&g){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==s||s(g),void h.disconnect()}if(!window.location.pathname.includes("/checkout")||!window.Zonos.isBigCommerce)return void h.disconnect();if(!l&&!d){d=!0,u=!0;try{const o=await(async({onInternationalCheckoutSelected:o,onLoggedInInternationalAddressDetected:e})=>{var t,s,n,c,r,a,d,l,u,h;const m=await So();if(!m)return"noAction";const p=await xo(m),g={checkout:p,checkoutId:m},{shouldBypass:f}=await Po({preFetched:g});if(f)return"noAction";const w=null===(s=null===(t=null==p?void 0:p.consignments)||void 0===t?void 0:t[0])||void 0===s?void 0:s.shippingAddress;if(!(null==w?void 0:w.countryCode))return"noAction";const z=w.countryCode;if(!Zo(!1,z))return"noAction";if(lo(e?`Logged-in user has international shipping address: ${z}, prompting user to choose checkout`:`Logged-in user has international shipping address: ${z}, redirecting automatically (legacy behavior)`,"info"),e&&"stay"===await e())return lo("User opted to stay on BigCommerce native checkout despite international default address","info"),"optedOut";const k=await $o({preFetched:g});return k.shouldForceLogin&&k.redirectUrl?(window.location.href=k.redirectUrl,"redirected"):(o&&await o(),M({isInitializing:!1,newSelectedCountryCode:z}),i({address1:null!==(n=w.address1)&&void 0!==n?n:"",address2:null!==(c=w.address2)&&void 0!==c?c:"",city:null!==(r=w.city)&&void 0!==r?r:"",countryCode:z,firstName:null!==(a=w.firstName)&&void 0!==a?a:"",lastName:null!==(d=w.lastName)&&void 0!==d?d:"",phone:null!==(l=w.phone)&&void 0!==l?l:"",postalCode:null!==(u=w.postalCode)&&void 0!==u?u:"",state:null!==(h=w.stateOrProvince)&&void 0!==h?h:""}),window.location.href=Oo("/"),"redirected")})({onInternationalCheckoutSelected:e,onLoggedInInternationalAddressDetected:t});if("redirected"===o)return void h.disconnect();"optedOut"===o&&(l=!0)}catch(o){eo("Error checking logged-in user shipping address",o)}finally{d=!1,u=!1}}const f=document.querySelector((null===(m=Y.genericSettings)||void 0===m?void 0:m.bigcommerceDomesticCheckoutCountrySelector)||Vo);if(!f)return;if(lo("Domestic checkout found - Listening for shipping country change","info",{value:f.value}),a)return;a=!0,h.disconnect();const w=setInterval((async()=>{if(!r&&!u){r=!0;try{if(await c())return void clearInterval(w);r=!1}catch(o){r=!1}}}),1e3),z=setInterval((()=>{var o;if(!window.bcStripeElements)return void clearInterval(z);const e=null===(o=window.bcStripeElements)||void 0===o?void 0:o.getElement("address");e&&(clearInterval(z),e.on("change",(o=>{const e=o.value.address.country;e&&!u&&c(e)})))}),500)}));h.observe(document.body,{childList:!0,subtree:!0})})({domesticRedirectedBtnSelector:fo,onInternationalCheckoutSelected:async()=>{this.detectedDomesticCheckoutDialogOpen=!0,await new Promise((o=>setTimeout(o,2e3)))},onLoggedInInternationalAddressDetected:()=>new Promise((o=>{this.loggedInIntlAddressResolver=o,this.loggedInIntlAddressConfirmDialogOpen=!0})),onShippingAddressSessionFound:o=>{this.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:`${o.firstName} ${o.lastName}`,phone:o.phone}]}}),window.Zonos&&this.useLegacyQueryParams();const o=setInterval((()=>{c.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(lo("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():window.Zonos.isLegacyCheckout?this.attachCheckout():window&&(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(o)):lo("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(o)}),1e4)}handleBigcommerceInternationalResumeFlag(){if(!window.Zonos.isBigCommerce)return;const o=new URL(window.location.href);if("true"!==o.searchParams.get(To))return;o.searchParams.delete(To),window.history.replaceState({},"",o.toString());const e=Date.now(),t=setInterval((()=>{if(!F.localizationLoaded||!F.selectedCountryCode)return void(Date.now()-e>15e3&&(clearInterval(t),lo("BigCommerce international checkout resume flag: localization did not initialize within 15s","info")));const o=document.querySelector(`#${go}`);if(o)return clearInterval(t),void o.dispatchEvent(ko("click"));Date.now()-e>15e3&&(clearInterval(t),lo("BigCommerce international checkout resume flag: trigger button did not mount within 15s","info"))}),200)}async setToFinishStep(o){d.step="finish",this.storybookPaymentStatusOverride=o}async mockCheckoutSession(o){y(o)}async triggerCheckoutInternational(){const o=document.querySelector(`#${go}`);o&&o.dispatchEvent(ko("click"))}async handleCustomerInfoContinue(){var o,e,t,s;j({event:"zonos-checkout-customer-info",metadata:{checkoutSessionId:K.checkoutSessionId}}),w({checkoutSessionId:K.checkoutSessionId,eventName:"checkout_customerInfoCompleted"}),this.submitLoading=!0;const{isRequestNotReady:n}=await C();n&&"stripe"===d.addressFormRenderType&&io({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:null===(e=null===(o=c.stripeAddressEventData)||void 0===o?void 0:o.value)||void 0===e?void 0:e.address,billingAddress:null===(s=null===(t=c.stripeBillingAddressEventData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.address,cartId:window.Zonos.cartId}});const i=o=>{"customer-info"===d.step?c.isFetchingLandedCost||(d.landedCostData&&($({currency:d.currency}),b()),this.submitLoading=!1,o&&clearInterval(o)):clearInterval(o)};i();const r=setInterval((()=>{i(r)}),20);setTimeout((()=>{clearInterval(r)}),1e4)}async handleShippingContinue(){b()}handleInventoryCheckDialogConfirm(){d.inventoryCheckErrorMessage=null,this.isLegacyCheckout||this.closeDialogHandler({confirmed:!0})}handleCartExpiredDialogConfirm(){var o;if(this.isCartExpired=!1,this.isLegacyCheckout){const e=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}window.parent&&(window.parent.location.href=window.location.href),window.location.reload()}async handleStripePaymentContinue(){if("USD"!==c.checkoutSettlementCurrency||!c.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,N.paypalErrorMessage=null,c.hasPaymentError=!1,this.submitLoading=!0,d.inventoryCheckErrorMessage=null,!await S())return c.hasPaymentError=!0,c.customErrorMessage=G("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:c.checkoutSettlementCurrency}),void(this.submitLoading=!1);try{d.inventoryCheckErrorMessage=await x()}catch(o){d.inventoryCheckErrorMessage=G("Unable to check inventory. Please try again.")}if(d.inventoryCheckErrorMessage)this.submitLoading=!1;else{if(U()>0){const o=await I();if(!o.success)return c.hasPaymentError=!0,c.customErrorMessage=o.error||G("Unable to apply store credit. Please try again."),void(this.submitLoading=!1)}if(T()){try{const o=await A();if(!o.valid)return c.hasPaymentError=!0,c.customErrorMessage=o.errorMessage,void(this.submitLoading=!1);const e=await O();if(!e.success)return c.hasPaymentError=!0,c.customErrorMessage=e.error||G("Unable to place order with store credit. Please try again."),void(this.submitLoading=!1);b(),m()}catch(o){eo(o),j({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:K.checkoutSessionId}}),c.hasPaymentError=!0}this.submitLoading=!1}else{try{await _(),b(),m()}catch(o){eo(o),j({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:K.checkoutSessionId}}),c.hasPaymentError=!0,c.shouldInventoryRefund&&(B(),c.shouldInventoryRefund=!1)}this.submitLoading=!1}}}else this.payInUsdConfirmDialogOpen=!0}async handleFinishClick(){if(L(),this.preview)return d.step="customer-info",void await this.init();if(u(),window.Zonos.isLegacyCheckout&&window.Zonos.cartData){const o=window.Zonos.cartData.storeBaseUrl||Y.onlineStoreSettings.url;return window.parent&&(window.parent.location.href=o),void(window.location.href=o)}const o=window.location.href.split("?")[0];this.open=!1,window.location.hostname.includes("dashboard.zonos.com")||(window.history.replaceState(window.history.state,document.title,o),window.location.reload())}handleWindowResize(){this.isMobile=ro(this.mobile),this.applyStripeTheme(),lo(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=ro(this.mobile),this.applyStripeTheme(),lo(`mobile: ${this.isMobile}`)}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=q(this.appearanceSettingsOverride.theme))}handleAddressChange(){L()}handleCustomerProfileChange(){var o,e;if(!this.customerProfile)return lo("No customer profile","info"),void(this.defaultCustomerProfileAddress=[]);lo("Customer profile found","info",{customerProfile:this.customerProfile}),this.defaultCustomerProfileAddress=(null===(e=null===(o=c.customerProfile)||void 0===o?void 0:o.locations)||void 0===e?void 0:e.map((o=>{var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||(null===(e=c.customerProfile)||void 0===e?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]}handleClientSecretChange(){lo("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret}),this.applyStripeTheme()}handleOpenChange(){const o="data-zonos-overflow-origin",e=document.body,t=document.documentElement;if(this.open)window.Zonos.openHelloDialog(!1),e.style.overflow&&e.setAttribute(o,e.style.overflow),e.style.overflow="hidden",t.style.overflow&&t.setAttribute(o,t.style.overflow),t.style.overflow="hidden";else{this.stripeCustomerSessionClientSecret=null;const s=e.getAttribute(o),n=t.getAttribute(o);s?(e.removeAttribute(o),e.style.overflow=s):e.style.removeProperty("overflow"),n?(t.removeAttribute(o),t.style.overflow=n):t.style.removeProperty("overflow")}}componentWillLoad(){this.init(),this.isMobile=ro(this.mobile),this.isIframed=window.self!==window.top,lo(`iframed: ${this.isIframed}`),window.Zonos.isLegacyCheckout&&this.captureParamsRedirectedForVariantTest(),this.handleAppearanceSettingsOverrideChange(),this.storeUnsubscribeList=[W("selectedLocale",(()=>{this.applyStripeTheme()})),P("selectedShippingOption",(()=>{var o,e,t,s;const n=d.selectedShippingOption;(null===(o=Y.genericSettings)||void 0===o?void 0:o.shouldFedExShippingConsentForCanadianShopper)&&(null===(t=null===(e=null==n?void 0:n.shippingProfile)||void 0===e?void 0:e.serviceLevel.code)||void 0===t?void 0:t.toLowerCase().startsWith("fedex."))&&"CA"===(null===(s=c.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)&&(this.shouldShowFedexShippingConsentDialog=!0)})),E("stripeAddressEventData",(o=>{var e;if(!window.Zonos.isBigCommerce||!o||this.redirectToDomesticCheckoutDialogOpen||!(null===(e=Y.genericSettings)||void 0===e?void 0:e.isBigcommerceDomesticCheckoutRedirectEnabled)||"USD"!==Y.sourceCurrency)return;if(!this.open)return;if(window.location.pathname.includes("/checkout"))return;const t=o.value.address.country;t&&Y.disabledCountries.includes(t)&&(this.redirectToDomesticCheckoutDialogOpen=!0,lo(`Domestic country ${t} selected in international checkout, redirecting to BigCommerce domestic checkout`,"info"),setTimeout((()=>{window.location.href=Oo("/checkout")}),2e3))}))],this.initializeTestKeys(),window.addEventListener("message",this.handleHostedOpenWindowCallback),lo(`mobile: ${this.isMobile}`)}disconnectedCallback(){L(),u(),this.storeUnsubscribeList.forEach((o=>o())),window.removeEventListener("message",this.handleHostedOpenWindowCallback)}render(){var o,n,i,r;this.customerProfile=c.customerProfile,this.clientSecret=c.clientSecret,c.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret);const a="finish"!==d.step&&"error"!==d.step&&!c.stripeElements||c.isFetchingSession,{colorPrimary:l,colorSecondary:u,logoUrl:h,style:m}=J(Y.appearance,this.appearanceSettingsOverride||null),p="ENABLED"===Y.appearance.zonosAttribution,g=Y.appearance.theme,f=l&&yo(l)?"DARK":"LIGHT",w=this.isMobile?g:f,z=this.isMobile?void 0:u,{customMessages:k}=F,v=null===(o=k.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,y=this.getCurrentLocalePageEnum(),C=k.filter((o=>o.pageName===y)),b=this.getBaseCurrencySettlementInfo(),S=()=>{const o=this.preview?`${h}?timestamp=${Date.now()}`:h;return e("div",{class:"zonos--logo"},o&&e("img",{alt:`${Y.organizationName} logo`,src:o}))},x=to(),I=()=>{const o=new URLSearchParams(window.location.search),t=o.get("zonosQaUrl"),s=o.get("zonosDebug"),n=o.get("zonosE2ETest"),i=this.overrideStagingMode||co();return e("zonos-v-stack",null,e("div",{class:"zonos--logo-wrapper"},S(),x&&e("zonos-badge",{badgeColor:"orange",size:"small"},G("Test mode")),i&&e("zonos-badge",{badgeColor:"red",size:"small"},G("Staging mode")),"1"===s&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t),n&&e("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),e("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--zonos-elements-gray-0":null}),C.map((o=>e("zonos-custom-message",{icon:Yo,message:o.message}))))},T=()=>d.checkoutSessionTimeoutShow?e("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:G("Your checkout session has expired. Please reload the page to continue."),restStateTitle:G("Session timed out"),restStateType:"Warning"},e("zonos-button",{onClick:()=>this.reloadCheckoutSession(),variant:"primary"},G("Reload"))):e("div",{class:"zonos--content",style:{"--zonos--border-radius":vo({overrideBorderStyle:m})}},"finish"!==d.step&&"error"!==d.step&&e(t,null,e("div",{class:"zonos--left","data-theme":w,style:Co({"--zonos--primary-color":this.isMobile?void 0:l})},!this.isMobile&&I(),"customer-info"===d.step&&e("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.getDefaultAddress(),isMobile:this.isMobile,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:z}),"shipping"===d.step&&e("zonos-shipping",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:z}),"payment"===d.step&&e("zonos-checkout-payment",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:async()=>{await this.handleStripePaymentContinue()},submitBtnColor:z})),e("div",{class:"zonos--right","data-theme":g},this.isMobile&&I(),e("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&e("zonos-currency-toggle",null),!this.isLegacyCheckout&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:bo}),noBackground:!0,onClick:()=>this.closeDialogHandler()})),e("div",{class:"flex--wrapper"},e("div",{class:"zonos--wrapper"},e("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)}}),e("zonos-collapse",{collapsed:this.collapseReviewMobile&&this.isMobile},e("zonos-cart-items",null),this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",{submitBtnColor:z}),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Yo,message:v})))),e("zonos-cart-restricted-items",null),!this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",null),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Yo,message:v}))))),("finish"===d.step||"error"===d.step)&&e("div",{class:"zonos--done","data-theme":g},e("div",{class:"zonos--header"},S(),!this.isRedirectAfterOrder&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:bo}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:g})),e("zonos-checkout-finish",{borderRadius:m,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===d.step&&d.error?Object.assign(Object.assign({},d.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),e("zonos-checkout-footer",{"data-theme":g,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return e(s,{class:zo(["zonos--checkout zonos--elements","payment"===d.step&&"zonos--processing-payment",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?T():e("zonos-dialog",{borderStyle:m,class:"zonos--checkout-dialog","data-theme":g,height:"980px",isLoading:a,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},T()),e("zonos-dialog",{isLoading:!0,loadingText:G("You will be redirected to international checkout shortly."),loadingTitle:G("We detected that you are shipping to an international address."),noClickOutside:!0,noCloseButton:!0,open:this.detectedDomesticCheckoutDialogOpen,width:"450px"}),e("zonos-dialog",{isLoading:!0,loadingText:G("You will be redirected to domestic checkout shortly."),loadingTitle:G("We detected that you are shipping to a domestic address."),noClickOutside:!0,noCloseButton:!0,open:this.redirectToDomesticCheckoutDialogOpen,width:"450px"}),e("zonos-confirm-dialog",{class:"zonos--logged-in-intl-address-dialog",dialogCancelBtnText:G("Stay on this page"),dialogConfirmBtnText:G("Continue to international checkout"),dialogIntent:"info",dialogOpen:this.loggedInIntlAddressConfirmDialogOpen,dialogSubtitle:G("Your saved default address ships internationally. Would you like to continue to international checkout, or stay here and select a domestic address?"),dialogTitle:G("International shipping address detected"),dialogWidth:480,onCancelClicked:()=>{var o;this.loggedInIntlAddressConfirmDialogOpen=!1,null===(o=this.loggedInIntlAddressResolver)||void 0===o||o.call(this,"stay"),this.loggedInIntlAddressResolver=null},onConfirmClicked:()=>{var o;this.loggedInIntlAddressConfirmDialogOpen=!1,null===(o=this.loggedInIntlAddressResolver)||void 0===o||o.call(this,"redirect"),this.loggedInIntlAddressResolver=null}}),e("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:G("Don't close"),dialogConfirmBtnText:G("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:G("Would you like to close checkout and return to the site?"),dialogTitle:G("Are you sure?"),onCancelClicked:()=>{this.confirmDialogOpen=!1},onConfirmClicked:()=>this.closeDialogHandler({confirmed:!0})}),e("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:G("Return to merchant site"),dialogConfirmBtnText:G("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:(null===(n=this.placedOrderInfo)||void 0===n?void 0:n.zonosOrderNumber)?G("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)}):G("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((null===(i=this.placedOrderInfo)||void 0===i?void 0:i.time)||null),time:this.formatTime((null===(r=this.placedOrderInfo)||void 0===r?void 0:r.time)||null)}),dialogTitle:G("Are you sure?"),dialogWidth:530,onCancelClicked:()=>{this.handleCancelOrderDuplication()},onConfirmClicked:()=>{this.confirmProceedWithOrderDuplication()}}),e("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:G("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:e(t,null,G("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),e("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},G("View GAA Form."))),dialogTitle:G("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:()=>this.shouldShowFedexShippingConsentDialog=!1}),e("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:G("Return to cart"),dialogIntent:"danger",dialogOpen:!!d.inventoryCheckErrorMessage,dialogSubtitle:d.inventoryCheckErrorMessage,dialogTitle:G("Couldn't place order"),dialogType:"alert",onConfirmClicked:()=>this.handleInventoryCheckDialogConfirm()}),b&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:G("Cancel"),dialogConfirmBtnText:G("Pay [orderTotal]",{orderTotal:Q({amount:b.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:G("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:G("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),e("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:G("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:G("You are being sent back to the shop to re-add items to your cart."),dialogTitle:G("Shopping cart expired"),dialogType:"alert",onConfirmClicked:()=>this.handleCartExpiredDialogConfirm()}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}}};qo.style=".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}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}";export{qo as zonos_checkout}
1
+ import{r as o,h as e,F as t,a as s}from"./p-ce75b047.js";import{s as n,a as i,b as c,i as r,c as a,d,e as l,f as u,g as h,h as m,j as p,k as g,l as f,t as w,m as z,n as k,o as v,p as y,q as C,r as b,u as S,v as x,w as I,x as T,y as A,z as O,A as _,B,C as L,D as P,E,F as U}from"./p-6987f9c9.js";import{p as D,s as j,a as N,b as $}from"./p-84dbf474.js";import{f as R,l as F,a as M,g as H,s as K,V as Z,b as V,t as G,c as W,d as Q}from"./p-adb9827c.js";import{z as Y,g as q,m as J}from"./p-f3cfd8fa.js";import{b as X}from"./p-83666056.js";import{h as oo,l as eo,g as to,j as so,b as no,s as io,a as co,i as ro}from"./p-41dd1cb8.js";import{u as ao}from"./p-367a72bc.js";import{l as lo,g as uo,b as ho}from"./p-0a377722.js";import{_ as mo,c as po,a as go,d as fo,g as wo}from"./p-b2d81c98.js";import{c as zo}from"./p-b4b7f705.js";import{c as ko}from"./p-595f5dd2.js";import{g as vo}from"./p-db3b101a.js";import{i as yo}from"./p-d28be518.js";import{s as Co}from"./p-96d77739.js";import{R as bo}from"./p-08e7107d.js";import"./p-6d81901a.js";import"./p-4c89d04a.js";import"./p-ab0b23f2.js";const So=async()=>{var o,e;try{const t=await fetch("/api/storefront/cart",{credentials:"same-origin",headers:{Accept:"application/json"}});if(!t.ok)return lo(`Failed to fetch BigCommerce cart: ${String(t.status)}`,"error"),null;const s=await t.json();return null!==(e=null===(o=null==s?void 0:s[0])||void 0===o?void 0:o.id)&&void 0!==e?e:null}catch(o){return eo("Error fetching BigCommerce cart data",o),null}},xo=async o=>{try{const e=await fetch(`/api/storefront/checkouts/${o}?include=customer.customerGroup,customer.addresses`,{credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"}});return e.ok?await e.json():(lo(`Failed to fetch BigCommerce checkout: ${String(e.status)}`,"error"),null)}catch(o){return eo("Error fetching BigCommerce checkout data",o),null}},Io=o=>{var e;return!!(null===(e=null==o?void 0:o.customer)||void 0===e?void 0:e.id)},To="isInternationalCheckout",Ao=({action:o}={})=>{const e=new URL("/login.php",window.location.origin);o&&e.searchParams.set("action",o);const t=new URLSearchParams(window.location.search),s=t.get("zonosQaUrl");s&&e.searchParams.set("zonosQaUrl",s);const n=t.get("zonosQaUrlApi");return n&&e.searchParams.set("zonosQaUrlApi",n),to()&&e.searchParams.set("zonosTestMode","1"),e.searchParams.set("from",(()=>{const o=new URLSearchParams;o.set(To,"true");const e=new URLSearchParams(window.location.search),t=e.get("zonosQaUrl");t&&o.set("zonosQaUrl",t);const s=e.get("zonosQaUrlApi");return s&&o.set("zonosQaUrlApi",s),to()&&o.set("zonosTestMode","1"),`cart.php?${o.toString()}`})()),e.toString()},Oo=o=>{const e=new URL(o,window.location.origin),t=new URLSearchParams(window.location.search).get("zonosQaUrl");return t&&e.searchParams.set("zonosQaUrl",t),to()&&e.searchParams.set("zonosTestMode","1"),e.toString()},_o={customerGroupId:null,shouldBypass:!1};let Bo=null;const Lo=o=>{const e=(async o=>{var e,t,s,n;if(!window.Zonos.isBigCommerce)return{conclusive:!0,result:_o};const i=null===(e=Y.genericSettings)||void 0===e?void 0:e.bigcommerceBypassCustomerGroupIds;if(!(null==i?void 0:i.length))return Y.loadedConfig?{conclusive:!0,result:_o}:{conclusive:!1,result:_o};const c=o?o.checkoutId:await So();if(!c)return lo("BigCommerce bypass check: no active cart yet, will retry on next call","info"),{conclusive:!1,result:_o};const r=o?o.checkout:await xo(c);if(!r)return lo("BigCommerce bypass check: failed to fetch checkout data, will retry","info"),{conclusive:!1,result:_o};const a=null!==(n=null===(s=null===(t=r.customer)||void 0===t?void 0:t.customerGroup)||void 0===s?void 0:s.id)&&void 0!==n?n:null;if(null===a)return lo("BigCommerce bypass check: no customer group found (guest user)","info"),{conclusive:!0,result:_o};const d=i.includes(a),l={customerGroupId:a,shouldBypass:d};return lo(d?`BigCommerce bypass check: customer group ${String(a)} is in bypass list; caller should keep the user on BC native checkout`:`BigCommerce bypass check: customer group ${String(a)} is not in bypass list`,"info"),{conclusive:!0,result:l}})(o),t=e.then((({conclusive:o,result:e})=>(o||Bo!==t||(Bo=null),e)));return Bo=t,t},Po=async(o={})=>o.forceRefresh||!Bo?Lo(o.preFetched):Bo,Eo={guestCheckoutType:null},Uo="zonos--bc-checkout-settings",Do={redirectUrl:null,shouldForceLogin:!1};let jo=null;const No=()=>{if(!jo){const o=(async()=>{var o;if(!window.Zonos.isBigCommerce)return Eo;const e=null===(o=Y.checkoutSettings.bigCommerceConfig)||void 0===o?void 0:o.storeHash;if(!e)return lo("BigCommerce checkout settings: no storeHash provided — skipping fetch","info"),Eo;const t=(o=>{try{const e=window.localStorage.getItem(Uo);if(!e)return null;const t=so(e);return t?t.storeHash!==o||t.expiresAt<Date.now()?null:{guestCheckoutType:t.guestCheckoutType}:null}catch(o){return null}})(e);if(t)return t;const{errors:s,json:n}=await oo("/api/bigcommerce/checkout-settings",{body:{storeHash:e},method:"POST"});if(s.length||!n)return lo("BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior","info"),Eo;const i={guestCheckoutType:n.guestCheckoutType};return((o,e)=>{try{const t={expiresAt:Date.now()+36e5,guestCheckoutType:e.guestCheckoutType,storeHash:o};window.localStorage.setItem(Uo,JSON.stringify(t))}catch(o){}})(e,i),i})().then((({guestCheckoutType:e})=>e?"no_guest_checkout"===e:(jo===o&&(jo=null),!1))).catch((()=>(jo===o&&(jo=null),!1)));jo=o}return jo},$o=async({preFetched:o}={})=>{if(!window.Zonos.isBigCommerce)return Do;if(!await No())return Do;const e=o?o.checkoutId:await So();if(!e)return Do;const t=o?o.checkout:await xo(e);return t?Io(t)?Do:(lo("BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php","info"),{redirectUrl:Ao(),shouldForceLogin:!0}):(lo("BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue","info"),Do)},Ro="data-zonos-login-from-rewritten",Fo='a[href*="login.php?action=create_account"]:not(['+Ro+"])",Mo=()=>{const o=document.querySelectorAll(Fo);if(!o.length)return;const e=Ao({action:"create_account"});o.forEach((o=>{o.setAttribute("href",e),o.setAttribute(Ro,"true")}))},Ho=(o,e)=>{if(!o.address1||!o.countryCode)return null;const t=[o.firstName,o.lastName].filter(Boolean).join(" ").trim();return{address:{city:o.city||"",country:o.countryCode,line1:o.address1,line2:o.address2||"",postal_code:o.postalCode||"",state:o.stateOrProvinceCode||o.stateOrProvince||""},email:e,name:t,phone:o.phone||""}},Ko=o=>[o.address.line1,o.address.line2||"",o.address.postal_code,o.address.country].join("|").toLowerCase(),Zo=(o=!0,e)=>{var t;if(!F.localizationLoaded)return!1;if(e){const s=!!(null===(t=F.shippingZoneCountries)||void 0===t?void 0:t[e])&&!Y.disabledCountries.includes(e);return o&&!s&&lo(`Checkout: ${e} is not a shippable country: ${s}`),s}return!!F.isShippableCountry||(o&&lo("Checkout: not shippable country"),!1)},Vo='select[name="shippingAddress.countryCode"]';let Go=0;const Wo=o=>{var e;const t=null===(e=K.enabledVariantTestKeys)||void 0===e?void 0:e.find((e=>e.testKey===o));return(null==t?void 0:t.selectedVariantKey)||null},Qo=async({cartId:o,retries:e})=>{const t=to(),{errors:s,json:n}=await oo("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!n||s.length;return i&&e?(lo("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),Qo({cartId:o,retries:e-1})):i?null:n},Yo='<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',qo=class{constructor(e){o(this,e),this.storeUnsubscribeList=[],this.isRedirectAfterOrder=!1,this.preview=!1,this.hiddenMode=!1,this.mobile=!1,this.defaultAddress=[],this.forceDialogOpen=!1,this.defaultAddressParams=[],this.defaultCustomerProfileAddress=[],this.customerProfile=null,this.open=this.forceDialogOpen,this.isOverlayLoading=!1,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.isIframed=!1,this.isLegacyCheckout=window.Zonos.isLegacyCheckout,this.confirmDialogOpen=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.placedOrderInfo=null,this.shouldShowFedexShippingConsentDialog=!1,this.detectedDomesticCheckoutDialogOpen=!1,this.redirectToDomesticCheckoutDialogOpen=!1,this.loggedInIntlAddressConfirmDialogOpen=!1,this.loggedInIntlAddressResolver=null,this.clientSecret=c.clientSecret,this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret,this.applyStripeTheme=async()=>{var o,e,t,s;const n=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||Y.appearance.theme;await r({overrideBorderRadius:null===(e=this.appearanceSettingsOverride)||void 0===e?void 0:e.style,overridePrimaryColor:null===(t=this.appearanceSettingsOverride)||void 0===t?void 0:t.colorPrimary,overrideSecondaryColor:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.colorSecondary,overrideTheme:this.isMobile?n:void 0,paypalEnabled:D()})},this.checkStripePaymentIntentStatus=async({triggeredButton:o})=>{const e=null==o?void 0:o.matches(`#${po}`),t=!!window.Zonos.cartData,s=new URL(window.location.href).searchParams,n=s.get("payment_intent_client_secret"),i=s.get("zonosCheckoutSessionId");if(!e)return lo("Checkout is triggered by user, no need to check stripe payment intent status"),{shouldAllowOrder:!0};if(lo("Payment intent exist, checking stripe payment intent status"),!n)return lo("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:t};const{error:r,status:d}=await a({clientSecret:n});return new URLSearchParams(window.location.search).get("redirect_status")?(lo(r?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen"),this.open=!0,K.checkoutSessionId=i,c.clientSecret=n,this.setToFinishStep(d),{shouldAllowOrder:!1}):t?(lo("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(lo("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})},this.initializeTestKeys=()=>{var o;K.enabledVariantTestKeys=(null==(o=K.enabledVariantTestKeys||[])?void 0:o.filter((o=>!(o.expiresAt&&o.expiresAt<Date.now()||!o.expiresAt))))||[];const e=Y.enabledVariantTestKeys.map((o=>{var e;const t=null===(e=K.enabledVariantTestKeys)||void 0===e?void 0:e.find((({testKey:e})=>e===o));return{expiresAt:(null==t?void 0:t.expiresAt)||Date.now()+Z,selectedVariantKey:(null==t?void 0:t.selectedVariantKey)||null,testKey:o}}));return V(e),{allSelected:!1}},this.shouldAllowHostedVsNativeTest=()=>"function"==typeof Y.checkoutSettings.createCartId&&!!Y.enabledVariantTestKeys.includes("hosted_vs_native"),this.registerTestHostedVsNative=async()=>{if(!this.shouldAllowHostedVsNativeTest())return;lo("[TEST] - Registering hosted vs native test");const o=Wo("hosted_vs_native");if(o)return void lo(`[TEST] - Hosted vs native test already has variant selected: ${o}`);const e=await(async({testKeys:o})=>{if(0===o.length)return null;const{errors:e,json:t}=await oo("/api/zonos-elements/select-variance-test",{body:{testKeys:o},method:"POST"});return e.length||!t?null:R(t)})({testKeys:["hosted_vs_native"]});if(!e)return void lo("[TEST] - Failed to get selection for hosted vs native test");const t=(({baseTestObj:o,mergeTestObj:e})=>o.map((({testKey:o})=>{const t=e.find((({testKey:e})=>e===o));return{expiresAt:(null==t?void 0:t.expiresAt)||Date.now()+Z,selectedVariantKey:(null==t?void 0:t.selectedVariantKey)||null,testKey:o}})))({baseTestObj:K.enabledVariantTestKeys||[],mergeTestObj:e});V(t)},this.handleHostedVsNative=async()=>{var o;if(!this.shouldAllowHostedVsNativeTest())return{redirected:!1};const e=Wo("hosted_vs_native");if(lo(`[TEST] - hosted_vs_native: ${e}`),"function"!=typeof Y.checkoutSettings.createCartId)return lo("[TEST] - createCartId is not provided, skipping hosted vs native test"),{redirected:!1};if("hosted"!==e)return lo("[TEST] - Hosted vs native test is enabled for native, skipping"),{redirected:!1};if(!(null===(o=Y.genericSettings)||void 0===o?void 0:o.hostedCheckoutUrl))return lo("[TEST] - Hosted checkout URL is not provided"),{redirected:!1};lo('"createCartId" is provided, start building cart');const t=await Y.checkoutSettings.createCartId();let s,n=null;"object"==typeof t?(s=t.cartId,n=t.shippingData||null):s=t;const i=(()=>{const o=new URLSearchParams(window.location.search);lo("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:""},t=H(o)||F.selectedCountryCode||"US",s=e("customerCity"),n=e("customerEmail"),i=e("customerAddress1"),c=e("customerAddress2"),r=e("customerName"),a=e("customerPhone"),d=e("customerZip"),l=e("customerState");return{customerAddress1:i,customerAddress2:c,customerCity:s,customerCountry:t,customerEmail:n,customerFirstName:e("customerFirstName"),customerLastName:e("customerLastName"),customerName:r,customerPhone:a,customerState:l,customerZip:d}})(),c=(({cartId:o,checkoutSessionId:e,customerAddress1:t,customerAddress2:s,customerCity:n,customerCountry:i,customerEmail:c,customerFirstName:r,customerLastName:a,customerPhone:d,customerState:l,customerZip:u,hostedCheckoutUrl:h,isTestMode:m,isVariantTest:p})=>{const g=new URLSearchParams;return g.set("tempCartUUID",o),r&&g.set("customerFirstName",r),a&&g.set("customerLastName",a),c&&g.set("customerEmail",c),d&&g.set("customerPhone",d),u&&g.set("customerZip",u),n&&g.set("customerCity",n),l&&g.set("customerState",l),i&&g.set("zCountry",i),t&&g.set("customerAddress1",t),s&&g.set("customerAddress2",s),m&&g.set("zonosTestMode","1"),e&&g.set("zonosCheckoutSessionId",e),p&&g.set("zonosVariantTest","1"),`${h}?${g.toString()}`})(Object.assign(Object.assign({cartId:s,checkoutSessionId:K.checkoutSessionId||void 0,hostedCheckoutUrl:Y.genericSettings.hostedCheckoutUrl,isTestMode:to(),isVariantTest:!0},i),n));return lo(`[TEST] - Redirecting to: ${c}`),window.open(c,"_blank"),{redirected:!0}},this.formatDate=o=>o?new Date(o).toLocaleDateString():"",this.formatTime=o=>o?new Date(o).toLocaleTimeString():"",this.getCurrentLocalePageEnum=()=>{switch(d.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=()=>{const o=d.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:e}}=o;return e?{settlementAmount:(e.discounts||0)+e.items+e.landedCostTotal+e.shipping}:null},this.prefillBigCommerceCustomerAddresses=async()=>{if(!window.Zonos.isBigCommerce)return;if(this.defaultCustomerProfileAddress.length)return;if(Array.isArray(this.defaultAddress)&&this.defaultAddress.length>0||!Array.isArray(this.defaultAddress)&&"object"==typeof this.defaultAddress&&null!==this.defaultAddress)return;const o=await So();if(!o)return;const e=await xo(o);if(!Io(e))return;const t=((o,e)=>{var t,s,n,i;if(!(null===(t=null==o?void 0:o.customer)||void 0===t?void 0:t.id))return[];const{isShippable:c,selectedCountryCode:r}=e,a=o.customer.email||"",d=null!==(n=null===(s=o.consignments)||void 0===s?void 0:s.flatMap((o=>o.shippingAddress?[o.shippingAddress]:[])))&&void 0!==n?n:[],l=null!==(i=o.customer.addresses)&&void 0!==i?i:[],u=new Set,h=[];for(const o of[...l,...d]){const e=Ho(o,a);if(!e)continue;if(!c(e.address.country))continue;const t=Ko(e);u.has(t)||(u.add(t),h.push(e))}return r?h.map(((o,e)=>({index:e,option:o}))).sort(((o,e)=>{const t=o.option.address.country===r;return t===(e.option.address.country===r)?o.index-e.index:t?-1:1})).map((o=>o.option)):h})(e,{isShippable:o=>Zo(!1,o),selectedCountryCode:F.selectedCountryCode||void 0});t.length&&(this.defaultCustomerProfileAddress.length||(this.defaultCustomerProfileAddress=t,lo(`Prefilled ${String(t.length)} BigCommerce customer address(es) for logged-in shopper`,"info")))},this.getDefaultAddress=()=>this.defaultCustomerProfileAddress.length?this.defaultCustomerProfileAddress:Array.isArray(this.defaultAddress)&&this.defaultAddress.length?this.defaultAddress:Array.isArray(this.defaultAddress)||"object"!=typeof this.defaultAddress?this.defaultAddressParams:[this.defaultAddress],this.handleHostedOpenWindowCallback=o=>{var e;const t=null===(e=Y.genericSettings)||void 0===e?void 0:e.hostedCheckoutUrl;if(!origin)return;const s=["dev.checkout.elements.zonos.com"].some((e=>o.origin.includes(e)));o.origin!==t&&!s||"zonos-checkout-session-update"!==o.data.type||(K.checkoutSessionId=o.data.checkoutSessionId)},this.captureParamsRedirectedForVariantTest=()=>{const o=new URL(window.location.href);if("1"!==o.searchParams.get("zonosVariantTest"))return;const e=o.searchParams.get("zonosCheckoutSessionId");e&&(K.checkoutSessionId=e);const t=K.enabledVariantTestKeys||[];window.Zonos.isLegacyCheckout&&(Wo("hosted_vs_native")?V(t.map((o=>"hosted_vs_native"===o.testKey?Object.assign(Object.assign({},o),{selectedVariantKey:"hosted"}):o))):(t.push({expiresAt:Date.now()+Z,selectedVariantKey:"hosted",testKey:"hosted_vs_native"}),V(t))),o.searchParams.delete("zonosCheckoutSessionId"),o.searchParams.delete("zonosVariantTest"),window.history.replaceState({},"",o.toString())}}async initCartInfoHandler(o){l({adjustments:d.adjustments,cartItems:o.detail})}async handleKeyPress(o){"Escape"===o.key&&this.closeDialogHandler()}async closeDialogHandler(o){var e,t;this.open&&((null==o?void 0:o.confirmed)?(this.confirmDialogOpen=!1,j({event:"zonos-checkout-close",metadata:{checkoutSessionId:K.checkoutSessionId}}),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==d.step||u(),d.step="customer-info",h(),m(),null===(t=(e=Y.checkoutSettings).onClose)||void 0===t||t.call(e)):this.confirmDialogOpen=!0)}async buildCartAndInit(){if("function"==typeof Y.checkoutSettings.createCartId){lo('"createCartId" is provided, start building cart'),d.customMessage=[];const o=await Y.checkoutSettings.createCartId();let e;"object"==typeof o?(lo("object detected, use cartId and prefill address from createCartId","info",o),e=o.cartId,this.useShippingDataFromCreateCartId(o.shippingData),d.customerAuthenticationToken=o.customerAuthenticationToken||null,d.customMessage=Array.isArray(o.customMessage)?o.customMessage.filter((o=>"string"==typeof o)):[]):e=o,window.Zonos.cartId=e;const t=await(async o=>{const{isDgsCartId:e,isLegacyCartId:t}=mo(o);if(!t&&!e)return eo("[ZONOS - loadZonos] invalid cart id"),null;const s=await Qo({cartId:o,retries:5});return lo("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(eo("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(e),s=null==t?void 0:t.cartData;if(!s)return eo("Failed to build cart, please try again."),!1;window.Zonos.cartData=s;const{adjustments:n,cartItems:i}=X(s);await l({adjustments:n,cartItems:i})}else if(window.Zonos.cartData){lo("tempCartUUID is provided, start building cart");const{adjustments:o,cartItems:e}=X(window.Zonos.cartData);await l({adjustments:o,cartItems:e})}else if(Y.checkoutSettings.buildCartDetail&&F.selectedCountryCode){lo("build cart detail");const o=await Y.checkoutSettings.buildCartDetail({countryCode:F.selectedCountryCode,currencyCode:F.targetCurrency}),e=o.filter((o=>o.amount>=0)),t=o.filter((o=>o.amount<0));lo("cartItems","info",{cartItems:o});const s=t.map((o=>({amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"})));await l({adjustments:s,cartItems:e})}if(!K.checkoutSessionId){const o=await p();if(lo(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}d.isStagingMode||g(),await this.applyStripeTheme();const{successBehavior:o,successRedirectUrl:e}=Y.checkoutSettings;return this.isRedirectAfterOrder="REDIRECT_TO_SUCCESS_PAGE"===o||"CLOSE_MODAL"===o&&!!e||!!d.externalConfirmationPageURL,!0}reloadCheckoutSession(){window.location.reload()}handleOrderDuplication(){const o=so(localStorage.getItem("zonos--placed-order-info"));if(!o)return void localStorage.removeItem("zonos--placed-order-info");const e=Date.now()-o.time;lo(`=== Existing placed order info: ${o.orderId} - ${this.formatDate(o.time)} - elapsed in hh:ss format: ${new Date(e).toISOString().substring(11,8)}`,"warn");const t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||216e5;if(e>t)return lo(`=== Existing placed order info is older than ${t}ms, cleaning localStorage`,"warn"),void localStorage.removeItem("zonos--placed-order-info");this.placedOrderInfo=o,lo("=== Showing order duplication confirmation","warn")}recordCheckoutInfo(){K.checkoutSessionId&&ao({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:K.checkoutSessionId})}confirmProceedWithOrderDuplication(){this.placedOrderInfo=null,K.checkoutSessionId&&ao({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:K.checkoutSessionId})}markTheSessionAsAbandonedCart(){K.checkoutSessionId&&ao({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:K.checkoutSessionId})}handleCancelOrderDuplication(){var o;if(this.placedOrderInfo=null,this.isLegacyCheckout){const e=(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||Y.onlineStoreSettings.url;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}this.closeDialogHandler({confirmed:!0})}attachCheckout(){const o=Y.checkoutSettings.placeOrderButtonSelector,e=Y.checkoutSettings.alwaysTriggerInternationalCheckoutSelector,t=!!document.querySelector(`#${po}`);if(lo(`attach checkout ${o}`),lo(`attach checkout to always trigger international checkout selector: ${e}`),!(o||e||window.Zonos.cartData||t))return;const s=[o,e,`#${fo}`,`#${po}`,`#${go}`].filter(Boolean);document.querySelectorAll(s.join(",")).forEach((t=>{t.getAttribute("data-zonos-checkout-attached")||(lo(`attached event to button ${o}`,"info",{button:t}),t.addEventListener("click",(async o=>{var s,n;const i=performance.now(),r=e&&t.matches(e),a=t.matches(`#${go}`),l=t.matches(`#${fo}`)||t.matches(`#${po}`);if(!window.Zonos.isLegacyCheckout&&(!Zo()||((o=!0)=>!F.localizationLoaded||!!F.isDisabledCountry&&(o&&lo("Checkout: disabled country"),!0))())&&!r&&!a&&!l)return;o.preventDefault(),o.stopPropagation(),lo("zonos checkout button clicked");const{shouldAllowOrder:u}=await this.checkStripePaymentIntentStatus({triggeredButton:o.target});if(u){if(window.Zonos.logIntervalId||(window.Zonos.logIntervalId=setInterval((()=>{(async()=>{if(0===window.Zonos.loadTimeApiInfoList.length)return;lo("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});const o={data:[...window.Zonos.loadTimeApiInfoList],storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;const{errors:e}=await oo("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"});e.length&&(window.Zonos.loadTimeApiInfoList.push(...o.data),Go++,Go>5&&window.Zonos.logIntervalId&&clearInterval(window.Zonos.logIntervalId))})()}),2e3)),Y.enabledVariantTestKeys.includes("hosted_vs_native")){this.isOverlayLoading=!0,await this.registerTestHostedVsNative();const{redirected:o}=await this.handleHostedVsNative();if(this.isOverlayLoading=!1,o)return}if(window.Zonos.isBigCommerce){const{shouldBypass:o}=await Po();if(o)return lo("Bypass customer group detected, redirecting to BigCommerce native checkout","info"),void(window.location.href=Oo("/checkout"));const e=await $o();if(e.shouldForceLogin&&e.redirectUrl)return void(window.location.href=e.redirectUrl)}c.isFetchingSession=!0,this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");null===(s=window.opener)||void 0===s||s.postMessage({checkoutSessionId:K.checkoutSessionId,type:"zonos-checkout-session-update"},"*"),f({isPreview:this.preview,sessionTimeout:54e5}),j({event:"zonos-checkout-start",metadata:{checkoutSessionId:K.checkoutSessionId}}),w({checkoutSessionId:K.checkoutSessionId,eventName:"checkout_open"});const{enabled:o}=await(async()=>{const{errors:o,json:e}=await oo("/api/zonos-elements/get-store-discount-enabled-status");return o.length||!(null==e?void 0:e.enabled)?{enabled:!1}:{enabled:!0}})();if(d.shouldHideDiscountInput=!o,this.handleOrderDuplication(),window.Zonos.isLegacyCheckout)(async()=>{const{elapsedTime:o}=uo(),e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:ho},no()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId||0};oo("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})();else{(async({loadTime:o})=>{const e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:ho},no()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId||0};oo("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})({loadTime:performance.now()-i})}this.recordCheckoutInfo(),wo()&&this.markTheSessionAsAbandonedCart()}catch(o){if(o instanceof Error&&"Cart is expired."===o.message&&(this.isCartExpired=!0),c.isFetchingSession=!1,eo(o),this.isCartExpired)return void(c.isFetchingSession=!0);io({endpoint:"Error creating Checkout",errors:[o instanceof Error?o.toString():"Unknown error"],metadata:{allLogs:ho,cartId:window.Zonos.cartId,checkoutSessionBody:z(),href:window.location.href,storeBaseUrl:(null===(n=window.Zonos.cartData)||void 0===n?void 0:n.storeBaseUrl)||Y.onlineStoreSettings.url}}),k({messages:[G("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:G("Error creating Checkout")})}}}),{capture:!0,passive:!1}),Y.checkoutSettings.disablePlaceOrderButtonActivation||t.removeAttribute("disabled"),t.setAttribute("data-zonos-checkout-attached","true"),t.matches(`#${fo}`)&&(t.dispatchEvent(ko("click")),v(),t.remove()),t.matches(`#${po}`)&&(t.dispatchEvent(ko("click")),t.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useShippingDataFromCreateCartId(o){if(!o)return;lo("shipping data from createCartId result","info",Object.entries(o));const{customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:n,customerEmail:i,customerFirstName:c,customerLastName:r,customerName:a,customerPhone:d,customerState:l,customerZip:u}=o,h=new URLSearchParams(window.location.search),m=n||H(h)||F.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:m,customerEmail:i,customerFirstName:c,customerLastName:r,customerName:a,customerPhone:d,customerState:l,customerZip:u})}useLegacyQueryParams(){const o=new URLSearchParams(window.location.search);lo("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:null},t=H(o)||F.selectedCountryCode,s=e("customerCity"),n=e("customerEmail"),i=e("customerAddress1"),c=e("customerAddress2"),r=e("customerName"),a=e("customerFirstName"),d=e("customerLastName"),l=e("customerPhone"),u=e("customerZip"),h=e("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:c,customerCity:s,customerCountry:t,customerEmail:n,customerFirstName:a,customerLastName:d,customerName:r,customerPhone:l,customerState:h,customerZip:u})}applyPrefillAddress(o){const e=o.customerAddress1||"",t=o.customerCountry||"",s=o.customerAddress2||"",n=o.customerCity||"",i=o.customerEmail||"",c=o.customerFirstName&&o.customerLastName?`${o.customerFirstName} ${o.customerLastName}`:o.customerName||"",r=o.customerPhone||"",a=o.customerZip||"",d=o.customerState||"";e&&c&&r&&t?t&&F.shippingZoneCountries&&!(t in F.shippingZoneCountries)?lo(`Country "${t}" is not in the shipping zone, so it can not be prefilled`,"warn"):(this.defaultAddressParams=[{address:{city:n||"",country:t,line1:e,line2:s,postal_code:a,state:d},email:i,name:c,phone:r}],lo("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})):lo("Missing required query params so it can not be prefilled","info",[!e&&"line1",!c&&"name",!r&&"phone",!t&&"country"].filter(Boolean).join(", "))}overrideStagingModeChanged(){d.isStagingMode=!!this.overrideStagingMode}async init(){c.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,d.isStagingMode=co(),void 0!==this.overrideStagingMode&&(d.isStagingMode=this.overrideStagingMode),(()=>{var o;if(!window.Zonos.isBigCommerce)return;const e=null===(o=Y.genericSettings)||void 0===o?void 0:o.bigcommerceBypassCustomerGroupIds;(null==e?void 0:e.length)&&Lo()})(),window.Zonos.isBigCommerce&&No(),(()=>{if(!window.Zonos.isBigCommerce)return;if(!window.location.pathname.includes("/login.php"))return;Mo();const o=new MutationObserver((()=>{Mo()}));o.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>o.disconnect()),1e4)})(),this.handleBigcommerceInternationalResumeFlag(),this.prefillBigCommerceCustomerAddresses(),(({domesticRedirectedBtnSelector:o,onInternationalCheckoutSelected:e,onLoggedInInternationalAddressDetected:t,onShippingAddressSessionFound:s})=>{if(!window.Zonos.isBigCommerce)return;const c=async o=>{var t;const s=document.querySelector((null===(t=Y.genericSettings)||void 0===t?void 0:t.bigcommerceDomesticCheckoutCountrySelector)||Vo),n=(null==s?void 0:s.value)||o;if(!n)return!1;if(!Zo(!1,n))return!1;const c=await So(),r={checkout:c?await xo(c):null,checkoutId:c},{shouldBypass:a}=await Po({forceRefresh:!0,preFetched:r});if(a)return lo("Bypass customer group detected on BC checkout, stopping interval","info"),!0;const d=await $o({preFetched:r});if(d.shouldForceLogin&&d.redirectUrl)return window.location.href=d.redirectUrl,!0;e&&await e(),M({isInitializing:!1,newSelectedCountryCode:n});const l={address1:"",address2:"",city:"",countryCode:n,firstName:"",lastName:"",phone:"",postalCode:"",stateOrProvince:""};return i({address1:l.address1,address2:l.address2,city:l.city,countryCode:l.countryCode,firstName:l.firstName,lastName:l.lastName,phone:l.phone,postalCode:l.postalCode,state:l.stateOrProvince}),window.location.href=Oo("/"),!0};let r=!1,a=!1,d=!1,l=!1,u=!1;const h=new MutationObserver((async()=>{var m;const p=document.querySelector(o),g=n();if(!p&&g){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==s||s(g),void h.disconnect()}if(!window.location.pathname.includes("/checkout")||!window.Zonos.isBigCommerce)return void h.disconnect();if(!l&&!d){d=!0,u=!0;try{const o=await(async({onInternationalCheckoutSelected:o,onLoggedInInternationalAddressDetected:e})=>{var t,s,n,c,r,a,d,l,u,h;const m=await So();if(!m)return"noAction";const p=await xo(m),g={checkout:p,checkoutId:m},{shouldBypass:f}=await Po({preFetched:g});if(f)return"noAction";const w=null===(s=null===(t=null==p?void 0:p.consignments)||void 0===t?void 0:t[0])||void 0===s?void 0:s.shippingAddress;if(!(null==w?void 0:w.countryCode))return"noAction";const z=w.countryCode;if(!Zo(!1,z))return"noAction";if(lo(e?`Logged-in user has international shipping address: ${z}, prompting user to choose checkout`:`Logged-in user has international shipping address: ${z}, redirecting automatically (legacy behavior)`,"info"),e&&"stay"===await e())return lo("User opted to stay on BigCommerce native checkout despite international default address","info"),"optedOut";const k=await $o({preFetched:g});return k.shouldForceLogin&&k.redirectUrl?(window.location.href=k.redirectUrl,"redirected"):(o&&await o(),M({isInitializing:!1,newSelectedCountryCode:z}),i({address1:null!==(n=w.address1)&&void 0!==n?n:"",address2:null!==(c=w.address2)&&void 0!==c?c:"",city:null!==(r=w.city)&&void 0!==r?r:"",countryCode:z,firstName:null!==(a=w.firstName)&&void 0!==a?a:"",lastName:null!==(d=w.lastName)&&void 0!==d?d:"",phone:null!==(l=w.phone)&&void 0!==l?l:"",postalCode:null!==(u=w.postalCode)&&void 0!==u?u:"",state:null!==(h=w.stateOrProvince)&&void 0!==h?h:""}),window.location.href=Oo("/"),"redirected")})({onInternationalCheckoutSelected:e,onLoggedInInternationalAddressDetected:t});if("redirected"===o)return void h.disconnect();"optedOut"===o&&(l=!0)}catch(o){eo("Error checking logged-in user shipping address",o)}finally{d=!1,u=!1}}const f=document.querySelector((null===(m=Y.genericSettings)||void 0===m?void 0:m.bigcommerceDomesticCheckoutCountrySelector)||Vo);if(!f)return;if(lo("Domestic checkout found - Listening for shipping country change","info",{value:f.value}),a)return;a=!0,h.disconnect();const w=setInterval((async()=>{if(!r&&!u){r=!0;try{if(await c())return void clearInterval(w);r=!1}catch(o){r=!1}}}),1e3),z=setInterval((()=>{var o;if(!window.bcStripeElements)return void clearInterval(z);const e=null===(o=window.bcStripeElements)||void 0===o?void 0:o.getElement("address");e&&(clearInterval(z),e.on("change",(o=>{const e=o.value.address.country;e&&!u&&c(e)})))}),500)}));h.observe(document.body,{childList:!0,subtree:!0})})({domesticRedirectedBtnSelector:fo,onInternationalCheckoutSelected:async()=>{this.detectedDomesticCheckoutDialogOpen=!0,await new Promise((o=>setTimeout(o,2e3)))},onLoggedInInternationalAddressDetected:()=>new Promise((o=>{this.loggedInIntlAddressResolver=o,this.loggedInIntlAddressConfirmDialogOpen=!0})),onShippingAddressSessionFound:o=>{this.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:`${o.firstName} ${o.lastName}`,phone:o.phone}]}}),window.Zonos&&this.useLegacyQueryParams();const o=setInterval((()=>{c.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(lo("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():window.Zonos.isLegacyCheckout?this.attachCheckout():window&&(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(o)):lo("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(o)}),1e4)}handleBigcommerceInternationalResumeFlag(){if(!window.Zonos.isBigCommerce)return;const o=new URL(window.location.href);if("true"!==o.searchParams.get(To))return;o.searchParams.delete(To),window.history.replaceState({},"",o.toString());const e=Date.now(),t=setInterval((()=>{if(!F.localizationLoaded||!F.selectedCountryCode)return void(Date.now()-e>15e3&&(clearInterval(t),lo("BigCommerce international checkout resume flag: localization did not initialize within 15s","info")));const o=document.querySelector(`#${go}`);if(o)return clearInterval(t),void o.dispatchEvent(ko("click"));Date.now()-e>15e3&&(clearInterval(t),lo("BigCommerce international checkout resume flag: trigger button did not mount within 15s","info"))}),200)}async setToFinishStep(o){d.step="finish",this.storybookPaymentStatusOverride=o}async mockCheckoutSession(o){y(o)}async triggerCheckoutInternational(){const o=document.querySelector(`#${go}`);o&&o.dispatchEvent(ko("click"))}async handleCustomerInfoContinue(){var o,e,t,s;j({event:"zonos-checkout-customer-info",metadata:{checkoutSessionId:K.checkoutSessionId}}),w({checkoutSessionId:K.checkoutSessionId,eventName:"checkout_customerInfoCompleted"}),this.submitLoading=!0;const{isRequestNotReady:n}=await C();n&&"stripe"===d.addressFormRenderType&&io({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:null===(e=null===(o=c.stripeAddressEventData)||void 0===o?void 0:o.value)||void 0===e?void 0:e.address,billingAddress:null===(s=null===(t=c.stripeBillingAddressEventData)||void 0===t?void 0:t.value)||void 0===s?void 0:s.address,cartId:window.Zonos.cartId}});const i=o=>{"customer-info"===d.step?c.isFetchingLandedCost||(d.landedCostData&&($({currency:d.currency}),b()),this.submitLoading=!1,o&&clearInterval(o)):clearInterval(o)};i();const r=setInterval((()=>{i(r)}),20);setTimeout((()=>{clearInterval(r)}),1e4)}async handleShippingContinue(){b()}handleInventoryCheckDialogConfirm(){d.inventoryCheckErrorMessage=null,this.isLegacyCheckout||this.closeDialogHandler({confirmed:!0})}handleCartExpiredDialogConfirm(){var o;if(this.isCartExpired=!1,this.isLegacyCheckout){const e=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}window.parent&&(window.parent.location.href=window.location.href),window.location.reload()}async handleStripePaymentContinue(){if("USD"!==c.checkoutSettlementCurrency||!c.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,N.paypalErrorMessage=null,c.hasPaymentError=!1,this.submitLoading=!0,d.inventoryCheckErrorMessage=null,!await S())return c.hasPaymentError=!0,c.customErrorMessage=G("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:c.checkoutSettlementCurrency}),void(this.submitLoading=!1);try{d.inventoryCheckErrorMessage=await x()}catch(o){d.inventoryCheckErrorMessage=G("Unable to check inventory. Please try again.")}if(d.inventoryCheckErrorMessage)this.submitLoading=!1;else{if(U()>0){const o=await I();if(!o.success)return c.hasPaymentError=!0,c.customErrorMessage=o.error||G("Unable to apply store credit. Please try again."),void(this.submitLoading=!1)}if(T()){try{const o=await A();if(!o.valid)return c.hasPaymentError=!0,c.customErrorMessage=o.errorMessage,void(this.submitLoading=!1);const e=await O();if(!e.success)return c.hasPaymentError=!0,c.customErrorMessage=e.error||G("Unable to place order with store credit. Please try again."),void(this.submitLoading=!1);b(),m()}catch(o){eo(o),j({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:K.checkoutSessionId}}),c.hasPaymentError=!0}this.submitLoading=!1}else{try{await _(),b(),m()}catch(o){eo(o),j({event:"zonos-checkout-payment-fail",metadata:{checkoutSessionId:K.checkoutSessionId}}),c.hasPaymentError=!0,c.shouldInventoryRefund&&(B(),c.shouldInventoryRefund=!1)}this.submitLoading=!1}}}else this.payInUsdConfirmDialogOpen=!0}async handleFinishClick(){if(L(),this.preview)return d.step="customer-info",void await this.init();if(u(),window.Zonos.isLegacyCheckout&&window.Zonos.cartData){const o=window.Zonos.cartData.storeBaseUrl||Y.onlineStoreSettings.url;return window.parent&&(window.parent.location.href=o),void(window.location.href=o)}const o=window.location.href.split("?")[0];this.open=!1,window.location.hostname.includes("dashboard.zonos.com")||(window.history.replaceState(window.history.state,document.title,o),window.location.reload())}handleWindowResize(){this.isMobile=ro(this.mobile),this.applyStripeTheme(),lo(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=ro(this.mobile),this.applyStripeTheme(),lo(`mobile: ${this.isMobile}`)}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=q(this.appearanceSettingsOverride.theme))}handleAddressChange(){L()}handleCustomerProfileChange(){var o,e;if(!this.customerProfile)return lo("No customer profile","info"),void(this.defaultCustomerProfileAddress=[]);lo("Customer profile found","info",{customerProfile:this.customerProfile}),this.defaultCustomerProfileAddress=(null===(e=null===(o=c.customerProfile)||void 0===o?void 0:o.locations)||void 0===e?void 0:e.map((o=>{var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||(null===(e=c.customerProfile)||void 0===e?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]}handleClientSecretChange(){lo("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret}),this.applyStripeTheme()}handleOpenChange(){const o="data-zonos-overflow-origin",e=document.body,t=document.documentElement;if(this.open)window.Zonos.openHelloDialog(!1),e.style.overflow&&e.setAttribute(o,e.style.overflow),e.style.overflow="hidden",t.style.overflow&&t.setAttribute(o,t.style.overflow),t.style.overflow="hidden";else{this.stripeCustomerSessionClientSecret=null;const s=e.getAttribute(o),n=t.getAttribute(o);s?(e.removeAttribute(o),e.style.overflow=s):e.style.removeProperty("overflow"),n?(t.removeAttribute(o),t.style.overflow=n):t.style.removeProperty("overflow")}}componentWillLoad(){this.init(),this.isMobile=ro(this.mobile),this.isIframed=window.self!==window.top,lo(`iframed: ${this.isIframed}`),window.Zonos.isLegacyCheckout&&this.captureParamsRedirectedForVariantTest(),this.handleAppearanceSettingsOverrideChange(),this.storeUnsubscribeList=[W("selectedLocale",(()=>{this.applyStripeTheme()})),P("selectedShippingOption",(()=>{var o,e,t,s;const n=d.selectedShippingOption;(null===(o=Y.genericSettings)||void 0===o?void 0:o.shouldFedExShippingConsentForCanadianShopper)&&(null===(t=null===(e=null==n?void 0:n.shippingProfile)||void 0===e?void 0:e.serviceLevel.code)||void 0===t?void 0:t.toLowerCase().startsWith("fedex."))&&"CA"===(null===(s=c.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)&&(this.shouldShowFedexShippingConsentDialog=!0)})),E("stripeAddressEventData",(o=>{var e;if(!window.Zonos.isBigCommerce||!o||this.redirectToDomesticCheckoutDialogOpen||!(null===(e=Y.genericSettings)||void 0===e?void 0:e.isBigcommerceDomesticCheckoutRedirectEnabled)||"USD"!==Y.sourceCurrency)return;if(!this.open)return;if(window.location.pathname.includes("/checkout"))return;const t=o.value.address.country;t&&Y.disabledCountries.includes(t)&&(this.redirectToDomesticCheckoutDialogOpen=!0,lo(`Domestic country ${t} selected in international checkout, redirecting to BigCommerce domestic checkout`,"info"),setTimeout((()=>{window.location.href=Oo("/checkout")}),2e3))}))],this.initializeTestKeys(),window.addEventListener("message",this.handleHostedOpenWindowCallback),lo(`mobile: ${this.isMobile}`)}disconnectedCallback(){L(),u(),this.storeUnsubscribeList.forEach((o=>o())),window.removeEventListener("message",this.handleHostedOpenWindowCallback)}render(){var o,n,i,r;this.customerProfile=c.customerProfile,this.clientSecret=c.clientSecret,c.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=c.stripeCustomerSessionClientSecret);const a="finish"!==d.step&&"error"!==d.step&&!c.stripeElements||c.isFetchingSession,{colorPrimary:l,colorSecondary:u,logoUrl:h,style:m}=J(Y.appearance,this.appearanceSettingsOverride||null),p="ENABLED"===Y.appearance.zonosAttribution,g=Y.appearance.theme,f=l&&yo(l)?"DARK":"LIGHT",w=this.isMobile?g:f,z=this.isMobile?void 0:u,{customMessages:k}=F,v=null===(o=k.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,y=this.getCurrentLocalePageEnum(),C=k.filter((o=>o.pageName===y)),b=this.getBaseCurrencySettlementInfo(),S=()=>{const o=this.preview?`${h}?timestamp=${Date.now()}`:h;return e("div",{class:"zonos--logo"},o&&e("img",{alt:`${Y.organizationName} logo`,src:o}))},x=to(),I=()=>{const o=new URLSearchParams(window.location.search),t=o.get("zonosQaUrl"),s=o.get("zonosDebug"),n=o.get("zonosE2ETest"),i=this.overrideStagingMode||co();return e("zonos-v-stack",null,e("div",{class:"zonos--logo-wrapper"},S(),x&&e("zonos-badge",{badgeColor:"orange",size:"small"},G("Test mode")),i&&e("zonos-badge",{badgeColor:"red",size:"small"},G("Staging mode")),"1"===s&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t),n&&e("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),e("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--zonos-elements-gray-0":null}),C.map((o=>e("zonos-custom-message",{icon:Yo,message:o.message}))))},T=()=>d.checkoutSessionTimeoutShow?e("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:G("Your checkout session has expired. Please reload the page to continue."),restStateTitle:G("Session timed out"),restStateType:"Warning"},e("zonos-button",{onClick:()=>this.reloadCheckoutSession(),variant:"primary"},G("Reload"))):e("div",{class:"zonos--content",style:{"--zonos--border-radius":vo({overrideBorderStyle:m})}},"finish"!==d.step&&"error"!==d.step&&e(t,null,e("div",{class:"zonos--left","data-theme":w,style:Co({"--zonos--primary-color":this.isMobile?void 0:l})},!this.isMobile&&I(),"customer-info"===d.step&&e("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.getDefaultAddress(),isMobile:this.isMobile,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:z}),"shipping"===d.step&&e("zonos-shipping",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:z}),"payment"===d.step&&e("zonos-checkout-payment",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:async()=>{await this.handleStripePaymentContinue()},submitBtnColor:z})),e("div",{class:"zonos--right","data-theme":g},this.isMobile&&I(),e("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&e("zonos-currency-toggle",null),!this.isLegacyCheckout&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:bo}),noBackground:!0,onClick:()=>this.closeDialogHandler()})),e("div",{class:"flex--wrapper"},e("div",{class:"zonos--wrapper"},e("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)}}),e("zonos-collapse",{collapsed:this.collapseReviewMobile&&this.isMobile},e("zonos-cart-items",null),this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",{submitBtnColor:z}),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Yo,message:v})))),e("zonos-cart-restricted-items",null),!this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",null),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Yo,message:v}))))),("finish"===d.step||"error"===d.step)&&e("div",{class:"zonos--done","data-theme":g},e("div",{class:"zonos--header"},S(),!this.isRedirectAfterOrder&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:bo}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:g})),e("zonos-checkout-finish",{borderRadius:m,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===d.step&&d.error?Object.assign(Object.assign({},d.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),e("zonos-checkout-footer",{"data-theme":g,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return e(s,{class:zo(["zonos--checkout zonos--elements","payment"===d.step&&"zonos--processing-payment",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?T():e("zonos-dialog",{borderStyle:m,class:"zonos--checkout-dialog","data-theme":g,height:"980px",isLoading:a,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},T()),e("zonos-dialog",{isLoading:!0,loadingText:G("You will be redirected to international checkout shortly."),loadingTitle:G("We detected that you are shipping to an international address."),noClickOutside:!0,noCloseButton:!0,open:this.detectedDomesticCheckoutDialogOpen,width:"450px"}),e("zonos-dialog",{isLoading:!0,loadingText:G("You will be redirected to domestic checkout shortly."),loadingTitle:G("We detected that you are shipping to a domestic address."),noClickOutside:!0,noCloseButton:!0,open:this.redirectToDomesticCheckoutDialogOpen,width:"450px"}),e("zonos-confirm-dialog",{class:"zonos--logged-in-intl-address-dialog",dialogCancelBtnText:G("Stay on this page"),dialogConfirmBtnText:G("Continue to international checkout"),dialogIntent:"info",dialogOpen:this.loggedInIntlAddressConfirmDialogOpen,dialogSubtitle:G("Your saved default address ships internationally. Would you like to continue to international checkout, or stay here and select a domestic address?"),dialogTitle:G("International shipping address detected"),dialogWidth:480,onCancelClicked:()=>{var o;this.loggedInIntlAddressConfirmDialogOpen=!1,null===(o=this.loggedInIntlAddressResolver)||void 0===o||o.call(this,"stay"),this.loggedInIntlAddressResolver=null},onConfirmClicked:()=>{var o;this.loggedInIntlAddressConfirmDialogOpen=!1,null===(o=this.loggedInIntlAddressResolver)||void 0===o||o.call(this,"redirect"),this.loggedInIntlAddressResolver=null}}),e("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:G("Don't close"),dialogConfirmBtnText:G("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:G("Would you like to close checkout and return to the site?"),dialogTitle:G("Are you sure?"),onCancelClicked:()=>{this.confirmDialogOpen=!1},onConfirmClicked:()=>this.closeDialogHandler({confirmed:!0})}),e("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:G("Return to merchant site"),dialogConfirmBtnText:G("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:(null===(n=this.placedOrderInfo)||void 0===n?void 0:n.zonosOrderNumber)?G("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)}):G("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((null===(i=this.placedOrderInfo)||void 0===i?void 0:i.time)||null),time:this.formatTime((null===(r=this.placedOrderInfo)||void 0===r?void 0:r.time)||null)}),dialogTitle:G("Are you sure?"),dialogWidth:530,onCancelClicked:()=>{this.handleCancelOrderDuplication()},onConfirmClicked:()=>{this.confirmProceedWithOrderDuplication()}}),e("zonos-confirm-dialog",{class:"zonos--fedex-shipping-dialog",dialogConfirmBtnText:G("Confirm"),dialogIntent:"info",dialogOpen:!!this.shouldShowFedexShippingConsentDialog,dialogSubtitle:e(t,null,G("If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly—usually by email or phone—with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request."),e("zonos-link",{href:"https://ftn.fedex.com/us/assets/docs/One-Time_GAA.pdf",target:"_blank"},G("View GAA Form."))),dialogTitle:G("Fedex Shipping Procedure"),dialogType:"alert",dialogWidth:500,onConfirmClicked:()=>this.shouldShowFedexShippingConsentDialog=!1}),e("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:G("Return to cart"),dialogIntent:"danger",dialogOpen:!!d.inventoryCheckErrorMessage,dialogSubtitle:d.inventoryCheckErrorMessage,dialogTitle:G("Couldn't place order"),dialogType:"alert",onConfirmClicked:()=>this.handleInventoryCheckDialogConfirm()}),b&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:G("Cancel"),dialogConfirmBtnText:G("Pay [orderTotal]",{orderTotal:Q({amount:b.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:G("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:G("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),e("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:G("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:G("You are being sent back to the shop to re-add items to your cart."),dialogTitle:G("Shopping cart expired"),dialogType:"alert",onConfirmClicked:()=>this.handleCartExpiredDialogConfirm()}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}}};qo.style=".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}.zonos--processing-payment.sc-zonos-checkout-h{z-index:2147483646}";export{qo as zonos_checkout}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(o,n,e,i){function s(o){return o instanceof e?o:new e((function(n){n(o)}))}return new(e||(e=Promise))((function(e,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?e(o.value):s(o.value).then(c,r)}a((i=i.apply(o,n||[])).next())}))};var __generator=this&&this.__generator||function(o,n){var e={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(n){return a([o,n])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(e=0)),e)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(t=e.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){e.label=r[1];break}if(r[0]===6&&e.label<t[1]){e.label=t[1];t=r;break}if(t&&e.label<t[2]){e.label=t[2];e.ops.push(r);break}if(t[2])e.ops.pop();e.trys.pop();continue}r=n.call(o,e)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-62db5d7c.system.js","./p-f4f71ae4.system.js","./p-8753cb36.system.js","./p-24aae506.system.js","./p-3689821f.system.js","./p-398d9022.system.js","./p-01174496.system.js","./p-6f23a26a.system.js","./p-23e7c655.system.js","./p-d938f42f.system.js","./p-c9e433c0.system.js","./p-eb99a625.system.js","./p-e5dfccd8.system.js","./p-1bf9a1b9.system.js","./p-6a195559.system.js"],(function(o){"use strict";var n,e,i,s,t,c,r,a,l,v,z,d,h,u,f,m,p,g,b,w,x,y,k,_,C,I,S,j,O,T,E,L,U,P,N,A,D,B,R;return{setters:[function(o){n=o.r;e=o.h;i=o.a;s=o.F},function(o){t=o.b;c=o.i;r=o.c;a=o.d;l=o.n;v=o.e;z=o.j;d=o.k;h=o.u;u=o.A;f=o.E;m=o.C;p=o.f},function(o){g=o.i;b=o.a;w=o.b;x=o.c},function(o){y=o.p;k=o.a},function(o){_=o.s;C=o.t;I=o.c;S=o.d;j=o.l},function(o){O=o.z},function(o){T=o.b},function(o){E=o.h;L=o.s;U=o.l;P=o.g},function(o){N=o.i;A=o.a},function(o){D=o.c},function(o){B=o.l},function(o){R=o.l},function(){},function(){},function(){},function(){}],execute:function(){var F='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var V=".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{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-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{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-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var H=V;var K=o("zonos_invoice",function(){function o(o){var e=this;n(this,o);this.storeUnsubscribeList=[];this.onChangeLocaleListener=function(){};this.mobile=false;this.tablet=false;this.stripe=window.Zonos.stripe;this.showLanguageDialogMobile=false;this.submitLoading=false;this.collapseReviewMobile=true;this.isMobile=false;this.isTablet=false;this.isOverlayLoading=true;this.isCartCollected=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.confirmationId=null;this.clientSecret=t.clientSecret;this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=a.selectedLandedCost;if(!o){return null}var n=o.landedCost.amountSubtotals;if(!n){return null}var e=(n.discounts||0)+n.items+n.landedCostTotal+n.shipping;return{settlementAmount:e}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(n){switch(n.label){case 0:o=O.appearance.theme;return[4,c({overrideTheme:this.isMobile?o:undefined,paypalEnabled:y()})];case 1:n.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,E("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:n=e.sent().json;return[2,n]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,n,e,i,s,c,a,l,v,z;return __generator(this,(function(d){switch(d.label){case 0:n=!!window.Zonos.cartData;e=new URL(window.location.href).searchParams;i=e.get("payment_intent_client_secret");s=e.get("zonosCheckoutSessionId");B("Payment intent exist, checking stripe payment intent status");if(!i){B("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:n}]}return[4,r({clientSecret:i})];case 1:c=d.sent(),a=c.error,l=c.status;v=new URLSearchParams(window.location.search).get("redirect_status");if(!(v&&s))return[3,3];if(!a){B("Payment intent is succeeded or in a good state to move forward, show success screen")}else{B("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:z=d.sent();this.confirmationId=((o=z===null||z===void 0?void 0:z.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;_.checkoutSessionId=s;t.clientSecret=i;void this.setToFinishStep(l);return[2,{shouldAllowOrder:false}];case 3:if(!n){B("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}B("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=N(this.mobile);this.isTablet=A(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){t.stripe=window.Zonos.stripe;a.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,t,c,h,u,f,m,p,w,x,y,k,I,S,j,E,P,N,A;return __generator(this,(function(D){switch(D.label){case 0:if(!window.Zonos.cartData){return[2]}p=(n=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||n===void 0?void 0:n.currencyCode;if(p){a.currency=p}w=(i=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.references)===null||i===void 0?void 0:i.checkoutSessionId;x=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!x){l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")});return[2]}if(w){B("Setting checkout session id from cart reference","info",w);_.checkoutSessionId=w}else{B("Clear checkout session id from storage so we start from a fresh session for the invoice cart");_.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:y=D.sent().shouldAllowOrder;if(!y){return[2]}D.label=2;case 2:D.trys.push([2,11,,12]);k=T(window.Zonos.cartData),I=k.adjustments,S=k.cartItems;return[4,v({adjustments:I,cartItems:S,landedCostId:x,shouldInitSessionOnFailure:false})];case 3:D.sent();if(!(!_.checkoutSessionId&&!w))return[3,5];return[4,z()];case 4:j=D.sent();B("stripeStoreInitCheckoutSession: ".concat(j));if(!j){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}D.label=5;case 5:if(!((!a.checkoutSession||((c=a.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&w))return[3,9];return[4,this.fetchCheckoutSession(w)];case 6:E=D.sent();this.confirmationId=((h=E===null||E===void 0?void 0:E.checkoutSession.landedCost)===null||h===void 0?void 0:h.shortId)||null;if(!!(E===null||E===void 0?void 0:E.checkoutSession.completedAt)&&!!E.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(E===null||E===void 0?void 0:E.checkoutSession.clientSecret))return[3,8];return[4,r({clientSecret:E.checkoutSession.clientSecret})];case 7:P=D.sent().status;if(P==="processing"||P==="succeeded"){void this.setToFinishStep(P);return[2]}D.label=8;case 8:void L({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:w,cartId:(u=window.Zonos.cartData)===null||u===void 0?void 0:u.id,cartLandedCostId:x}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!a.checkoutSession){void L({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:w||"N/A",cartId:(f=window.Zonos.cartData)===null||f===void 0?void 0:f.id,cartLandedCostId:x||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void d();N=(m=a.checkoutSession)===null||m===void 0?void 0:m.landedCost;if(!N){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,g(Object.assign(Object.assign({},a.checkoutSession),{id:_.checkoutSessionId||""}))];case 10:D.sent();void b({landedCostId:N.id});void this.applyStripeTheme();return[3,12];case 11:A=D.sent();U(A);l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")});return[3,12];case 12:this.isOverlayLoading=false;return[2]}}))}))};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,c,r,l,v;return __generator(this,(function(z){switch(z.label){case 0:void((o=t.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((n=t.stripeLinkEventData)===null||n===void 0?void 0:n.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((e=t.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){c=document.querySelector(".zonos--billing-address");c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});return[2]}r=t.checkoutSettlementCurrency==="USD";if(r&&t.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;k.paypalErrorMessage=null;t.hasPaymentError=false;this.submitLoading=true;a.inventoryCheckErrorMessage=null;return[4,h()];case 1:l=z.sent();if(!l){t.hasPaymentError=true;t.customErrorMessage=C("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:t.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,w()];case 2:z.sent();z.label=3;case 3:z.trys.push([3,5,,6]);return[4,u({noLandedCostCheck:true})];case 4:z.sent();a.step="finish";this.confirmationId=x.landedCostShortId||((i=a.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:v=z.sent();U(v);t.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;t.stripe=window.Zonos.stripe;a.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[f("clientSecret",(function(){void o.applyStripeTheme()})),I("selectedLocale",(function(){void o.applyStripeTheme()}))];B("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();p();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=t.clientSecret;if(t.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret}var n=this.getBaseCurrencySettlementInfo();var c=O.appearance,r=c.logoUrl,l=c.theme;var v=function(){var o="".concat(r,"?timestamp=").concat(Date.now());return e("div",{class:"zonos--logo"},o&&e("img",{alt:"".concat(O.organizationName," logo"),src:o}))};var z=P();var d=function(){var n;var i=new URLSearchParams(window.location.search);var t=i.get("zonosQaUrl");var c=i.get("zonosDebug");var r=(n=R.find((function(o){return o.code===j.selectedLocale})))===null||n===void 0?void 0:n.label;return e(s,null,e("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},e("div",{class:"zonos--logo-wrapper"},v(),z&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),c==="1"&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t)),e("div",{class:"zonos--header-right"},e("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,e("zonos-icon",{"aria-label":"Language select",content:F,iconColor:"gray-1200"})),e("div",{class:D(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},e("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var h=function(){if(o.isOverlayLoading||t.isFetchingSession){return null}return e("div",{class:"zonos--content"},a.step!=="finish"&&a.step!=="error"&&e(s,null,(o.isMobile||o.isTablet)&&d(),e("div",{class:"zonos--left","data-theme":l},!o.isMobile&&!o.isTablet&&d(),e("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},C("Billing info")),e("zonos-v-stack",{spacing:16},e("zonos-link-authentication",{titleText:""}),e("zonos-address",{titleText:"",type:"billing"})),e("zonos-invoice-payment",{class:D(["zonos--invoice-container"]),continueLoading:o.submitLoading,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))}})),e("div",{class:"zonos--right","data-theme":l},!o.isMobile&&e("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),e("div",{class:"zonos--order-details-container"},!o.isMobile&&e("zonos-invoice-cart-items",null),o.isMobile&&e("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),e("div",{class:"flex--wrapper"},!o.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet})))),(a.step==="finish"||a.step==="error")&&e("div",{class:"zonos--done","data-theme":l},e("div",{class:"zonos--header"},v()),e("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:a.step==="error"&&!!a.error?Object.assign(Object.assign({},a.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||a.step==="finish"||a.step==="error")&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet}))};return e(i,{class:D(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":l},h(),n&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:S({amount:n.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("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:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());K.style=H}}}));
1
+ var __awaiter=this&&this.__awaiter||function(o,n,e,i){function s(o){return o instanceof e?o:new e((function(n){n(o)}))}return new(e||(e=Promise))((function(e,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?e(o.value):s(o.value).then(c,r)}a((i=i.apply(o,n||[])).next())}))};var __generator=this&&this.__generator||function(o,n){var e={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(n){return a([o,n])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(e=0)),e)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;s=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(t=e.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){e.label=r[1];break}if(r[0]===6&&e.label<t[1]){e.label=t[1];t=r;break}if(t&&e.label<t[2]){e.label=t[2];e.ops.push(r);break}if(t[2])e.ops.pop();e.trys.pop();continue}r=n.call(o,e)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-7261e245.system.js","./p-b6a36c25.system.js","./p-175c04a4.system.js","./p-3b1b3598.system.js","./p-77c2e465.system.js","./p-3689821f.system.js","./p-398d9022.system.js","./p-01174496.system.js","./p-6f23a26a.system.js","./p-23e7c655.system.js","./p-d938f42f.system.js","./p-c9e433c0.system.js","./p-eb99a625.system.js","./p-e5dfccd8.system.js","./p-1bf9a1b9.system.js","./p-6a195559.system.js"],(function(o){"use strict";var n,e,i,s,t,c,r,a,l,v,z,d,h,u,f,m,p,g,b,w,x,y,k,_,C,I,S,j,O,T,E,L,U,P,N,A,D,B,R;return{setters:[function(o){n=o.r;e=o.h;i=o.a;s=o.F},function(o){t=o.b;c=o.i;r=o.c;a=o.d;l=o.n;v=o.e;z=o.j;d=o.k;h=o.u;u=o.A;f=o.E;m=o.C;p=o.f},function(o){g=o.i;b=o.a;w=o.b;x=o.c},function(o){y=o.p;k=o.a},function(o){_=o.s;C=o.t;I=o.c;S=o.d;j=o.l},function(o){O=o.z},function(o){T=o.b},function(o){E=o.h;L=o.s;U=o.l;P=o.g},function(o){N=o.i;A=o.a},function(o){D=o.c},function(o){B=o.l},function(o){R=o.l},function(){},function(){},function(){},function(){}],execute:function(){var F='<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var V=".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{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-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{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-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var H=V;var K=o("zonos_invoice",function(){function o(o){var e=this;n(this,o);this.storeUnsubscribeList=[];this.onChangeLocaleListener=function(){};this.mobile=false;this.tablet=false;this.stripe=window.Zonos.stripe;this.showLanguageDialogMobile=false;this.submitLoading=false;this.collapseReviewMobile=true;this.isMobile=false;this.isTablet=false;this.isOverlayLoading=true;this.isCartCollected=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.confirmationId=null;this.clientSecret=t.clientSecret;this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret;this.getBaseCurrencySettlementInfo=function(){var o=a.selectedLandedCost;if(!o){return null}var n=o.landedCost.amountSubtotals;if(!n){return null}var e=(n.discounts||0)+n.items+n.landedCostTotal+n.shipping;return{settlementAmount:e}};this.applyStripeTheme=function(){return __awaiter(e,void 0,void 0,(function(){var o;return __generator(this,(function(n){switch(n.label){case 0:o=O.appearance.theme;return[4,c({overrideTheme:this.isMobile?o:undefined,paypalEnabled:y()})];case 1:n.sent();return[2]}}))}))};this.fetchCheckoutSession=function(o){return __awaiter(e,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,E("/api/zonos-elements/collect/get-checkout-session",{body:{checkoutSessionId:o},method:"POST"})];case 1:n=e.sent().json;return[2,n]}}))}))};this.checkStripePaymentIntentStatus=function(){return __awaiter(e,void 0,void 0,(function(){var o,n,e,i,s,c,a,l,v,z;return __generator(this,(function(d){switch(d.label){case 0:n=!!window.Zonos.cartData;e=new URL(window.location.href).searchParams;i=e.get("payment_intent_client_secret");s=e.get("zonosCheckoutSessionId");B("Payment intent exist, checking stripe payment intent status");if(!i){B("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:n}]}return[4,r({clientSecret:i})];case 1:c=d.sent(),a=c.error,l=c.status;v=new URLSearchParams(window.location.search).get("redirect_status");if(!(v&&s))return[3,3];if(!a){B("Payment intent is succeeded or in a good state to move forward, show success screen")}else{B("Payment intent failed, show status from error")}return[4,this.fetchCheckoutSession(s)];case 2:z=d.sent();this.confirmationId=((o=z===null||z===void 0?void 0:z.checkoutSession.landedCost)===null||o===void 0?void 0:o.shortId)||null;_.checkoutSessionId=s;t.clientSecret=i;void this.setToFinishStep(l);return[2,{shouldAllowOrder:false}];case 3:if(!n){B("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}B("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))}}o.prototype.resizeListener=function(){this.isMobile=N(this.mobile);this.isTablet=A(this.tablet)};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){t.stripe=window.Zonos.stripe;a.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,t,c,h,u,f,m,p,w,x,y,k,I,S,j,E,P,N,A;return __generator(this,(function(D){switch(D.label){case 0:if(!window.Zonos.cartData){return[2]}p=(n=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||n===void 0?void 0:n.currencyCode;if(p){a.currency=p}w=(i=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.references)===null||i===void 0?void 0:i.checkoutSessionId;x=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!x){l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")});return[2]}if(w){B("Setting checkout session id from cart reference","info",w);_.checkoutSessionId=w}else{B("Clear checkout session id from storage so we start from a fresh session for the invoice cart");_.checkoutSessionId=null}return[4,this.checkStripePaymentIntentStatus()];case 1:y=D.sent().shouldAllowOrder;if(!y){return[2]}D.label=2;case 2:D.trys.push([2,11,,12]);k=T(window.Zonos.cartData),I=k.adjustments,S=k.cartItems;return[4,v({adjustments:I,cartItems:S,landedCostId:x,shouldInitSessionOnFailure:false})];case 3:D.sent();if(!(!_.checkoutSessionId&&!w))return[3,5];return[4,z()];case 4:j=D.sent();B("stripeStoreInitCheckoutSession: ".concat(j));if(!j){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}D.label=5;case 5:if(!((!a.checkoutSession||((c=a.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&w))return[3,9];return[4,this.fetchCheckoutSession(w)];case 6:E=D.sent();this.confirmationId=((h=E===null||E===void 0?void 0:E.checkoutSession.landedCost)===null||h===void 0?void 0:h.shortId)||null;if(!!(E===null||E===void 0?void 0:E.checkoutSession.completedAt)&&!!E.checkoutSession.order){void this.setToFinishStep("succeeded");return[2]}if(!(E===null||E===void 0?void 0:E.checkoutSession.clientSecret))return[3,8];return[4,r({clientSecret:E.checkoutSession.clientSecret})];case 7:P=D.sent().status;if(P==="processing"||P==="succeeded"){void this.setToFinishStep(P);return[2]}D.label=8;case 8:void L({endpoint:"INVALID_INVOICE_CHECKOUT_SESSION",errors:["Invalid checkout session, can not retrieve the checkout session after failing to update it"],metadata:{cartCheckoutSessionId:w,cartId:(u=window.Zonos.cartData)===null||u===void 0?void 0:u.id,cartLandedCostId:x}});throw new Error("Invalid checkout session, can not retrieve the checkout session after failing to update it");case 9:if(!a.checkoutSession){void L({endpoint:"FAIL_TO_UPDATE_CREATE_INVOICE_CHECKOUT_SESSION",errors:["Could not update/create checkout session for this invoice cart"],metadata:{cartCheckoutSessionId:w||"N/A",cartId:(f=window.Zonos.cartData)===null||f===void 0?void 0:f.id,cartLandedCostId:x||"N/A"}});throw new Error("Could not update/create checkout session for this invoice cart")}void d();N=(m=a.checkoutSession)===null||m===void 0?void 0:m.landedCost;if(!N){throw new Error("Landed cost could not be found in checkout session after creating/updating them")}return[4,g(Object.assign(Object.assign({},a.checkoutSession),{id:_.checkoutSessionId||""}))];case 10:D.sent();void b({landedCostId:N.id});void this.applyStripeTheme();return[3,12];case 11:A=D.sent();U(A);l({messages:[C("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:O.organizationName})],title:C("Invalid session")});return[3,12];case 12:this.isOverlayLoading=false;return[2]}}))}))};o.prototype.toggleLanguageDialog=function(){this.showLanguageDialogMobile=!this.showLanguageDialogMobile};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,s,c,r,l,v;return __generator(this,(function(z){switch(z.label){case 0:void((o=t.stripeBillingAddressElement)===null||o===void 0?void 0:o.getValue());if(!((n=t.stripeLinkEventData)===null||n===void 0?void 0:n.complete)){s=document.querySelector("zonos-link-authentication");s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});return[2]}if(!((e=t.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){c=document.querySelector(".zonos--billing-address");c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});return[2]}r=t.checkoutSettlementCurrency==="USD";if(r&&t.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;k.paypalErrorMessage=null;t.hasPaymentError=false;this.submitLoading=true;a.inventoryCheckErrorMessage=null;return[4,h()];case 1:l=z.sent();if(!l){t.hasPaymentError=true;t.customErrorMessage=C("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:t.checkoutSettlementCurrency});this.submitLoading=false;return[2]}return[4,w()];case 2:z.sent();z.label=3;case 3:z.trys.push([3,5,,6]);return[4,u({noLandedCostCheck:true})];case 4:z.sent();a.step="finish";this.confirmationId=x.landedCostShortId||((i=a.selectedLandedCost)===null||i===void 0?void 0:i.landedCostId)||null;return[2];case 5:v=z.sent();U(v);t.hasPaymentError=true;return[3,6];case 6:this.submitLoading=false;return[2]}}))}))};o.prototype.componentWillLoad=function(){var o=this;t.stripe=window.Zonos.stripe;a.step="payment";void this.initInvoiceCart();this.resizeListener();this.storeUnsubscribeList=[f("clientSecret",(function(){void o.applyStripeTheme()})),I("selectedLocale",(function(){void o.applyStripeTheme()}))];B("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();p();this.onChangeLocaleListener();this.storeUnsubscribeList.forEach((function(o){return o()}))};o.prototype.render=function(){var o=this;this.clientSecret=t.clientSecret;if(t.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=t.stripeCustomerSessionClientSecret}var n=this.getBaseCurrencySettlementInfo();var c=O.appearance,r=c.logoUrl,l=c.theme;var v=function(){var o="".concat(r,"?timestamp=").concat(Date.now());return e("div",{class:"zonos--logo"},o&&e("img",{alt:"".concat(O.organizationName," logo"),src:o}))};var z=P();var d=function(){var n;var i=new URLSearchParams(window.location.search);var t=i.get("zonosQaUrl");var c=i.get("zonosDebug");var r=(n=R.find((function(o){return o.code===j.selectedLocale})))===null||n===void 0?void 0:n.label;return e(s,null,e("zonos-h-stack",{class:"zonos--header-wrapper",spacing:16},e("div",{class:"zonos--logo-wrapper"},v(),z&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),c==="1"&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t)),e("div",{class:"zonos--header-right"},e("zonos-button",{backgroundColor:"gray-0",class:"zonos--header-right-button",onClick:function(){return o.toggleLanguageDialog()},variant:"outline"},r,e("zonos-icon",{"aria-label":"Language select",content:F,iconColor:"gray-1200"})),e("div",{class:D(["zonos--invoice-language-dialog",o.showLanguageDialogMobile&&"zonos--invoice-language-dialog-open"])},e("zonos-language-select",{handleOnClose:function(){return o.toggleLanguageDialog()}})))))};var h=function(){if(o.isOverlayLoading||t.isFetchingSession){return null}return e("div",{class:"zonos--content"},a.step!=="finish"&&a.step!=="error"&&e(s,null,(o.isMobile||o.isTablet)&&d(),e("div",{class:"zonos--left","data-theme":l},!o.isMobile&&!o.isTablet&&d(),e("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},C("Billing info")),e("zonos-v-stack",{spacing:16},e("zonos-link-authentication",{titleText:""}),e("zonos-address",{titleText:"",type:"billing"})),e("zonos-invoice-payment",{class:D(["zonos--invoice-container"]),continueLoading:o.submitLoading,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))}})),e("div",{class:"zonos--right","data-theme":l},!o.isMobile&&e("zonos-invoice-review",{mobile:o.isMobile,tablet:o.isTablet}),e("div",{class:"zonos--order-details-container"},!o.isMobile&&e("zonos-invoice-cart-items",null),o.isMobile&&e("zonos-invoice-order-details",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onCollapseClicked:function(){o.collapseReviewMobile=!o.collapseReviewMobile}})),e("div",{class:"flex--wrapper"},!o.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-invoice-subtotal",null)),!o.isMobile&&!o.isTablet&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet})))),(a.step==="finish"||a.step==="error")&&e("div",{class:"zonos--done","data-theme":l},e("div",{class:"zonos--header"},v()),e("zonos-invoice-finish",{confirmationId:o.confirmationId,overrideNotification:a.step==="error"&&!!a.error?Object.assign(Object.assign({},a.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),(o.isMobile||o.isTablet||a.step==="finish"||a.step==="error")&&e("zonos-invoice-footer",{"data-theme":l,mobile:o.isMobile,tablet:o.isTablet}))};return e(i,{class:D(["zonos--invoice zonos--elements",this.isMobile&&"mobile",this.isTablet&&"tablet"]),"data-theme":l},h(),n&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:S({amount:n.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("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:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),e("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}());K.style=H}}}));
@@ -1 +1 @@
1
- import{r as o,h as e,F as s,a as t,g as r}from"./p-ce75b047.js";import{V as n,W as a,X as i,N as l,Y as d,Z as c,F as m}from"./p-dfe45cfd.js";import{t as z}from"./p-37f47658.js";import{f as p,z as h}from"./p-f3cfd8fa.js";import{r as f}from"./p-69e2a7dd.js";import{g}from"./p-db3b101a.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-d28be518.js";const x='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n',u="full",v="custom",y=class{constructor(e){o(this,e),this.enabled=!0,this.customAmountInput="",this.handleUseStoreCreditChange=o=>{n(o),o&&a(!0),i()},this.handleAmountModeChange=o=>{const e=o===u;a(e),e||(this.customAmountInput=""),i()},this.handleCustomAmountChange=o=>{this.customAmountInput=o,l.error=null},this.handleApplyCustomAmount=()=>{const o=parseFloat(this.customAmountInput);!isNaN(o)&&o>0?d(o):d(null),l.error||i()}}async componentWillLoad(){await c()}render(){if(!this.enabled)return null;const{colorPrimary:o}=h.appearance,r=g({}),n=l.availableBalance,a=null!==n&&n>0,i=l.isEnabled,d=l.useFullBalance,c=l.error,y=m(),b=f({amount:null!=n?n:0,isForeign:!0});return e(t,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":r,"--zonos--font-family":p(),"--zonos--primary-color":o}},e("div",{class:"zonos--store-credit-container"},e("div",{class:"zonos--store-credit-header"},e("div",{class:"zonos--store-credit-title-row"},e("div",{class:"zonos--store-credit-title-left"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},e("zonos-icon",{content:x,iconColor:"gray-500",size:22})),e("zonos-text",{type:"semiBoldLabel"},z("Store credit"))),a&&e("div",{class:"zonos--store-credit-balance-badge"},e("zonos-text",{textColor:"gray-600",type:"caption"},b)))),e(s,null,a?e("div",{class:"zonos--store-credit-content"},e("div",{class:"zonos--store-credit-checkbox"},e("zonos-checkbox",{isChecked:i,label:z("Use store credit"),onCheckboxSelected:o=>this.handleUseStoreCreditChange(o.detail),size:16})),i&&e("div",{class:"zonos--store-credit-options"},e("div",{class:"zonos--store-credit-toggle-row"},e("zonos-toggle",{onToggleChanged:o=>this.handleAmountModeChange(o.detail),options:[{label:z("Apply full balance"),value:u},{label:z("Enter amount"),value:v}],value:d?u:v})),!d&&e("div",{class:"zonos--store-credit-custom-amount"},e("div",{class:"zonos--store-credit-custom-amount-row"},e("zonos-input",{inputLabel:z("Enter amount"),inputValue:this.customAmountInput,isError:!!c,onInputChange:o=>this.handleCustomAmountChange(o.detail)}),e("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},z("Apply")))),c&&e("div",{class:"zonos--store-credit-error"},e("zonos-text",{textColor:"red-600",type:"caption"},c)),e("div",{class:"zonos--store-credit-summary"},e("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},z("Amount to apply: [amount]",{amount:f({amount:y,isForeign:!0})}))))):e("div",{class:"zonos--store-credit-empty"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},e("zonos-icon",{content:x,iconColor:"gray-500",size:28})),e("zonos-text",{textColor:"gray-600",type:"caption"},z("No store credit available"))))))}get el(){return r(this)}};y.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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';export{y as zonos_store_credit}
1
+ import{r as o,h as e,F as s,a as t,g as r}from"./p-ce75b047.js";import{V as n,W as a,X as i,N as l,Y as d,Z as c,F as m}from"./p-6987f9c9.js";import{t as z}from"./p-adb9827c.js";import{f as p,z as h}from"./p-f3cfd8fa.js";import{r as f}from"./p-cfb0059f.js";import{g}from"./p-db3b101a.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-d28be518.js";const x='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true">\n <path fill="currentColor" fill-rule="evenodd" d="M4 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H4Zm16 2H4a1 1 0 0 0-1 1v1h18V8a1 1 0 0 0-1-1ZM2 11h20v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3Zm6 4.5a1 1 0 0 1 1-1h2a1 1 0 0 1 0 2H9a1 1 0 0 1-1-1Z" clip-rule="evenodd"/>\n</svg>\n',u="full",v="custom",y=class{constructor(e){o(this,e),this.enabled=!0,this.customAmountInput="",this.handleUseStoreCreditChange=o=>{n(o),o&&a(!0),i()},this.handleAmountModeChange=o=>{const e=o===u;a(e),e||(this.customAmountInput=""),i()},this.handleCustomAmountChange=o=>{this.customAmountInput=o,l.error=null},this.handleApplyCustomAmount=()=>{const o=parseFloat(this.customAmountInput);!isNaN(o)&&o>0?d(o):d(null),l.error||i()}}async componentWillLoad(){await c()}render(){if(!this.enabled)return null;const{colorPrimary:o}=h.appearance,r=g({}),n=l.availableBalance,a=null!==n&&n>0,i=l.isEnabled,d=l.useFullBalance,c=l.error,y=m(),b=f({amount:null!=n?n:0,isForeign:!0});return e(t,{class:"zonos--elements zonos--store-credit",style:{"--zonos--border-radius":r,"--zonos--font-family":p(),"--zonos--primary-color":o}},e("div",{class:"zonos--store-credit-container"},e("div",{class:"zonos--store-credit-header"},e("div",{class:"zonos--store-credit-title-row"},e("div",{class:"zonos--store-credit-title-left"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-title-icon"},e("zonos-icon",{content:x,iconColor:"gray-500",size:22})),e("zonos-text",{type:"semiBoldLabel"},z("Store credit"))),a&&e("div",{class:"zonos--store-credit-balance-badge"},e("zonos-text",{textColor:"gray-600",type:"caption"},b)))),e(s,null,a?e("div",{class:"zonos--store-credit-content"},e("div",{class:"zonos--store-credit-checkbox"},e("zonos-checkbox",{isChecked:i,label:z("Use store credit"),onCheckboxSelected:o=>this.handleUseStoreCreditChange(o.detail),size:16})),i&&e("div",{class:"zonos--store-credit-options"},e("div",{class:"zonos--store-credit-toggle-row"},e("zonos-toggle",{onToggleChanged:o=>this.handleAmountModeChange(o.detail),options:[{label:z("Apply full balance"),value:u},{label:z("Enter amount"),value:v}],value:d?u:v})),!d&&e("div",{class:"zonos--store-credit-custom-amount"},e("div",{class:"zonos--store-credit-custom-amount-row"},e("zonos-input",{inputLabel:z("Enter amount"),inputValue:this.customAmountInput,isError:!!c,onInputChange:o=>this.handleCustomAmountChange(o.detail)}),e("zonos-button",{onClick:this.handleApplyCustomAmount,size:"sm",variant:"primary"},z("Apply")))),c&&e("div",{class:"zonos--store-credit-error"},e("zonos-text",{textColor:"red-600",type:"caption"},c)),e("div",{class:"zonos--store-credit-summary"},e("zonos-text",{textColor:"gray-800",type:"semiBoldLabel"},z("Amount to apply: [amount]",{amount:f({amount:y,isForeign:!0})}))))):e("div",{class:"zonos--store-credit-empty"},e("div",{"aria-hidden":"true",class:"zonos--store-credit-empty-icon"},e("zonos-icon",{content:x,iconColor:"gray-500",size:28})),e("zonos-text",{textColor:"gray-600",type:"caption"},z("No store credit available"))))))}get el(){return r(this)}};y.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:block;margin-bottom:var(--zonos-elements-font-size-xl)}:host .zonos--store-credit-container{background:-webkit-gradient(linear, left top, left bottom, from(var(--zonos-elements-gray-0)), to(var(--zonos-elements-gray-50)));background:linear-gradient(180deg, var(--zonos-elements-gray-0) 0%, var(--zonos-elements-gray-50) 100%);border:1px solid var(--zonos-elements-gray-200);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-8));-webkit-box-shadow:var(--zonos-elements-v3-shadow-base);box-shadow:var(--zonos-elements-v3-shadow-base);overflow:hidden;padding:0;position:relative}:host .zonos--store-credit-container::before{background:var(--zonos--primary-color, var(--zonos-elements-gray-400));content:"";height:3px;left:0;position:absolute;right:0;top:0}:host .zonos--store-credit-header{padding:var(--zonos-elements-radius-12) var(--zonos-elements-font-size-l) 0}:host .zonos--store-credit-title-row{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .zonos--store-credit-title-left{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-title-icon{-ms-flex-align:center;align-items:center;background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 14%, transparent);border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.75);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;height:22px;-ms-flex-pack:center;justify-content:center;width:22px}:host .zonos--store-credit-balance-badge{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 8%, var(--zonos-elements-gray-50));border:1px solid color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 22%, var(--zonos-elements-gray-200));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:2px var(--zonos-elements-font-size-s)}:host .zonos--store-credit-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-s) var(--zonos-elements-font-size-l) var(--zonos-elements-radius-12)}:host .zonos--store-credit-checkbox{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}:host .zonos--store-credit-options{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-toggle-row{display:-ms-flexbox;display:flex}:host .zonos--store-credit-custom-amount{max-width:240px}:host .zonos--store-credit-custom-amount-row{-ms-flex-align:end;align-items:flex-end;display:-ms-flexbox;display:flex;gap:var(--zonos-elements-font-size-s)}:host .zonos--store-credit-custom-amount-row zonos-input{-ms-flex:1;flex:1}:host .zonos--store-credit-error{margin-top:2px}:host .zonos--store-credit-summary{background:color-mix(in srgb, var(--zonos--primary-color, var(--zonos-elements-gray-400)) 6%, var(--zonos-elements-gray-50));border-radius:calc(var(--zonos--border-radius, var(--zonos-elements-radius-8)) * 0.65);padding:var(--zonos-elements-radius-10) var(--zonos-elements-font-size-s)}:host .zonos--store-credit-empty{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--zonos-elements-font-size-s);padding:var(--zonos-elements-font-size-xl) var(--zonos-elements-font-size-l) 22px;text-align:center}:host .zonos--store-credit-empty-icon{-ms-flex-align:center;align-items:center;background:var(--zonos-elements-gray-100);border-radius:50%;display:-ms-flexbox;display:flex;height:52px;-ms-flex-pack:center;justify-content:center;opacity:0.95;width:52px}';export{y as zonos_store_credit}
@@ -38,4 +38,4 @@
38
38
  180deg,
39
39
  #272a3599 0%,
40
40
  #494c5780 100%
41
- );--zonos-elements-spinner-track-black:rgba(255, 255, 255, 0.3);--zonos-elements-spinner-stroke-black:#ffffff;--zonos-elements-spinner-track-white:rgba(0, 0, 0, 0.3);--zonos-elements-spinner-stroke-white:#0c0c0c}body .zonos--elements{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.z--blur{filter:blur(5px);transition:filter .3s}body.z-intl .z-intl,body.z-intl .z-intl-hide{display:none}
41
+ );--zonos-elements-spinner-track-black:rgba(255, 255, 255, 0.3);--zonos-elements-spinner-stroke-black:#ffffff;--zonos-elements-spinner-track-white:rgba(0, 0, 0, 0.3);--zonos-elements-spinner-stroke-white:#0c0c0c}body .zonos--elements{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.z--blur{filter:blur(5px);transition:filter .3s}body.z-intl .z-intl,body.z-intl .z-intl-hide{display:none}.z--bc-currency-hide{display:none!important}