@zonos/elements 1.3.256 → 1.3.258

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 (271) hide show
  1. package/dist/cjs/{cart-e156c1e3.js → cart-c618fd5b.js} +4 -4
  2. package/dist/cjs/{debounce-0c75ba33.js → debounce-3e17b4e9.js} +1 -1
  3. package/dist/cjs/{getBorderRadius-27a74844.js → getBorderRadius-db55a464.js} +1 -1
  4. package/dist/cjs/{getContrastColor-cc087c53.js → getContrastColor-8ed1cb48.js} +2 -2
  5. package/dist/cjs/{hasInclusivePrice-d6d274bd.js → hasInclusivePrice-58a9f15d.js} +1 -1
  6. package/dist/cjs/index.cjs.js +7 -7
  7. package/dist/cjs/{invoice-f4b5d538.js → invoice-c9cb6683.js} +3 -3
  8. package/dist/cjs/{isCollectMobileTablet-c9369cd8.js → isCollectMobileTablet-93a5194a.js} +3 -3
  9. package/dist/cjs/{isContrastColor-d1936a5c.js → isContrastColor-6a17f408.js} +1 -1
  10. package/dist/cjs/{isDarkColor-a68abf7a.js → isDarkColor-bfe6d1eb.js} +1 -1
  11. package/dist/cjs/{localization-5bb1e598.js → localization-5994d4de.js} +77 -20
  12. package/dist/cjs/{paypal-f9641595.js → paypal-091e089e.js} +5 -5
  13. package/dist/cjs/{placeTestOrder-7ac7f91a.js → placeTestOrder-b07f8edb.js} +2 -2
  14. package/dist/cjs/{renderCheckoutCurrency-6b59a718.js → renderCheckoutCurrency-7876a1d4.js} +2 -2
  15. package/dist/cjs/{submitGtag-cb4fb332.js → submitGtag-9ac5a42e.js} +1 -1
  16. package/dist/cjs/{throttle-ff483793.js → throttle-dac93461.js} +2 -2
  17. package/dist/cjs/{updateCheckoutSessionAttributes-8be63b63.js → updateCheckoutSessionAttributes-a3776bb0.js} +1 -1
  18. package/dist/cjs/zonos-address-display_8.cjs.entry.js +7 -7
  19. package/dist/cjs/zonos-address_4.cjs.entry.js +7 -7
  20. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  22. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  23. package/dist/cjs/zonos-card_5.cjs.entry.js +8 -8
  24. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +14 -14
  25. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +3 -3
  26. package/dist/cjs/zonos-checkout.cjs.entry.js +10 -10
  27. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  28. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +5 -5
  29. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +11 -11
  30. package/dist/cjs/zonos-collect.cjs.entry.js +9 -9
  31. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  32. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  33. package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
  34. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +46 -13
  35. package/dist/cjs/zonos-hello.cjs.entry.js +38 -15
  36. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  37. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +7 -7
  38. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +11 -11
  39. package/dist/cjs/zonos-invoice.cjs.entry.js +9 -9
  40. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  41. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  42. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +5 -5
  43. package/dist/cjs/zonos-store-credit.cjs.entry.js +6 -6
  44. package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
  45. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  46. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  47. package/dist/cjs/{zonosStore-f5a61112.js → zonosStore-1c517e55.js} +0 -1
  48. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +35 -12
  49. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +43 -10
  50. package/dist/collection/components/store/hello/localization.js +76 -19
  51. package/dist/collection/components/store/zonosStore.js +0 -1
  52. package/dist/collection/types/generated/graphql.internal.types.js +446 -0
  53. package/dist/esm/{cart-55b8dd7c.js → cart-76fb528f.js} +4 -4
  54. package/dist/esm/{debounce-efc0e473.js → debounce-8faafc9f.js} +1 -1
  55. package/dist/esm/{getBorderRadius-c21a42e5.js → getBorderRadius-66de1b16.js} +1 -1
  56. package/dist/esm/{getContrastColor-98f0d1d5.js → getContrastColor-e14f95a7.js} +2 -2
  57. package/dist/esm/{hasInclusivePrice-ddae18fd.js → hasInclusivePrice-275b1048.js} +1 -1
  58. package/dist/esm/index.js +7 -7
  59. package/dist/esm/{invoice-dbe85a18.js → invoice-9efcb941.js} +3 -3
  60. package/dist/esm/{isCollectMobileTablet-8af0d16d.js → isCollectMobileTablet-a7e5b909.js} +3 -3
  61. package/dist/esm/{isContrastColor-c17e83c9.js → isContrastColor-f9e65e70.js} +1 -1
  62. package/dist/esm/{isDarkColor-3537021b.js → isDarkColor-8092a9fb.js} +1 -1
  63. package/dist/esm/{localization-d11c973f.js → localization-76ce3e29.js} +77 -20
  64. package/dist/esm/{paypal-f87fbee0.js → paypal-75c5c66d.js} +5 -5
  65. package/dist/esm/{placeTestOrder-8e8e97be.js → placeTestOrder-22633bf2.js} +2 -2
  66. package/dist/esm/{renderCheckoutCurrency-45c74af2.js → renderCheckoutCurrency-d27b0082.js} +2 -2
  67. package/dist/esm/{submitGtag-13de9f1f.js → submitGtag-543058f9.js} +1 -1
  68. package/dist/esm/{throttle-0504ba2c.js → throttle-5a66b4fd.js} +2 -2
  69. package/dist/esm/{updateCheckoutSessionAttributes-b9f7e982.js → updateCheckoutSessionAttributes-8f3f932e.js} +1 -1
  70. package/dist/esm/zonos-address-display_8.entry.js +7 -7
  71. package/dist/esm/zonos-address_4.entry.js +7 -7
  72. package/dist/esm/zonos-badge.entry.js +1 -1
  73. package/dist/esm/zonos-banner.entry.js +1 -1
  74. package/dist/esm/zonos-button_3.entry.js +3 -3
  75. package/dist/esm/zonos-card_5.entry.js +8 -8
  76. package/dist/esm/zonos-cart-items_12.entry.js +14 -14
  77. package/dist/esm/zonos-checkbox_2.entry.js +3 -3
  78. package/dist/esm/zonos-checkout.entry.js +10 -10
  79. package/dist/esm/zonos-collapse.entry.js +1 -1
  80. package/dist/esm/zonos-collect-cart-items_3.entry.js +5 -5
  81. package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
  82. package/dist/esm/zonos-collect.entry.js +9 -9
  83. package/dist/esm/zonos-controller.entry.js +6 -6
  84. package/dist/esm/zonos-country-flag.entry.js +2 -2
  85. package/dist/esm/zonos-country-select_4.entry.js +3 -3
  86. package/dist/esm/zonos-hello-dialog.entry.js +46 -13
  87. package/dist/esm/zonos-hello.entry.js +38 -15
  88. package/dist/esm/zonos-input.entry.js +2 -2
  89. package/dist/esm/zonos-invoice-cart-items_2.entry.js +7 -7
  90. package/dist/esm/zonos-invoice-finish_5.entry.js +11 -11
  91. package/dist/esm/zonos-invoice.entry.js +9 -9
  92. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  93. package/dist/esm/zonos-logo.entry.js +1 -1
  94. package/dist/esm/zonos-shipping-rich-radio.entry.js +5 -5
  95. package/dist/esm/zonos-store-credit.entry.js +6 -6
  96. package/dist/esm/zonos-stripe-input.entry.js +3 -3
  97. package/dist/esm/zonos-text.entry.js +1 -1
  98. package/dist/esm/zonos-v-stack.entry.js +1 -1
  99. package/dist/esm/{zonosStore-5242a58d.js → zonosStore-f1d45eac.js} +0 -1
  100. package/dist/esm-es5/{cart-55b8dd7c.js → cart-76fb528f.js} +1 -1
  101. package/dist/esm-es5/{debounce-efc0e473.js → debounce-8faafc9f.js} +1 -1
  102. package/dist/esm-es5/{getBorderRadius-c21a42e5.js → getBorderRadius-66de1b16.js} +1 -1
  103. package/dist/esm-es5/{getContrastColor-98f0d1d5.js → getContrastColor-e14f95a7.js} +1 -1
  104. package/dist/esm-es5/{hasInclusivePrice-ddae18fd.js → hasInclusivePrice-275b1048.js} +1 -1
  105. package/dist/esm-es5/index.js +1 -1
  106. package/dist/esm-es5/{invoice-dbe85a18.js → invoice-9efcb941.js} +1 -1
  107. package/dist/esm-es5/{isCollectMobileTablet-8af0d16d.js → isCollectMobileTablet-a7e5b909.js} +1 -1
  108. package/dist/esm-es5/{isContrastColor-c17e83c9.js → isContrastColor-f9e65e70.js} +1 -1
  109. package/dist/esm-es5/{isDarkColor-3537021b.js → isDarkColor-8092a9fb.js} +1 -1
  110. package/dist/esm-es5/{localization-d11c973f.js → localization-76ce3e29.js} +1 -1
  111. package/dist/esm-es5/paypal-75c5c66d.js +17 -0
  112. package/dist/esm-es5/{placeTestOrder-8e8e97be.js → placeTestOrder-22633bf2.js} +1 -1
  113. package/dist/esm-es5/{renderCheckoutCurrency-45c74af2.js → renderCheckoutCurrency-d27b0082.js} +1 -1
  114. package/dist/esm-es5/{submitGtag-13de9f1f.js → submitGtag-543058f9.js} +1 -1
  115. package/dist/esm-es5/{throttle-0504ba2c.js → throttle-5a66b4fd.js} +1 -1
  116. package/dist/esm-es5/{updateCheckoutSessionAttributes-b9f7e982.js → updateCheckoutSessionAttributes-8f3f932e.js} +1 -1
  117. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  118. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  119. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  120. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  121. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  122. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  123. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  124. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
  125. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  126. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  127. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  128. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  129. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  130. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  131. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  132. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  133. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  134. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  135. package/dist/esm-es5/zonos-input.entry.js +1 -1
  136. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  137. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  138. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  139. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  140. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  141. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  142. package/dist/esm-es5/zonos-store-credit.entry.js +1 -1
  143. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  144. package/dist/esm-es5/zonos-text.entry.js +1 -1
  145. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  146. package/dist/esm-es5/{zonosStore-5242a58d.js → zonosStore-f1d45eac.js} +1 -1
  147. package/dist/scripts/index.d.ts +88 -8
  148. package/dist/scripts/index.js +1 -1
  149. package/dist/scripts/loadZonos.js +1 -1
  150. package/dist/scripts/zonos.js +1 -1
  151. package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog.d.ts +6 -0
  152. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  153. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +18 -6
  154. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  155. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  156. package/dist/types/types/generated/graphql.internal.types.d.ts +532 -11
  157. package/dist/types/types/generated/graphql.internal.types.ts +600 -11
  158. package/dist/types/types/hello/HelloConfig.d.ts +22 -3
  159. package/dist/zonos-elements/index.esm.js +1 -1
  160. package/dist/zonos-elements/{p-6b45e9f3.system.entry.js → p-055c8d6c.system.entry.js} +1 -1
  161. package/dist/zonos-elements/p-09307a03.js +1 -0
  162. package/dist/zonos-elements/{p-f36e907e.entry.js → p-0a9741f7.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-9b42f0ad.system.entry.js → p-10da499b.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-8d5f928c.system.entry.js → p-1368dce7.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-52b70520.system.entry.js → p-14d35979.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-e2adf04b.system.js → p-1523f6a8.system.js} +1 -1
  167. package/dist/zonos-elements/{p-ac30b7a8.system.js → p-15ef7644.system.js} +1 -1
  168. package/dist/zonos-elements/{p-f9ffff4e.entry.js → p-1661f938.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-ab25379f.system.js → p-17a8a514.system.js} +1 -1
  170. package/dist/zonos-elements/{p-72de2fdc.system.entry.js → p-1e9e284e.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-93c64387.js → p-1ebb59a3.js} +1 -1
  172. package/dist/zonos-elements/{p-3a8925e9.js → p-24f41959.js} +1 -1
  173. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  174. package/dist/zonos-elements/{p-89757efe.entry.js → p-29d16ad0.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-b439d38f.system.entry.js → p-2b2b1c8c.system.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-8a593061.entry.js → p-2d854a75.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-fbd44c55.system.js → p-2ec799e4.system.js} +1 -1
  178. package/dist/zonos-elements/{p-908f13ae.js → p-2f924331.js} +1 -1
  179. package/dist/zonos-elements/{p-4aefd668.entry.js → p-2fa41e93.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-dbb3db89.system.entry.js → p-313b87f3.system.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-c9d4eb42.entry.js → p-3576d900.entry.js} +1 -1
  182. package/dist/zonos-elements/{p-3f141999.system.js → p-3600280d.system.js} +1 -1
  183. package/dist/zonos-elements/{p-4f7d64f6.js → p-387f6a4d.js} +1 -1
  184. package/dist/zonos-elements/p-3ee8496e.js +1 -0
  185. package/dist/zonos-elements/{p-a1c476d6.system.entry.js → p-3ff736f7.system.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-8ccf97ce.entry.js → p-425f747b.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-8c6624b6.system.js → p-43a6e469.system.js} +1 -1
  188. package/dist/zonos-elements/{p-fc1c7fe5.system.entry.js → p-4b138a6e.system.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-ae397ff8.system.entry.js → p-50b32476.system.entry.js} +1 -1
  190. package/dist/zonos-elements/p-5182e492.entry.js +1 -0
  191. package/dist/zonos-elements/{p-dba635e6.entry.js → p-5262f6e8.entry.js} +1 -1
  192. package/dist/zonos-elements/p-53fe581b.system.js +1 -0
  193. package/dist/zonos-elements/{p-70e069d3.system.js → p-567abb43.system.js} +1 -1
  194. package/dist/zonos-elements/{p-f830f800.js → p-5beab541.js} +1 -1
  195. package/dist/zonos-elements/{p-2eeda8a9.system.entry.js → p-5fa3d1c8.system.entry.js} +1 -1
  196. package/dist/zonos-elements/{p-d18a2b2c.system.js → p-61be7d98.system.js} +1 -1
  197. package/dist/zonos-elements/{p-70c8a47d.system.entry.js → p-62dbc5f8.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-2cb5ef7d.system.entry.js → p-6cf8fe49.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-5343c32b.system.js → p-6d36b307.system.js} +1 -1
  200. package/dist/zonos-elements/p-6e50f6f5.entry.js +1 -0
  201. package/dist/zonos-elements/{p-b85d4286.entry.js → p-7157a5a3.entry.js} +1 -1
  202. package/dist/zonos-elements/{p-93d6e13f.entry.js → p-733f118d.entry.js} +1 -1
  203. package/dist/zonos-elements/{p-8f1ab25c.system.entry.js → p-770d414a.system.entry.js} +1 -1
  204. package/dist/zonos-elements/{p-befad3c4.entry.js → p-788c6839.entry.js} +1 -1
  205. package/dist/zonos-elements/{p-50d31f4f.entry.js → p-791e13e7.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-7427dd1e.entry.js → p-7a379538.entry.js} +1 -1
  207. package/dist/zonos-elements/p-7d9bbdc8.js +1 -0
  208. package/dist/zonos-elements/{p-32365d6a.system.entry.js → p-8585c761.system.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-d280e9b6.system.js → p-867d05d7.system.js} +1 -1
  210. package/dist/zonos-elements/p-868a8667.js +1 -0
  211. package/dist/zonos-elements/p-8bce79f4.system.js +1 -0
  212. package/dist/zonos-elements/{p-18d411c3.system.entry.js → p-9161f10d.system.entry.js} +1 -1
  213. package/dist/zonos-elements/p-944bf0e7.js +1 -0
  214. package/dist/zonos-elements/p-9460919d.entry.js +1 -0
  215. package/dist/zonos-elements/{p-d155b9c6.entry.js → p-99d92a84.entry.js} +1 -1
  216. package/dist/zonos-elements/{p-1c9e9692.system.entry.js → p-9a9c9441.system.entry.js} +1 -1
  217. package/dist/zonos-elements/{p-c66649fe.system.entry.js → p-9c97671b.system.entry.js} +1 -1
  218. package/dist/zonos-elements/{p-225957b9.entry.js → p-9cff66a7.entry.js} +1 -1
  219. package/dist/zonos-elements/{p-00728af1.entry.js → p-a0f6910c.entry.js} +1 -1
  220. package/dist/zonos-elements/{p-99e1734a.js → p-a18adf27.js} +1 -1
  221. package/dist/zonos-elements/{p-08830a50.system.entry.js → p-a4b6865d.system.entry.js} +1 -1
  222. package/dist/zonos-elements/{p-5d0b0126.system.entry.js → p-a89096d6.system.entry.js} +1 -1
  223. package/dist/zonos-elements/{p-53275a0d.system.entry.js → p-afca19b0.system.entry.js} +1 -1
  224. package/dist/zonos-elements/{p-aad014df.entry.js → p-afdb4445.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-664aff48.system.entry.js → p-b34f1336.system.entry.js} +1 -1
  226. package/dist/zonos-elements/{p-2aa44601.entry.js → p-bb6e7e9e.entry.js} +1 -1
  227. package/dist/zonos-elements/{p-939ba2a5.entry.js → p-bb785f33.entry.js} +1 -1
  228. package/dist/zonos-elements/{p-7d4a1565.entry.js → p-bba9af4c.entry.js} +1 -1
  229. package/dist/zonos-elements/{p-5f628e57.entry.js → p-bcbbe867.entry.js} +1 -1
  230. package/dist/zonos-elements/{p-3fae811a.js → p-bd938f80.js} +1 -1
  231. package/dist/zonos-elements/{p-f6733ffb.js → p-bdb3f7a2.js} +2 -2
  232. package/dist/zonos-elements/{p-ed61dedd.system.entry.js → p-c7ecef98.system.entry.js} +1 -1
  233. package/dist/zonos-elements/p-c85e988d.system.js +1 -0
  234. package/dist/zonos-elements/{p-ee217693.entry.js → p-c908a7a3.entry.js} +1 -1
  235. package/dist/zonos-elements/p-cd563d65.system.js +1 -0
  236. package/dist/zonos-elements/{p-ddcbea81.entry.js → p-cdbb50cf.entry.js} +1 -1
  237. package/dist/zonos-elements/{p-4e4fa1fb.system.entry.js → p-d004565d.system.entry.js} +1 -1
  238. package/dist/zonos-elements/{p-fe6cc354.entry.js → p-d30e8c3a.entry.js} +1 -1
  239. package/dist/zonos-elements/{p-234f0339.system.entry.js → p-dfb4360d.system.entry.js} +1 -1
  240. package/dist/zonos-elements/{p-3fbd9cc0.system.js → p-e25e0b4b.system.js} +1 -1
  241. package/dist/zonos-elements/{p-0d18d94b.entry.js → p-e55bc187.entry.js} +1 -1
  242. package/dist/zonos-elements/{p-59025df9.system.entry.js → p-e5f48239.system.entry.js} +1 -1
  243. package/dist/zonos-elements/{p-2a28c7ac.system.js → p-e6168c82.system.js} +1 -1
  244. package/dist/zonos-elements/p-e6726a50.system.js +1 -0
  245. package/dist/zonos-elements/{p-b004146f.entry.js → p-e749fb81.entry.js} +1 -1
  246. package/dist/zonos-elements/{p-57b5d3e3.system.js → p-e8a68ce7.system.js} +1 -1
  247. package/dist/zonos-elements/p-ed03b7fd.js +1 -0
  248. package/dist/zonos-elements/{p-058f6124.js → p-ed9385f4.js} +1 -1
  249. package/dist/zonos-elements/{p-8608c123.system.entry.js → p-edb0306c.system.entry.js} +1 -1
  250. package/dist/zonos-elements/p-f68ce554.js +1 -0
  251. package/dist/zonos-elements/{p-67897a0d.js → p-f6922df5.js} +1 -1
  252. package/dist/zonos-elements/{p-f0938b51.system.entry.js → p-f7ddd288.system.entry.js} +1 -1
  253. package/dist/zonos-elements/{p-38881641.system.entry.js → p-fbc274a8.system.entry.js} +1 -1
  254. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  255. package/package.json +1 -1
  256. package/dist/esm-es5/paypal-f87fbee0.js +0 -17
  257. package/dist/zonos-elements/p-179bbeae.js +0 -1
  258. package/dist/zonos-elements/p-34d10122.js +0 -1
  259. package/dist/zonos-elements/p-399f5ad6.entry.js +0 -1
  260. package/dist/zonos-elements/p-53db5f85.system.js +0 -1
  261. package/dist/zonos-elements/p-7501c637.system.js +0 -1
  262. package/dist/zonos-elements/p-7d7ffb42.js +0 -1
  263. package/dist/zonos-elements/p-959918fe.system.js +0 -1
  264. package/dist/zonos-elements/p-9631c373.system.js +0 -1
  265. package/dist/zonos-elements/p-9d44fef6.system.js +0 -1
  266. package/dist/zonos-elements/p-d14e5c81.entry.js +0 -1
  267. package/dist/zonos-elements/p-ddde268d.entry.js +0 -1
  268. package/dist/zonos-elements/p-def2d465.js +0 -1
  269. package/dist/zonos-elements/p-e219d011.js +0 -1
  270. package/dist/zonos-elements/p-ee2c7a1e.js +0 -1
  271. package/dist/zonos-elements/p-fa0c5017.js +0 -1
@@ -1 +1 @@
1
- var __extends=this&&this.__extends||function(){var t=function(n,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)if(Object.prototype.hasOwnProperty.call(n,e))t[e]=n[e]};return t(n,e)};return function(n,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(n,e);function i(){this.constructor=n}n.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function u(t){try{c(i.next(t))}catch(t){r(t)}}function s(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(u,s)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(t){return function(n){return c([t,n])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(e=0)),e)try{if(i=1,o&&(r=s[0]&2?o["return"]:s[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;if(o=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;o=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label<r[1]){e.label=r[1];r=s;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(s);break}if(r[2])e.ops.pop();e.trys.pop();continue}s=n.call(t,e)}catch(t){s=[6,t];o=0}finally{i=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var i=0,o=n.length,r;i<o;i++){if(r||!(i in n)){if(!r)r=Array.prototype.slice.call(n,0,i);r[i]=n[i]}}return t.concat(r||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-fbd44c55.system.js","./p-e2adf04b.system.js","./p-ac30b7a8.system.js","./p-4160bbc2.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-ab25379f.system.js","./p-d18a2b2c.system.js","./p-7501c637.system.js"],(function(t){"use strict";var n,e,i,o,r,u,s,c,a,f,d,l,h,v,w,m,p,g,_,y;return{setters:[function(t){n=t.r;e=t.d;i=t.h;o=t.a},function(t){r=t.b},function(t){u=t.e;s=t.i;c=t.h;a=t.s;f=t.a},function(t){d=t.z;l=t.e;h=t.f},function(t){v=t.g;w=t.i;m=t.a},function(t){p=t.h;g=t.l},function(t){_=t.l},function(t){y=t.e},function(){},function(){}],execute:function(){var b=this;var S=function(){return __awaiter(b,void 0,void 0,(function(){var t,n,e,i,o,r,s;return __generator(this,(function(c){switch(c.label){case 0:if(window.Zonos.cartSettings){_("Reusing cached zonos settings");return[2,{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode}]}t=v();n=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){n.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}e=u();if(e){n.set("zCountry",e)}return[4,p("/api/zonos-elements/zonos-settings?".concat(n.toString()))];case 1:i=c.sent(),o=i.errors,r=i.json,s=i.zonosMode;if(o.length){g("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:o,json:null,zonosMode:s}]}return[2,{errors:[],json:r,zonosMode:s}]}}))}))};var z=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var j=function(t){if(!t.placeOrderButtonSelector&&!t.alwaysTriggerInternationalCheckoutSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!s(t.placeOrderButtonSelector)){g('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}if(t.alwaysTriggerInternationalCheckoutSelector&&!s(t.alwaysTriggerInternationalCheckoutSelector)){g('Selector alwaysTriggerInternationalCheckoutSelector "'.concat(t.alwaysTriggerInternationalCheckoutSelector,'" is not a valid selector'));return}z()};var O=function(){var t=document.querySelector("zonos-collect");if(!t){var n=document.createElement("zonos-collect");document.body.appendChild(n)}};var I=function(){if(!window.Zonos.cartData){return}O()};var k=function(){var t=document.querySelector("zonos-invoice");if(!t){var n=document.createElement("zonos-invoice");document.body.appendChild(n)}};var A=function(){if(!window.Zonos.cartData){return}k()};var C=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var T=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var E=function(t){var n=t.position,e=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var o=document.querySelector(i);if(o){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(e==="top-right"){r.style.top="72px";r.style.right="24px"}if(e==="top-left"){r.style.top="72px";r.style.left="24px"}if(e==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(e==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483647";document.body.appendChild(r);return i};var P=function(t){return __awaiter(b,void 0,void 0,(function(){var n,e,i,o,r;return __generator(this,(function(u){if(window.Zonos.isLegacyCheckout){_("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;e=n;if(!t.anchorElementSelector&&t.desktopLocation){i=E({position:"bottom-right"});e=i}if(!e||!s(e)){g('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}_("Hello init complete");o=C(e);if(!o){r=new MutationObserver((function(){var t=C(e);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){C(e)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){_("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=E({position:T(t.notFoundElementFallback)});C(n)}}),3e3)}return[2]}))}))};var x=function(){function t(t,n){var e=this;this.targetId=t;this.allowedEvents=n;this.listeners=new Map;this.handleMessage=function(t){var n,i,o;var r=t.data;var u=((n=e.iframe)===null||n===void 0?void 0:n.contentWindow)||((o=(i=e.iframe)===null||i===void 0?void 0:i.contentDocument)===null||o===void 0?void 0:o.defaultView);if(t.source!==u){return}if(!e.isValidMessage(r)){return}var s=e.listeners.get(r.type);s===null||s===void 0?void 0:s.forEach((function(t){try{t(r.payload)}catch(t){g("Error in event listener:",t)}}))};this.initializeEventListeners();this.iframe=document.getElementById(this.targetId)}t.prototype.initializeEventListeners=function(){window.addEventListener("message",this.handleMessage)};t.prototype.isValidMessage=function(t){if(!t||typeof t!=="object")return false;var n=t;return n.id===this.targetId&&typeof n.type==="string"&&this.allowedEvents.includes(n.type)&&n.payload!==undefined};t.prototype.on=function(t,n){var e=this;if(!this.listeners.has(t)){this.listeners.set(t,new Set)}_("[CheckoutAddressService] listening to ".concat(t),"info");var i=n;var o=this.listeners.get(t);if(o){o.add(i)}return function(){var n=e.listeners.get(t);if(n){n.delete(i)}}};t.prototype.destroy=function(){window.removeEventListener("message",this.handleMessage);this.listeners.clear()};return t}();var L=function(t){__extends(n,t);function n(){_("=== [Google Places Service] Initializing","info");return t.call(this,w.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])||this}n.prototype.sendMessage=function(t,n){var e;if(!((e=this.iframe)===null||e===void 0?void 0:e.contentWindow)){return}var i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:n,type:t};_("GooglePlacesService] parent --\x3e ".concat(t),"info",n);this.iframe.contentWindow.postMessage(i,"*")};n.prototype.initialize=function(){this.sendMessage("initializeGooglePlacesService",{})};n.prototype.fetchSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!n){return}this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[n],input:e},type:i})};n.prototype.selectPlace=function(t){var n=t.placeId,e=t.type;this.sendMessage("placeSelected",{placeId:n,type:e})};return n}(x);var F=function(){function t(){var t=this;this.googlePlaceInitialized=false;_("=== [CheckoutAddressService] Initializing","info");this.googlePlaces=new L;this.googlePlaces.on("onInitializeGooglePlacesService",(function(){_("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info");t.googlePlaceInitialized=true}));this.initialize()}t.prototype.initialize=function(){this.googlePlaces.initialize()};t.prototype.onInitializeGooglePlacesService=function(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(function(){_("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService");t()}))};t.prototype.isGooglePlaceInitialized=function(){return this.googlePlaceInitialized};t.prototype.onAddressSuggestions=function(t){this.suggestionsCallback=t;return this.googlePlaces.on("onFetchAutocompleteSuggestions",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}_.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.onAddressSelected=function(t){this.placeSelectedCallback=t;return this.googlePlaces.on("onPlaceSelected",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}_.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onPlaceSelected ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.getAddressSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!this.googlePlaceInitialized){return}this.googlePlaces.fetchSuggestions({country:n,query:e,type:i})};t.prototype.selectAddress=function(t){var n=t.placeId,e=t.type;this.googlePlaces.selectPlace({placeId:n,type:e})};t.prototype.destroy=function(){this.googlePlaces.destroy();if(this.suggestionsCallback){this.suggestionsCallback=undefined}if(this.placeSelectedCallback){this.placeSelectedCallback=undefined}};return t}();var G=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var B=G;var M=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=e(this,"paypalInitEvent",7);this.stripeInitEvent=e(this,"stripeInitEvent",7)}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}r.stripe=t;void j(d.checkoutSettings);_("init checkout element");return[2]}))}))};t.prototype.initCollectElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init Collect element","warn");return[2]}r.stripe=t;void I();_("init Collect element");return[2]}))}))};t.prototype.initInvoiceElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init Invoice element","warn");return[2]}r.stripe=t;void A();_("init Invoice element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,i,o,r,u,s,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||h();if(i==="Inter"){if(!t){return[2]}_("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}o=new URLSearchParams;o.set("family",i);return[4,p("/api/zonos-elements/get-font-detail?".concat(o.toString()))];case 1:r=a.sent(),u=r.errors,s=r.json;if(u.length>0){_("Failed to load font ".concat(i),"warn");d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:"Inter"});return[2]}c=s===null||s===void 0?void 0:s.fontUrl;if(c){(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,c)}if(!t){return[2]}_("[FONT] ".concat(t," font override applied"));d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void P(d.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect||window.Zonos.isInvoice){_("=== Skip injecting custom HTML for hosted checkout","info");return}_("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var e=n.content.querySelectorAll("script");e.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}));y()};t.prototype.initGooglePlacesService=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;return __generator(this,(function(i){n=t===null||t===void 0?void 0:t.genericSettings;if(!n){return[2]}e=n.signedTokenGooglePlaces;if(!e){return[2]}m({id:w.GOOGLE_PLACES,onload:function(){d.checkoutAddressService=new F},src:"".concat("https://route.elements.zonos.com","/iframe/google-maps?signedToken=").concat(e)});return[2]}))}))};t.prototype.buildBaseConfig=function(t){var n,e;var i=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined});if(window.Zonos.isCollect||window.Zonos.isInvoice){return Object.assign(Object.assign({},this.config),{checkoutSettings:i,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})})}if(!this.config.checkoutSettings){return Object.assign(Object.assign({},this.config),{checkoutSettings:undefined})}var o=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((n=this.config.checkoutSettings)===null||n===void 0?void 0:n.successBehavior)==="CLOSE_MODAL";return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},i),{successBehavior:o?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:o?((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||(t===null||t===void 0?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();d.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,i,o,r,u,s,a,f,h,v,w;var m=this;return __generator(this,(function(p){switch(p.label){case 0:return[4,S()];case 1:o=p.sent(),r=o.errors,u=o.json,s=o.zonosMode;if(((n=(t=r[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){_("Failed to load zonos settings. This domain may not have access","warn");return[2]}a=((e=u===null||u===void 0?void 0:u.checkoutSettings)===null||e===void 0?void 0:e.customHTML)||"";this.injectCustomHTML(a);this.initZonosNotification();f=function(){var t,n,e;if(window.Zonos.isLegacyCheckout){return((t=u===null||u===void 0?void 0:u.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=m.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(e=m.config.appearance)===null||e===void 0?void 0:e.logoUrl};h=this.buildBaseConfig(u);v=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:f()})}),h);l({overrideSettings:v,zonosSettings:u});d.zonosMode=s;void this.setupGoogleFont();if(d.helloSettings.visibilityStatus==="DISABLED"){_("=== Hello is disabled by store owner ===","warn")}if(d.helloSettings&&d.helloSettings.visibilityStatus==="ENABLED"){_("Initializing hello");void P(d.helloSettings)}return[4,c()];case 2:p.sent();w=((i=u===null||u===void 0?void 0:u.checkoutSettings)===null||i===void 0?void 0:i.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!w||!this.stripeInitEvent){_("Checkout failed to load -- missing publishable key","warn");return[2]}if(window.Zonos.isCollect||window.Zonos.isInvoice){this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(u);return[2]}if(d.checkoutSettings.subscriptionStatus==="INACTIVE"){_('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");_("zonos controller loaded");return[2]}if(d.checkoutSettings.visibilityStatus==="DISABLED"){_("=== Checkout is disabled by store owner ===","warn");_("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(u);return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){_("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){a.checkoutSessionId=null;r.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){l({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){_("Override country code to ".concat(t));void f({isInitializing:false,newSelectedCountryCode:t});return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,d.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(o,{key:"92e1eae13d0b13f91098ea110203b6c7a7f67c3e",class:"zonos--elements"})};return t}());M.style=B}}}));
1
+ var __extends=this&&this.__extends||function(){var t=function(n,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)if(Object.prototype.hasOwnProperty.call(n,e))t[e]=n[e]};return t(n,e)};return function(n,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(n,e);function i(){this.constructor=n}n.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();var __awaiter=this&&this.__awaiter||function(t,n,e,i){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,r){function u(t){try{c(i.next(t))}catch(t){r(t)}}function s(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?e(t.value):o(t.value).then(u,s)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(t){return function(n){return c([t,n])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(e=0)),e)try{if(i=1,o&&(r=s[0]&2?o["return"]:s[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;if(o=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;o=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label<r[1]){e.label=r[1];r=s;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(s);break}if(r[2])e.ops.pop();e.trys.pop();continue}s=n.call(t,e)}catch(t){s=[6,t];o=0}finally{i=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,n,e){if(e||arguments.length===2)for(var i=0,o=n.length,r;i<o;i++){if(r||!(i in n)){if(!r)r=Array.prototype.slice.call(n,0,i);r[i]=n[i]}}return t.concat(r||Array.prototype.slice.call(n))};System.register(["./p-7261e245.system.js","./p-2ec799e4.system.js","./p-1523f6a8.system.js","./p-15ef7644.system.js","./p-4160bbc2.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-17a8a514.system.js","./p-61be7d98.system.js","./p-8bce79f4.system.js"],(function(t){"use strict";var n,e,i,o,r,u,s,c,a,f,d,l,h,v,w,m,p,g,_,y;return{setters:[function(t){n=t.r;e=t.d;i=t.h;o=t.a},function(t){r=t.b},function(t){u=t.e;s=t.i;c=t.h;a=t.s;f=t.a},function(t){d=t.z;l=t.e;h=t.f},function(t){v=t.g;w=t.i;m=t.a},function(t){p=t.h;g=t.l},function(t){_=t.l},function(t){y=t.e},function(){},function(){}],execute:function(){var b=this;var S=function(){return __awaiter(b,void 0,void 0,(function(){var t,n,e,i,o,r,s;return __generator(this,(function(c){switch(c.label){case 0:if(window.Zonos.cartSettings){_("Reusing cached zonos settings");return[2,{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode}]}t=v();n=new URLSearchParams;if(t.overrideShouldEnabledCustomAddress){n.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress)}e=u();if(e){n.set("zCountry",e)}return[4,p("/api/zonos-elements/zonos-settings?".concat(n.toString()))];case 1:i=c.sent(),o=i.errors,r=i.json,s=i.zonosMode;if(o.length){g("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:o,json:null,zonosMode:s}]}return[2,{errors:[],json:r,zonosMode:s}]}}))}))};var z=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var j=function(t){if(!t.placeOrderButtonSelector&&!t.alwaysTriggerInternationalCheckoutSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!s(t.placeOrderButtonSelector)){g('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}if(t.alwaysTriggerInternationalCheckoutSelector&&!s(t.alwaysTriggerInternationalCheckoutSelector)){g('Selector alwaysTriggerInternationalCheckoutSelector "'.concat(t.alwaysTriggerInternationalCheckoutSelector,'" is not a valid selector'));return}z()};var O=function(){var t=document.querySelector("zonos-collect");if(!t){var n=document.createElement("zonos-collect");document.body.appendChild(n)}};var I=function(){if(!window.Zonos.cartData){return}O()};var k=function(){var t=document.querySelector("zonos-invoice");if(!t){var n=document.createElement("zonos-invoice");document.body.appendChild(n)}};var A=function(){if(!window.Zonos.cartData){return}k()};var C=function(t){var n=document.querySelector(t);var e=document.querySelector("zonos-hello");if(!e&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var T=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var E=function(t){var n=t.position,e=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var o=document.querySelector(i);if(o){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(e==="top-right"){r.style.top="72px";r.style.right="24px"}if(e==="top-left"){r.style.top="72px";r.style.left="24px"}if(e==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(e==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483647";document.body.appendChild(r);return i};var P=function(t){return __awaiter(b,void 0,void 0,(function(){var n,e,i,o,r;return __generator(this,(function(u){if(window.Zonos.isLegacyCheckout){_("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;e=n;if(!t.anchorElementSelector&&t.desktopLocation){i=E({position:"bottom-right"});e=i}if(!e||!s(e)){g('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}_("Hello init complete");o=C(e);if(!o){r=new MutationObserver((function(){var t=C(e);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){C(e)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){_("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=E({position:T(t.notFoundElementFallback)});C(n)}}),3e3)}return[2]}))}))};var x=function(){function t(t,n){var e=this;this.targetId=t;this.allowedEvents=n;this.listeners=new Map;this.handleMessage=function(t){var n,i,o;var r=t.data;var u=((n=e.iframe)===null||n===void 0?void 0:n.contentWindow)||((o=(i=e.iframe)===null||i===void 0?void 0:i.contentDocument)===null||o===void 0?void 0:o.defaultView);if(t.source!==u){return}if(!e.isValidMessage(r)){return}var s=e.listeners.get(r.type);s===null||s===void 0?void 0:s.forEach((function(t){try{t(r.payload)}catch(t){g("Error in event listener:",t)}}))};this.initializeEventListeners();this.iframe=document.getElementById(this.targetId)}t.prototype.initializeEventListeners=function(){window.addEventListener("message",this.handleMessage)};t.prototype.isValidMessage=function(t){if(!t||typeof t!=="object")return false;var n=t;return n.id===this.targetId&&typeof n.type==="string"&&this.allowedEvents.includes(n.type)&&n.payload!==undefined};t.prototype.on=function(t,n){var e=this;if(!this.listeners.has(t)){this.listeners.set(t,new Set)}_("[CheckoutAddressService] listening to ".concat(t),"info");var i=n;var o=this.listeners.get(t);if(o){o.add(i)}return function(){var n=e.listeners.get(t);if(n){n.delete(i)}}};t.prototype.destroy=function(){window.removeEventListener("message",this.handleMessage);this.listeners.clear()};return t}();var L=function(t){__extends(n,t);function n(){_("=== [Google Places Service] Initializing","info");return t.call(this,w.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])||this}n.prototype.sendMessage=function(t,n){var e;if(!((e=this.iframe)===null||e===void 0?void 0:e.contentWindow)){return}var i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:n,type:t};_("GooglePlacesService] parent --\x3e ".concat(t),"info",n);this.iframe.contentWindow.postMessage(i,"*")};n.prototype.initialize=function(){this.sendMessage("initializeGooglePlacesService",{})};n.prototype.fetchSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!n){return}this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[n],input:e},type:i})};n.prototype.selectPlace=function(t){var n=t.placeId,e=t.type;this.sendMessage("placeSelected",{placeId:n,type:e})};return n}(x);var F=function(){function t(){var t=this;this.googlePlaceInitialized=false;_("=== [CheckoutAddressService] Initializing","info");this.googlePlaces=new L;this.googlePlaces.on("onInitializeGooglePlacesService",(function(){_("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info");t.googlePlaceInitialized=true}));this.initialize()}t.prototype.initialize=function(){this.googlePlaces.initialize()};t.prototype.onInitializeGooglePlacesService=function(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(function(){_("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService");t()}))};t.prototype.isGooglePlaceInitialized=function(){return this.googlePlaceInitialized};t.prototype.onAddressSuggestions=function(t){this.suggestionsCallback=t;return this.googlePlaces.on("onFetchAutocompleteSuggestions",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}_.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.onAddressSelected=function(t){this.placeSelectedCallback=t;return this.googlePlaces.on("onPlaceSelected",(function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}_.apply(void 0,__spreadArray(["[CheckoutAddressService] parent <-- onPlaceSelected ".concat(n[0].type),"info"],n,false));t.apply(void 0,n)}))};t.prototype.getAddressSuggestions=function(t){var n=t.country,e=t.query,i=t.type;if(!this.googlePlaceInitialized){return}this.googlePlaces.fetchSuggestions({country:n,query:e,type:i})};t.prototype.selectAddress=function(t){var n=t.placeId,e=t.type;this.googlePlaces.selectPlace({placeId:n,type:e})};t.prototype.destroy=function(){this.googlePlaces.destroy();if(this.suggestionsCallback){this.suggestionsCallback=undefined}if(this.placeSelectedCallback){this.placeSelectedCallback=undefined}};return t}();var G=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var B=G;var M=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=e(this,"paypalInitEvent",7);this.stripeInitEvent=e(this,"stripeInitEvent",7)}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}r.stripe=t;void j(d.checkoutSettings);_("init checkout element");return[2]}))}))};t.prototype.initCollectElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init Collect element","warn");return[2]}r.stripe=t;void I();_("init Collect element");return[2]}))}))};t.prototype.initInvoiceElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){_("Stripe is not loaded yet - cannot init Invoice element","warn");return[2]}r.stripe=t;void A();_("init Invoice element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e,i,o,r,u,s,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||h();if(i==="Inter"){if(!t){return[2]}_("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t})}o=new URLSearchParams;o.set("family",i);return[4,p("/api/zonos-elements/get-font-detail?".concat(o.toString()))];case 1:r=a.sent(),u=r.errors,s=r.json;if(u.length>0){_("Failed to load font ".concat(i),"warn");d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:"Inter"});return[2]}c=s===null||s===void 0?void 0:s.fontUrl;if(c){(e=(n=window.Zonos).injectSupportGoogleFont)===null||e===void 0?void 0:e.call(n,c)}if(!t){return[2]}_("[FONT] ".concat(t," font override applied"));d.appearance=Object.assign(Object.assign({},d.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void P(d.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout||window.Zonos.isCollect||window.Zonos.isInvoice){_("=== Skip injecting custom HTML for hosted checkout","info");return}_("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var e=n.content.querySelectorAll("script");e.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}));y()};t.prototype.initGooglePlacesService=function(t){return __awaiter(this,void 0,void 0,(function(){var n,e;return __generator(this,(function(i){n=t===null||t===void 0?void 0:t.genericSettings;if(!n){return[2]}e=n.signedTokenGooglePlaces;if(!e){return[2]}m({id:w.GOOGLE_PLACES,onload:function(){d.checkoutAddressService=new F},src:"".concat("https://route.elements.zonos.com","/iframe/google-maps?signedToken=").concat(e)});return[2]}))}))};t.prototype.buildBaseConfig=function(t){var n,e;var i=Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined});if(window.Zonos.isCollect||window.Zonos.isInvoice){return Object.assign(Object.assign({},this.config),{checkoutSettings:i,helloSettings:Object.assign(Object.assign({},this.config.helloSettings),{visibilityStatus:"DISABLED"})})}if(!this.config.checkoutSettings){return Object.assign(Object.assign({},this.config),{checkoutSettings:undefined})}var o=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((n=this.config.checkoutSettings)===null||n===void 0?void 0:n.successBehavior)==="CLOSE_MODAL";return Object.assign(Object.assign({},this.config),{checkoutSettings:Object.assign(Object.assign({},i),{successBehavior:o?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:o?((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||(t===null||t===void 0?void 0:t.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl})})};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();d.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,e,i,o,r,u,s,a,f,h,v,w;var m=this;return __generator(this,(function(p){switch(p.label){case 0:return[4,S()];case 1:o=p.sent(),r=o.errors,u=o.json,s=o.zonosMode;if(((n=(t=r[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){_("Failed to load zonos settings. This domain may not have access","warn");return[2]}a=((e=u===null||u===void 0?void 0:u.checkoutSettings)===null||e===void 0?void 0:e.customHTML)||"";this.injectCustomHTML(a);this.initZonosNotification();f=function(){var t,n,e;if(window.Zonos.isLegacyCheckout){return((t=u===null||u===void 0?void 0:u.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=m.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(e=m.config.appearance)===null||e===void 0?void 0:e.logoUrl};h=this.buildBaseConfig(u);v=Object.assign(Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:f()})}),h);l({overrideSettings:v,zonosSettings:u});d.zonosMode=s;void this.setupGoogleFont();if(d.helloSettings.visibilityStatus==="DISABLED"){_("=== Hello is disabled by store owner ===","warn")}if(d.helloSettings&&d.helloSettings.visibilityStatus==="ENABLED"){_("Initializing hello");void P(d.helloSettings)}return[4,c()];case 2:p.sent();w=((i=u===null||u===void 0?void 0:u.checkoutSettings)===null||i===void 0?void 0:i.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!w||!this.stripeInitEvent){_("Checkout failed to load -- missing publishable key","warn");return[2]}if(window.Zonos.isCollect||window.Zonos.isInvoice){this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(u);return[2]}if(d.checkoutSettings.subscriptionStatus==="INACTIVE"){_('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");_("zonos controller loaded");return[2]}if(d.checkoutSettings.visibilityStatus==="DISABLED"){_("=== Checkout is disabled by store owner ===","warn");_("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:w.token});void this.initGooglePlacesService(u);return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){n=document.querySelector("zonos-notification");if(!n){_("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){a.checkoutSessionId=null;r.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){l({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){_("Override country code to ".concat(t));void f({isInitializing:false,newSelectedCountryCode:t});return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,d.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(o,{key:"92e1eae13d0b13f91098ea110203b6c7a7f67c3e",class:"zonos--elements"})};return t}());M.style=B}}}));
@@ -1 +1 @@
1
- import{r as o,h as e,a as s}from"./p-ce75b047.js";import{f as n}from"./p-058f6124.js";import{c as r}from"./p-b4b7f705.js";import"./p-0a377722.js";const t=class{constructor(e){o(this,e),this.bold=!1,this.badgeColor="gray",this.iconRight=!1,this.size="default",this.rounded=!1,this.loading=!1}render(){return e(s,{key:"2c6d37db80b369e4d287e2d7a6cb4db9b69fe6f6",class:r(["zonos--elements zonos--badge"]),style:{"--zonos--font-family":n()}},e("div",{key:"f5f2f2530c11d8c46349024f044a7b042a12a10f",class:r(["zonos--badge-content",this.badgeColor,this.rounded&&"rounded",this.iconRight&&"icon-right",this.size,this.bold&&"bold"])},this.icon,e("zonos-text",{key:"e031a216dc586d138b0d3c03781b8b362bcc25d2",textColor:`${this.badgeColor}-800`},e("slot",{key:"9757275ea8350ae8578e255bb99940697021258e"})),this.dismissHandler&&e("zonos-icon",{key:"42a08f166b237af5c7c508c257dda46ee5c3d58a","aria-label":"Remove action",class:"zonos--badge-dismiss",content:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8282 5.17184C11.0235 5.3671 11.0235 5.68368 10.8282 5.87894L8.70688 8.00026L10.8282 10.1216C11.0235 10.3168 11.0235 10.6334 10.8282 10.8287C10.6329 11.024 10.3164 11.024 10.1211 10.8287L7.99978 8.70737L5.87846 10.8287C5.68319 11.024 5.36661 11.024 5.17135 10.8287C4.97609 10.6334 4.97609 10.3168 5.17135 10.1216L7.29267 8.00026L5.17135 5.87894C4.97609 5.68368 4.97609 5.3671 5.17135 5.17184C5.36661 4.97658 5.68319 4.97658 5.87846 5.17184L7.99978 7.29316L10.1211 5.17184C10.3164 4.97658 10.6329 4.97658 10.8282 5.17184Z" fill="var(--zonos-elements-gray-800)"/>\n</svg>\n',onClick:()=>{var o;return null===(o=this.dismissHandler)||void 0===o?void 0:o.call(this)}})))}};t.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800);border:1px solid var(--zonos-elements-orange-200)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}:host .transparent{background-color:transparent;border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800)}:host .transparent.bold{background-color:var(--zonos-elements-glass-600);color:var(--zonos-elements-gray-100)}:host .zonos--badge-dismiss{cursor:pointer}";export{t as zonos_badge}
1
+ import{r as o,h as e,a as s}from"./p-ce75b047.js";import{f as n}from"./p-ed9385f4.js";import{c as r}from"./p-b4b7f705.js";import"./p-0a377722.js";const t=class{constructor(e){o(this,e),this.bold=!1,this.badgeColor="gray",this.iconRight=!1,this.size="default",this.rounded=!1,this.loading=!1}render(){return e(s,{key:"2c6d37db80b369e4d287e2d7a6cb4db9b69fe6f6",class:r(["zonos--elements zonos--badge"]),style:{"--zonos--font-family":n()}},e("div",{key:"f5f2f2530c11d8c46349024f044a7b042a12a10f",class:r(["zonos--badge-content",this.badgeColor,this.rounded&&"rounded",this.iconRight&&"icon-right",this.size,this.bold&&"bold"])},this.icon,e("zonos-text",{key:"e031a216dc586d138b0d3c03781b8b362bcc25d2",textColor:`${this.badgeColor}-800`},e("slot",{key:"9757275ea8350ae8578e255bb99940697021258e"})),this.dismissHandler&&e("zonos-icon",{key:"42a08f166b237af5c7c508c257dda46ee5c3d58a","aria-label":"Remove action",class:"zonos--badge-dismiss",content:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8282 5.17184C11.0235 5.3671 11.0235 5.68368 10.8282 5.87894L8.70688 8.00026L10.8282 10.1216C11.0235 10.3168 11.0235 10.6334 10.8282 10.8287C10.6329 11.024 10.3164 11.024 10.1211 10.8287L7.99978 8.70737L5.87846 10.8287C5.68319 11.024 5.36661 11.024 5.17135 10.8287C4.97609 10.6334 4.97609 10.3168 5.17135 10.1216L7.29267 8.00026L5.17135 5.87894C4.97609 5.68368 4.97609 5.3671 5.17135 5.17184C5.36661 4.97658 5.68319 4.97658 5.87846 5.17184L7.99978 7.29316L10.1211 5.17184C10.3164 4.97658 10.6329 4.97658 10.8282 5.17184Z" fill="var(--zonos-elements-gray-800)"/>\n</svg>\n',onClick:()=>{var o;return null===(o=this.dismissHandler)||void 0===o?void 0:o.call(this)}})))}};t.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800);border:1px solid var(--zonos-elements-orange-200)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}:host .transparent{background-color:transparent;border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800)}:host .transparent.bold{background-color:var(--zonos-elements-glass-600);color:var(--zonos-elements-gray-100)}:host .zonos--badge-dismiss{cursor:pointer}";export{t as zonos_badge}
@@ -1 +1 @@
1
- import{r as o,d as s,h as t,a as n,g as i}from"./p-ce75b047.js";import{z as e,f as p}from"./p-058f6124.js";import{i as r,a}from"./p-eef5b0cc.js";import{c as l}from"./p-b4b7f705.js";import{g as c}from"./p-f830f800.js";import{i as z}from"./p-67897a0d.js";import"./p-0a377722.js";let u=0;const d=class{constructor(t){o(this,t),this.inputChange=s(this,"inputChange",7),this.inheritedAttributes={},this.inputId="zonos--input-"+ ++u,this.inputValue="",this.isDisabled=!1,this.isError=!1,this.error="",this.inputPlaceholder="",this.value="",this.required=!1,this.internalValue=this.inputValue}onInputValueChange(o){this.internalValue=o,this.inputChange.emit(o),this.value=o}onValueChange(o){this.internalValue=o}componentWillLoad(){this.inheritedAttributes=Object.assign(Object.assign({},r(this.el)),a(this.el,["tabindex","title","data-form-type","dir"]))}render(){const o=this.overridePrimaryColor||e.appearance.colorPrimary,s=this.overrideSecondaryColor||e.appearance.colorSecondary,i=window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===e.appearance.theme:o&&z(o),r=e.appearance.fontSizeInputValue||16;return t(n,{key:"c97d6030d8c9c3ca051a9eb0dce85676245abeeb",class:l(["zonos--input zonos--elements",i&&"dark",(this.isError||!!this.error)&&"has-error"]),"data-theme":i?"DARK":"LIGHT",style:{"--zonos--border-radius":c(),"--zonos--font-family":p(),"--zonos--font-size":`${r}px`,"--zonos--primary-color":s}},t("div",{key:"2517b55aa12ed4dd4772be3dbd48edf28e393697",class:l(["zonos--label-wrapper",this.isDisabled&&"disabled"])},t("input",Object.assign({key:"7853f3eafc7a926f88b21abfa8f59995b5c35cf3"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:l(["zonos--floated-input",!!this.inputLabel&&"has-label",this.internalValue&&"has-content",(this.isError||!!this.error)&&"has-error"]),disabled:this.isDisabled,id:this.inputId,name:this.name,onInput:o=>{const s=o.target;this.inputChange.emit(s.value),this.el.inputValue=s.value,this.el.dispatchEvent(new Event("change"))},placeholder:this.inputPlaceholder||"",required:this.required,type:"text",value:this.internalValue})),t("div",{key:"56c6339f420fd38d0c850a6ad10f2349bfe99d21",class:"zonos--floated-label"},t("label",{key:"7cdd19ca39f09d105786a751fbd3434779c8958b",htmlFor:this.inputId},this.inputLabel))),this.error&&t("zonos-text",{key:"784a4aca2d02d59c7a59e8579c88cdaba24f64af",textColor:"red-600",type:"caption"},this.error))}get el(){return i(this)}static get watchers(){return{inputValue:["onInputValueChange"],value:["onValueChange"]}}};d.style='.sc-zonos-stripe-input-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-stripe-input-h *.sc-zonos-stripe-input{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-stripe-input-h img.sc-zonos-stripe-input{max-width:100%}.sc-zonos-stripe-input-h dl.sc-zonos-stripe-input,.sc-zonos-stripe-input-h dd.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h1.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h2.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h3.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h4.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h5.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h6.sc-zonos-stripe-input,.sc-zonos-stripe-input-h hr.sc-zonos-stripe-input,.sc-zonos-stripe-input-h figure.sc-zonos-stripe-input,.sc-zonos-stripe-input-h p.sc-zonos-stripe-input,.sc-zonos-stripe-input-h pre.sc-zonos-stripe-input{margin:0}.sc-zonos-stripe-input-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-stripe-input-h{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}.dark.sc-zonos-stripe-input-h{color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}.sc-zonos-stripe-input-h{margin:1px}.sc-zonos-stripe-input-h .zonos--label-wrapper.sc-zonos-stripe-input{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px;height:calc(var(--zonos-elements-size-xl) - 2px)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color);height:auto}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input .sc-zonos-stripe-input:-internal-autofill-selected{border-radius:var(--zonos-elements-radius-6) 0 0 var(--zonos-elements-radius-6)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input .sc-zonos-stripe-input:-internal-autofill-selected+label.sc-zonos-stripe-input+div.sc-zonos-stripe-input{background-color:#e8f0fe}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.sc-zonos-stripe-input{padding:24px 4px 2px 16px}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.has-input-prefix.sc-zonos-stripe-input{padding-left:0}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.has-input-prefix.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{margin-left:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label):-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-webkit-input-placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-moz-placeholder{-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus{outline:none;border:var(--zonos--border)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus~.zonos--floated-label.sc-zonos-stripe-input::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}.sc-zonos-stripe-input-h .zonos--floated-input.has-error.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-webkit-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-moz-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input:-ms-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-ms-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-webkit-autofill,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}.sc-zonos-stripe-input-h .disabled.sc-zonos-stripe-input .zonos--floated-label.sc-zonos-stripe-input{pointer-events:inherit}.sc-zonos-stripe-input-h .disabled.sc-zonos-stripe-input .zonos--floated-label.sc-zonos-stripe-input::after{cursor:not-allowed;z-index:1}.dark.sc-zonos-stripe-input-h .zonos--label-wrapper.sc-zonos-stripe-input{background:#30313d}';export{d as zonos_stripe_input}
1
+ import{r as o,d as s,h as t,a as n,g as i}from"./p-ce75b047.js";import{z as e,f as p}from"./p-ed9385f4.js";import{i as r,a}from"./p-eef5b0cc.js";import{c as l}from"./p-b4b7f705.js";import{g as c}from"./p-5beab541.js";import{i as z}from"./p-f6922df5.js";import"./p-0a377722.js";let u=0;const d=class{constructor(t){o(this,t),this.inputChange=s(this,"inputChange",7),this.inheritedAttributes={},this.inputId="zonos--input-"+ ++u,this.inputValue="",this.isDisabled=!1,this.isError=!1,this.error="",this.inputPlaceholder="",this.value="",this.required=!1,this.internalValue=this.inputValue}onInputValueChange(o){this.internalValue=o,this.inputChange.emit(o),this.value=o}onValueChange(o){this.internalValue=o}componentWillLoad(){this.inheritedAttributes=Object.assign(Object.assign({},r(this.el)),a(this.el,["tabindex","title","data-form-type","dir"]))}render(){const o=this.overridePrimaryColor||e.appearance.colorPrimary,s=this.overrideSecondaryColor||e.appearance.colorSecondary,i=window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===e.appearance.theme:o&&z(o),r=e.appearance.fontSizeInputValue||16;return t(n,{key:"c97d6030d8c9c3ca051a9eb0dce85676245abeeb",class:l(["zonos--input zonos--elements",i&&"dark",(this.isError||!!this.error)&&"has-error"]),"data-theme":i?"DARK":"LIGHT",style:{"--zonos--border-radius":c(),"--zonos--font-family":p(),"--zonos--font-size":`${r}px`,"--zonos--primary-color":s}},t("div",{key:"2517b55aa12ed4dd4772be3dbd48edf28e393697",class:l(["zonos--label-wrapper",this.isDisabled&&"disabled"])},t("input",Object.assign({key:"7853f3eafc7a926f88b21abfa8f59995b5c35cf3"},this.inheritedAttributes,{autoComplete:this.autoComplete,class:l(["zonos--floated-input",!!this.inputLabel&&"has-label",this.internalValue&&"has-content",(this.isError||!!this.error)&&"has-error"]),disabled:this.isDisabled,id:this.inputId,name:this.name,onInput:o=>{const s=o.target;this.inputChange.emit(s.value),this.el.inputValue=s.value,this.el.dispatchEvent(new Event("change"))},placeholder:this.inputPlaceholder||"",required:this.required,type:"text",value:this.internalValue})),t("div",{key:"56c6339f420fd38d0c850a6ad10f2349bfe99d21",class:"zonos--floated-label"},t("label",{key:"7cdd19ca39f09d105786a751fbd3434779c8958b",htmlFor:this.inputId},this.inputLabel))),this.error&&t("zonos-text",{key:"784a4aca2d02d59c7a59e8579c88cdaba24f64af",textColor:"red-600",type:"caption"},this.error))}get el(){return i(this)}static get watchers(){return{inputValue:["onInputValueChange"],value:["onValueChange"]}}};d.style='.sc-zonos-stripe-input-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-stripe-input-h *.sc-zonos-stripe-input{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-stripe-input-h img.sc-zonos-stripe-input{max-width:100%}.sc-zonos-stripe-input-h dl.sc-zonos-stripe-input,.sc-zonos-stripe-input-h dd.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h1.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h2.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h3.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h4.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h5.sc-zonos-stripe-input,.sc-zonos-stripe-input-h h6.sc-zonos-stripe-input,.sc-zonos-stripe-input-h hr.sc-zonos-stripe-input,.sc-zonos-stripe-input-h figure.sc-zonos-stripe-input,.sc-zonos-stripe-input-h p.sc-zonos-stripe-input,.sc-zonos-stripe-input-h pre.sc-zonos-stripe-input{margin:0}.sc-zonos-stripe-input-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-stripe-input-h{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}.dark.sc-zonos-stripe-input-h{color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}.sc-zonos-stripe-input-h{margin:1px}.sc-zonos-stripe-input-h .zonos--label-wrapper.sc-zonos-stripe-input{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px;height:calc(var(--zonos-elements-size-xl) - 2px)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size);color:var(--zonos-elements-text-color);height:auto}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input .sc-zonos-stripe-input:-internal-autofill-selected{border-radius:var(--zonos-elements-radius-6) 0 0 var(--zonos-elements-radius-6)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input .sc-zonos-stripe-input:-internal-autofill-selected+label.sc-zonos-stripe-input+div.sc-zonos-stripe-input{background-color:#e8f0fe}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.sc-zonos-stripe-input{padding:24px 4px 2px 16px}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.has-input-prefix.sc-zonos-stripe-input{padding-left:0}.sc-zonos-stripe-input-h .zonos--floated-input.has-label.has-input-prefix.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{margin-left:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label):-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:not(.has-label)::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-webkit-input-placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-moz-placeholder{-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input::placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus{outline:none;border:var(--zonos--border)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus~.zonos--floated-label.sc-zonos-stripe-input::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}.sc-zonos-stripe-input-h .zonos--floated-input.has-error.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-webkit-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-moz-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input:-ms-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::-ms-input-placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input::placeholder,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}.sc-zonos-stripe-input-h .zonos--floated-input.has-content.sc-zonos-stripe-input~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:focus~.zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-webkit-autofill,.sc-zonos-stripe-input-h .zonos--floated-input.sc-zonos-stripe-input:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input label.sc-zonos-stripe-input{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}.sc-zonos-stripe-input-h .zonos--floated-label.sc-zonos-stripe-input::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}.sc-zonos-stripe-input-h .disabled.sc-zonos-stripe-input .zonos--floated-label.sc-zonos-stripe-input{pointer-events:inherit}.sc-zonos-stripe-input-h .disabled.sc-zonos-stripe-input .zonos--floated-label.sc-zonos-stripe-input::after{cursor:not-allowed;z-index:1}.dark.sc-zonos-stripe-input-h .zonos--label-wrapper.sc-zonos-stripe-input{background:#30313d}';export{d as zonos_stripe_input}
@@ -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-3fae811a.js";import{t as z}from"./p-99e1734a.js";import{f as p,z as h}from"./p-058f6124.js";import{r as f}from"./p-ee2c7a1e.js";import{g}from"./p-f830f800.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-67897a0d.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-bd938f80.js";import{t as z}from"./p-a18adf27.js";import{f as p,z as h}from"./p-ed9385f4.js";import{r as f}from"./p-868a8667.js";import{g}from"./p-5beab541.js";import"./p-0a377722.js";import"./p-41dd1cb8.js";import"./p-f6922df5.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 +1 @@
1
- import{r as o,h as t,a as e,g as s}from"./p-ce75b047.js";import{z as n,f as r}from"./p-058f6124.js";import{i as a,a as i}from"./p-eef5b0cc.js";import{c as d}from"./p-b4b7f705.js";import{g as l}from"./p-f830f800.js";import{i as h}from"./p-ae393255.js";import{i as c}from"./p-67897a0d.js";import{s as b}from"./p-96d77739.js";import"./p-0a377722.js";const u=class{constructor(t){o(this,t),this.inheritedAttributes={},this.isDisabled=!1,this.icon=null,this.iconRight=!1,this.size="sm",this.variant="standard",this.noBackground=!1,this.withBoxShadow=!1,this.noPaddingLeft=!1,this.noPaddingRight=!1,this.loading=!1,this.justifyContent="center",this.bold=!1,this.hasIcon=!!this.icon,this.hasContent=!1,this.handleSlotChange=()=>{this.hasContent=!0},this.getColorVarProperty=o=>o.replace("var(","").replace(")",""),this.getButtonStyle=()=>{const o=this.variant||"standard",t=this.buttonColor&&h(this.buttonColor)?`var(--zonos-elements-${this.buttonColor})`:this.buttonColor,e=window.getComputedStyle(this.ele).getPropertyValue(this.getColorVarProperty(t||""))||t||"",s=!c(window.getComputedStyle(this.ele).getPropertyValue("--zonos-elements-gray-0")),r=!c(e),a=s&&!r||!s&&r;if("subtle"===o)return{color:t,useDarkHoverSubtle:a};{const o=(this.backgroundColor&&h(this.backgroundColor)?`var(--zonos-elements-${this.backgroundColor})`:this.backgroundColor)||n.appearance.colorSecondary,e=o&&h(this.getColorVarProperty(o))?window.getComputedStyle(this.ele).getPropertyValue(this.getColorVarProperty(o)):o;return{backgroundColor:o,color:"subtle"!==this.variant&&e&&c(e)?"white":t,spinnerColor:e&&c(e)?"white":"black",useDarkHoverSubtle:a}}}}iconChangeHandler(){this.hasIcon=!!this.icon}clickHandler(o){(this.loading||this.isDisabled)&&(o.preventDefault(),o.stopPropagation())}componentWillLoad(){this.iconChangeHandler(),this.inheritedAttributes=Object.assign(Object.assign({},a(this.ele)),i(this.ele,["tabindex","title","data-form-type","dir"]))}render(){const{backgroundColor:o,color:s,spinnerColor:a,useDarkHoverSubtle:i}=this.getButtonStyle(),u=this.loading||this.isDisabled,g=this.variant||"standard",m="standard"===g?(o=>{const t=o||n.appearance.colorSecondary,e=t&&h(t)?`var(--zonos-elements-${t})`:t;return e&&c(e)?"DARK":"LIGHT"})(o):void 0,v=l({overrideBorderStyle:this.borderStyle});return t(e,{key:"301c0140cae22157209423d34385103d9ea1cf29",class:d(["zonos--elements"]),"data-theme":this.theme||m,disabled:u,style:b({"--zonos--background-color":o,"--zonos--border-radius":v,"--zonos--color":s,"--zonos--font-family":r(),"--zonos--font-weight":this.bold?"bold":"normal"})},t("button",Object.assign({key:"2e3e75b8d0fd7c22c668972ad4a2f8bda363e159"},this.inheritedAttributes,{class:d([this.hasIcon&&"has-icon",this.hasContent&&"has-content",this.noBackground&&"no-background",this.noPaddingLeft&&"no-padding-left",this.noPaddingRight&&"no-padding-right",this.iconRight&&"icon-right",this.withBoxShadow&&"with-box-shadow",i&&"dark-hover-subtle",g,this.size,o&&"standard"===g&&"override-background"]),disabled:u,style:{justifyContent:this.justifyContent}}),this.loading&&t("div",{key:"f1965c769d9d1a2a7f636b09be1384cf7cd6227a",class:"zonos--spinner-wrapper"},t("zonos-spinner",{key:"5bbeb95041065e247ebc2f725f751e2fb5cd93c5",size:16,spinnerColor:a})),!this.loading&&!this.iconRight&&this.icon,t("slot",{key:"b32f5bd10dc79b258545efd92ed594a2906b3292",onSlotchange:this.handleSlotChange}),!this.loading&&this.iconRight&&this.icon))}static get delegatesFocus(){return!0}get ele(){return s(this)}static get watchers(){return{icon:["iconChangeHandler"]}}};u.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--spinner-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-surface-color);-ms-flex-pack:center;justify-content:center;border-radius:var(--zonos-elements-radius-10);gap:8px}:host button{width:100%;position:relative;font-size:14px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--zonos-elements-surface-color);border:none;outline:1px solid var(--zonos-elements-surface-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-weight:var(--zonos--font-weight, 500);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-family:var(--zonos--font-family, Inter), Inter;letter-spacing:normal;cursor:pointer;white-space:nowrap;padding:8px 24px;color:var(--zonos--color, var(--zonos-elements-gray-1000));margin:1px}:host button:not([disabled]):hover{background-image:var(--zonos-elements-button-standard-hover)}:host button:not([disabled]):active{background:var(--zonos-elements-gray-700)}:host button:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button.with-box-shadow{-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard)}:host button.sm.no-background,:host button.md.no-background,:host button.lg.no-background{background:none;outline:none}:host button.sm.no-padding-left,:host button.md.no-padding-left,:host button.lg.no-padding-left{padding-left:0}:host button.sm.no-padding-right,:host button.md.no-padding-right,:host button.lg.no-padding-right{padding-right:0}:host button[disabled]{cursor:not-allowed;background-color:var(--zonos--background-color, var(--zonos-elements-gray-200))}:host button[disabled] .zonos--spinner-wrapper{background-color:var(--zonos--background-color, var(--zonos-elements-gray-200))}:host button:active{-webkit-transform:scale(0.99);transform:scale(0.99)}:host button{}:host button.sm{height:var(--zonos-elements-size-sm);line-height:var(--zonos-elements-size-sm);padding:4px 8px}:host button.sm:not(.has-content).has-icon{padding:0 4px}:host button.md{height:var(--zonos-elements-size-md);line-height:var(--zonos-elements-size-md);padding:8px 16px}:host button.md:not(.has-content).has-icon{padding:0 8px}:host button.lg{height:var(--zonos-elements-size-lg);line-height:var(--zonos-elements-size-lg);padding:12px 24px}:host button.lg:not(.has-content).has-icon{padding:0 16px}:host button:not(.only-icon).has-icon{gap:8px}@media (max-width: 400px){:host button:not(.only-icon).has-icon{font-size:var(--zonos-elements-font-size-s)}}:host button.override-background{background-color:var(--zonos--background-color, var(--zonos-elements-gray-0));color:var(--zonos--color, var(--zonos-elements-gray-1000));outline:1px solid var(--zonos--background-color, var(--zonos-elements-gray-0))}:host button.override-background:disabled{opacity:0.8}:host button.override-background:not(:disabled):hover{opacity:0.9}:host button:not(.override-background){}:host button:not(.override-background).primary{background:var(--zonos-elements-blue-600);outline:1px solid var(--zonos-elements-blue-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).primary:not([disabled]):hover{background-image:var(--zonos-elements-button-primary-hover)}:host button:not(.override-background).primary:not([disabled]):active{background:var(--zonos-elements-blue-700)}:host button:not(.override-background).primary:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).primary[disabled]{background:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-600)}:host button:not(.override-background).success{background:var(--zonos-elements-green-600);outline:1px solid var(--zonos-elements-green-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).success:not([disabled]):hover{background-image:var(--zonos-elements-button-success-hover)}:host button:not(.override-background).success:not([disabled]):active{background:var(--zonos-elements-green-700)}:host button:not(.override-background).success:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).success[disabled]{background:var(--zonos-elements-green-400)}:host button:not(.override-background).success[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-green-400)}:host button:not(.override-background).danger{background:var(--zonos-elements-red-600);outline:1px solid var(--zonos-elements-red-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).danger:not([disabled]):hover{background-image:var(--zonos-elements-button-danger-hover)}:host button:not(.override-background).danger:not([disabled]):active{background:var(--zonos-elements-red-700)}:host button:not(.override-background).danger:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).danger[disabled]{background:var(--zonos-elements-red-400)}:host button:not(.override-background).danger[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-red-400)}:host button:not(.override-background).warning{background:var(--zonos-elements-orange-600);outline:1px solid var(--zonos-elements-orange-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).warning:not([disabled]):hover{background-image:var(--zonos-elements-button-warning-hover)}:host button:not(.override-background).warning:not([disabled]):active{background:var(--zonos-elements-orange-700)}:host button:not(.override-background).warning:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).warning[disabled]{background:var(--zonos-elements-orange-400)}:host button:not(.override-background).warning[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-orange-400)}:host button:not(.override-background).subtle{background:transparent;color:var(--zonos--color, var(--zonos-elements-gray-1000));outline:none}:host button:not(.override-background).subtle:not([disabled]):hover{background:rgba(0, 0, 0, 0.1)}:host button:not(.override-background).subtle:not([disabled]):active{background:rgba(0, 0, 0, 0.2)}:host button:not(.override-background).subtle:focus{-webkit-box-shadow:var(--zonos-elements-button-focus-ring);box-shadow:var(--zonos-elements-button-focus-ring)}:host button:not(.override-background).subtle[disabled] .content{opacity:0.6}:host button:not(.override-background).subtle[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-gray-0)}:host button:not(.override-background).outline{background:transparent;outline:1px solid var(--zonos-elements-gray-700)}:host button:not(.override-background).outline:not([disabled]):hover{background-color:var(--zonos-elements-gray-100)}:host button:not(.override-background).outline:not([disabled]):active{background:var(--zonos-elements-gray-200)}:host .zonos--footer-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center;border-radius:var(--zonos-elements-radius-4);width:24px}";const g=class{constructor(t){o(this,t),this.autoHeight=!1,this.iconColor="gray-1000",this.size=24}render(){if(!this.content||!this.el.shadowRoot)return null;const o=h(this.iconColor)?`var(--zonos-elements-${this.iconColor})`:this.iconColor;return this.el.shadowRoot.innerHTML=this.content,t(e,{class:"zonos--elements",style:{"--zonos--color":o,"--zonos--font-family":r(),"--zonos--height":this.autoHeight?"auto":`${this.size}px`,"--zonos--width":`${this.size}px`}})}get el(){return s(this)}};g.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host svg{width:var(--zonos--width);height:var(--zonos--height);fill:var(--zonos--color);color:var(--zonos--color)}";const m=class{constructor(t){o(this,t),this.size=32}render(){return this.el.shadowRoot?t(e,{class:d(["zonos--elements",this.spinnerColor]),style:{"--zonos--size":`${this.size}px`}},t("svg",{viewBox:"0 0 50 50"},t("circle",{class:"track",cx:"25",cy:"25",fill:"none",id:"loading-spinner-circle",r:"20","stroke-width":"5"}),t("circle",{cx:"25",cy:"25",fill:"none",id:"loading-spinner-circle",r:"20","stroke-width":"5"}))):null}get el(){return s(this)}};m.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:relative;overflow:hidden;width:var(--zonos--size);height:var(--zonos--size);display:-ms-inline-flexbox;display:inline-flex}:host svg{width:var(--zonos--size);height:var(--zonos--size);stroke:var(--zonos-elements-blue-600);-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite}:host circle.track{stroke:var(--zonos-elements-gray-200)}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}:host circle:not(.track){stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}:host(.black) circle{stroke:var(--zonos-elements-spinner-stroke-black)}:host(.black) circle.track{stroke:var(--zonos-elements-spinner-track-black)}:host(.white) circle{stroke:var(--zonos-elements-spinner-stroke-white)}:host(.white) circle.track{stroke:var(--zonos-elements-spinner-track-white)}:host(.info) circle{stroke:var(--zonos-elements-blue-600)}:host(.info) circle.track{stroke:var(--zonos-elements-blue-100)}:host(.success) circle{stroke:var(--zonos-elements-green-600)}:host(.success) circle.track{stroke:var(--zonos-elements-green-100)}:host(.danger) circle{stroke:var(--zonos-elements-red-600)}:host(.danger) circle.track{stroke:var(--zonos-elements-red-100)}:host(.warning) circle{stroke:var(--zonos-elements-orange-600)}:host(.warning) circle.track{stroke:var(--zonos-elements-orange-100)}";export{u as zonos_button,g as zonos_icon,m as zonos_spinner}
1
+ import{r as o,h as t,a as e,g as s}from"./p-ce75b047.js";import{z as n,f as r}from"./p-ed9385f4.js";import{i as a,a as i}from"./p-eef5b0cc.js";import{c as d}from"./p-b4b7f705.js";import{g as l}from"./p-5beab541.js";import{i as h}from"./p-ae393255.js";import{i as c}from"./p-f6922df5.js";import{s as b}from"./p-96d77739.js";import"./p-0a377722.js";const u=class{constructor(t){o(this,t),this.inheritedAttributes={},this.isDisabled=!1,this.icon=null,this.iconRight=!1,this.size="sm",this.variant="standard",this.noBackground=!1,this.withBoxShadow=!1,this.noPaddingLeft=!1,this.noPaddingRight=!1,this.loading=!1,this.justifyContent="center",this.bold=!1,this.hasIcon=!!this.icon,this.hasContent=!1,this.handleSlotChange=()=>{this.hasContent=!0},this.getColorVarProperty=o=>o.replace("var(","").replace(")",""),this.getButtonStyle=()=>{const o=this.variant||"standard",t=this.buttonColor&&h(this.buttonColor)?`var(--zonos-elements-${this.buttonColor})`:this.buttonColor,e=window.getComputedStyle(this.ele).getPropertyValue(this.getColorVarProperty(t||""))||t||"",s=!c(window.getComputedStyle(this.ele).getPropertyValue("--zonos-elements-gray-0")),r=!c(e),a=s&&!r||!s&&r;if("subtle"===o)return{color:t,useDarkHoverSubtle:a};{const o=(this.backgroundColor&&h(this.backgroundColor)?`var(--zonos-elements-${this.backgroundColor})`:this.backgroundColor)||n.appearance.colorSecondary,e=o&&h(this.getColorVarProperty(o))?window.getComputedStyle(this.ele).getPropertyValue(this.getColorVarProperty(o)):o;return{backgroundColor:o,color:"subtle"!==this.variant&&e&&c(e)?"white":t,spinnerColor:e&&c(e)?"white":"black",useDarkHoverSubtle:a}}}}iconChangeHandler(){this.hasIcon=!!this.icon}clickHandler(o){(this.loading||this.isDisabled)&&(o.preventDefault(),o.stopPropagation())}componentWillLoad(){this.iconChangeHandler(),this.inheritedAttributes=Object.assign(Object.assign({},a(this.ele)),i(this.ele,["tabindex","title","data-form-type","dir"]))}render(){const{backgroundColor:o,color:s,spinnerColor:a,useDarkHoverSubtle:i}=this.getButtonStyle(),u=this.loading||this.isDisabled,g=this.variant||"standard",m="standard"===g?(o=>{const t=o||n.appearance.colorSecondary,e=t&&h(t)?`var(--zonos-elements-${t})`:t;return e&&c(e)?"DARK":"LIGHT"})(o):void 0,v=l({overrideBorderStyle:this.borderStyle});return t(e,{key:"301c0140cae22157209423d34385103d9ea1cf29",class:d(["zonos--elements"]),"data-theme":this.theme||m,disabled:u,style:b({"--zonos--background-color":o,"--zonos--border-radius":v,"--zonos--color":s,"--zonos--font-family":r(),"--zonos--font-weight":this.bold?"bold":"normal"})},t("button",Object.assign({key:"2e3e75b8d0fd7c22c668972ad4a2f8bda363e159"},this.inheritedAttributes,{class:d([this.hasIcon&&"has-icon",this.hasContent&&"has-content",this.noBackground&&"no-background",this.noPaddingLeft&&"no-padding-left",this.noPaddingRight&&"no-padding-right",this.iconRight&&"icon-right",this.withBoxShadow&&"with-box-shadow",i&&"dark-hover-subtle",g,this.size,o&&"standard"===g&&"override-background"]),disabled:u,style:{justifyContent:this.justifyContent}}),this.loading&&t("div",{key:"f1965c769d9d1a2a7f636b09be1384cf7cd6227a",class:"zonos--spinner-wrapper"},t("zonos-spinner",{key:"5bbeb95041065e247ebc2f725f751e2fb5cd93c5",size:16,spinnerColor:a})),!this.loading&&!this.iconRight&&this.icon,t("slot",{key:"b32f5bd10dc79b258545efd92ed594a2906b3292",onSlotchange:this.handleSlotChange}),!this.loading&&this.iconRight&&this.icon))}static get delegatesFocus(){return!0}get ele(){return s(this)}static get watchers(){return{icon:["iconChangeHandler"]}}};u.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--spinner-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-surface-color);-ms-flex-pack:center;justify-content:center;border-radius:var(--zonos-elements-radius-10);gap:8px}:host button{width:100%;position:relative;font-size:14px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--zonos-elements-surface-color);border:none;outline:1px solid var(--zonos-elements-surface-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-weight:var(--zonos--font-weight, 500);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-family:var(--zonos--font-family, Inter), Inter;letter-spacing:normal;cursor:pointer;white-space:nowrap;padding:8px 24px;color:var(--zonos--color, var(--zonos-elements-gray-1000));margin:1px}:host button:not([disabled]):hover{background-image:var(--zonos-elements-button-standard-hover)}:host button:not([disabled]):active{background:var(--zonos-elements-gray-700)}:host button:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button.with-box-shadow{-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard)}:host button.sm.no-background,:host button.md.no-background,:host button.lg.no-background{background:none;outline:none}:host button.sm.no-padding-left,:host button.md.no-padding-left,:host button.lg.no-padding-left{padding-left:0}:host button.sm.no-padding-right,:host button.md.no-padding-right,:host button.lg.no-padding-right{padding-right:0}:host button[disabled]{cursor:not-allowed;background-color:var(--zonos--background-color, var(--zonos-elements-gray-200))}:host button[disabled] .zonos--spinner-wrapper{background-color:var(--zonos--background-color, var(--zonos-elements-gray-200))}:host button:active{-webkit-transform:scale(0.99);transform:scale(0.99)}:host button{}:host button.sm{height:var(--zonos-elements-size-sm);line-height:var(--zonos-elements-size-sm);padding:4px 8px}:host button.sm:not(.has-content).has-icon{padding:0 4px}:host button.md{height:var(--zonos-elements-size-md);line-height:var(--zonos-elements-size-md);padding:8px 16px}:host button.md:not(.has-content).has-icon{padding:0 8px}:host button.lg{height:var(--zonos-elements-size-lg);line-height:var(--zonos-elements-size-lg);padding:12px 24px}:host button.lg:not(.has-content).has-icon{padding:0 16px}:host button:not(.only-icon).has-icon{gap:8px}@media (max-width: 400px){:host button:not(.only-icon).has-icon{font-size:var(--zonos-elements-font-size-s)}}:host button.override-background{background-color:var(--zonos--background-color, var(--zonos-elements-gray-0));color:var(--zonos--color, var(--zonos-elements-gray-1000));outline:1px solid var(--zonos--background-color, var(--zonos-elements-gray-0))}:host button.override-background:disabled{opacity:0.8}:host button.override-background:not(:disabled):hover{opacity:0.9}:host button:not(.override-background){}:host button:not(.override-background).primary{background:var(--zonos-elements-blue-600);outline:1px solid var(--zonos-elements-blue-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).primary:not([disabled]):hover{background-image:var(--zonos-elements-button-primary-hover)}:host button:not(.override-background).primary:not([disabled]):active{background:var(--zonos-elements-blue-700)}:host button:not(.override-background).primary:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).primary[disabled]{background:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-600)}:host button:not(.override-background).success{background:var(--zonos-elements-green-600);outline:1px solid var(--zonos-elements-green-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).success:not([disabled]):hover{background-image:var(--zonos-elements-button-success-hover)}:host button:not(.override-background).success:not([disabled]):active{background:var(--zonos-elements-green-700)}:host button:not(.override-background).success:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).success[disabled]{background:var(--zonos-elements-green-400)}:host button:not(.override-background).success[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-green-400)}:host button:not(.override-background).danger{background:var(--zonos-elements-red-600);outline:1px solid var(--zonos-elements-red-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).danger:not([disabled]):hover{background-image:var(--zonos-elements-button-danger-hover)}:host button:not(.override-background).danger:not([disabled]):active{background:var(--zonos-elements-red-700)}:host button:not(.override-background).danger:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).danger[disabled]{background:var(--zonos-elements-red-400)}:host button:not(.override-background).danger[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-red-400)}:host button:not(.override-background).warning{background:var(--zonos-elements-orange-600);outline:1px solid var(--zonos-elements-orange-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).warning:not([disabled]):hover{background-image:var(--zonos-elements-button-warning-hover)}:host button:not(.override-background).warning:not([disabled]):active{background:var(--zonos-elements-orange-700)}:host button:not(.override-background).warning:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).warning[disabled]{background:var(--zonos-elements-orange-400)}:host button:not(.override-background).warning[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-orange-400)}:host button:not(.override-background).subtle{background:transparent;color:var(--zonos--color, var(--zonos-elements-gray-1000));outline:none}:host button:not(.override-background).subtle:not([disabled]):hover{background:rgba(0, 0, 0, 0.1)}:host button:not(.override-background).subtle:not([disabled]):active{background:rgba(0, 0, 0, 0.2)}:host button:not(.override-background).subtle:focus{-webkit-box-shadow:var(--zonos-elements-button-focus-ring);box-shadow:var(--zonos-elements-button-focus-ring)}:host button:not(.override-background).subtle[disabled] .content{opacity:0.6}:host button:not(.override-background).subtle[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-gray-0)}:host button:not(.override-background).outline{background:transparent;outline:1px solid var(--zonos-elements-gray-700)}:host button:not(.override-background).outline:not([disabled]):hover{background-color:var(--zonos-elements-gray-100)}:host button:not(.override-background).outline:not([disabled]):active{background:var(--zonos-elements-gray-200)}:host .zonos--footer-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center;border-radius:var(--zonos-elements-radius-4);width:24px}";const g=class{constructor(t){o(this,t),this.autoHeight=!1,this.iconColor="gray-1000",this.size=24}render(){if(!this.content||!this.el.shadowRoot)return null;const o=h(this.iconColor)?`var(--zonos-elements-${this.iconColor})`:this.iconColor;return this.el.shadowRoot.innerHTML=this.content,t(e,{class:"zonos--elements",style:{"--zonos--color":o,"--zonos--font-family":r(),"--zonos--height":this.autoHeight?"auto":`${this.size}px`,"--zonos--width":`${this.size}px`}})}get el(){return s(this)}};g.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host svg{width:var(--zonos--width);height:var(--zonos--height);fill:var(--zonos--color);color:var(--zonos--color)}";const m=class{constructor(t){o(this,t),this.size=32}render(){return this.el.shadowRoot?t(e,{class:d(["zonos--elements",this.spinnerColor]),style:{"--zonos--size":`${this.size}px`}},t("svg",{viewBox:"0 0 50 50"},t("circle",{class:"track",cx:"25",cy:"25",fill:"none",id:"loading-spinner-circle",r:"20","stroke-width":"5"}),t("circle",{cx:"25",cy:"25",fill:"none",id:"loading-spinner-circle",r:"20","stroke-width":"5"}))):null}get el(){return s(this)}};m.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:relative;overflow:hidden;width:var(--zonos--size);height:var(--zonos--size);display:-ms-inline-flexbox;display:inline-flex}:host svg{width:var(--zonos--size);height:var(--zonos--size);stroke:var(--zonos-elements-blue-600);-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite}:host circle.track{stroke:var(--zonos-elements-gray-200)}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}:host circle:not(.track){stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}:host(.black) circle{stroke:var(--zonos-elements-spinner-stroke-black)}:host(.black) circle.track{stroke:var(--zonos-elements-spinner-track-black)}:host(.white) circle{stroke:var(--zonos-elements-spinner-stroke-white)}:host(.white) circle.track{stroke:var(--zonos-elements-spinner-track-white)}:host(.info) circle{stroke:var(--zonos-elements-blue-600)}:host(.info) circle.track{stroke:var(--zonos-elements-blue-100)}:host(.success) circle{stroke:var(--zonos-elements-green-600)}:host(.success) circle.track{stroke:var(--zonos-elements-green-100)}:host(.danger) circle{stroke:var(--zonos-elements-red-600)}:host(.danger) circle.track{stroke:var(--zonos-elements-red-100)}:host(.warning) circle{stroke:var(--zonos-elements-orange-600)}:host(.warning) circle.track{stroke:var(--zonos-elements-orange-100)}";export{u as zonos_button,g as zonos_icon,m as zonos_spinner}
@@ -1 +1 @@
1
- import{c as e,z as t}from"./p-058f6124.js";import{s as o,l as n,e as r,t as s,f as i,b as a}from"./p-99e1734a.js";import{l as d,b as l}from"./p-0a377722.js";import{h as c,l as u,f as m,g as v,a as p,s as h,j as y}from"./p-41dd1cb8.js";import{i as f}from"./p-67897a0d.js";import{g as w}from"./p-f830f800.js";const g=async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await c(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}},{reset:b,state:S}=e((()=>({amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:!1,isEnabled:!1,orderIdCreated:null,remainingBalance:null,useFullBalance:!0}))),C=()=>{b()},O=e=>{d("Store credit balance from session","info",e),S.availableBalance=e},A=async()=>{var e,t;const{errors:o,json:n}=await g();if(o.length||!n)return void u("Failed to refresh store credit balance");const r=null!==(t=null===(e=n.checkoutSession.customerProfile)||void 0===e?void 0:e.storeCreditBalance)&&void 0!==t?t:null;O(r)},I=async()=>{var e;const t=o.checkoutSessionId;if(!t){const e="No checkout session found";return u(e),S.error=e,{error:e,success:!1}}d("Applying store credit","info",{checkoutSessionId:t}),S.isApplying=!0,S.error=null;try{const{errors:o,json:n}=await c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"});if(o.length>0||!n){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}return S.appliedAmount=n.amountApplied,S.remainingBalance=n.remainingBalance,S.isApplying=!1,d("Store credit applied","info",{amountApplied:n.amountApplied,remainingBalance:n.remainingBalance}),{error:null,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}},k=e=>{S.isEnabled=e,S.error=null,e||(S.amountToApply=null)},N=e=>{if(null===e)return S.amountToApply=null,void(S.error=null);e<=0?S.error="Amount must be greater than zero":null!==S.availableBalance&&e>S.availableBalance?S.error="Amount exceeds available balance":e>we.total+(we.storeCredit||0)?S.error="Amount exceeds order total":(S.error=null,S.amountToApply=e)},T=e=>{if(S.useFullBalance=e,S.error=null,e&&null!==S.availableBalance){const e=Math.min(S.availableBalance,we.total+(we.storeCredit||0));S.amountToApply=e}else e||(S.amountToApply=null)},j=()=>S.isEnabled&&null!==S.availableBalance?S.useFullBalance?Math.min(S.availableBalance,we.total+(we.storeCredit||0)):S.amountToApply||0:0,E=()=>null!==S.amountToApply&&S.amountToApply>0&&we.storeCredit>0&&we.total<=0,P=async()=>{var e,t,n;const r=o.checkoutSessionId;if(!r){const e="No checkout session found";return u(e),S.error=e,{error:e,orderId:null,success:!1}}d("Creating store credit order","info",{checkoutSessionId:r});try{const{errors:o,json:s}=await c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:r},method:"POST"});if(o.length>0||!s){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}const i=(null===(n=null===(t=s.checkoutSessionStoreCreditOrderCreate)||void 0===t?void 0:t.order)||void 0===n?void 0:n.id)||null;return S.orderIdCreated=i,d("Store credit order created","info",{orderId:i}),{error:null,orderId:i,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}},D=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const r=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=r[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||r.slice(1).join(" ").trim()||""}},L=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:v}=e.value.address,p=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[p])||p,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[v])||v}},x=e=>{var t;const s="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=q.stripeLinkEventData,a=q.stripeAddressEventData,d=q.stripeShippingSameAsBilling?q.stripeAddressEventData:q.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=L({currentAddress:a,translatedAddress:q.translatedAddress.address}),{firstName:c,lastName:u}=D({name:l.name}),m=L({currentAddress:d,translatedAddress:q.translatedAddress.address}),{firstName:v,lastName:p}=D({name:m.name}),h=r()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:v,lastName:p,phone:m.phone},cartCurrencyCode:null===(t=we.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||n.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:q.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!s,landedCostAdjustments:we.promoCode?[{amount:0,productId:null,promoCode:we.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:q.shortAddressCode,shipToTaxId:q.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},R=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=q.stripeLinkEventData,n=q.stripeAddressEventData,r=q.stripeShippingSameAsBilling?q.stripeAddressEventData:q.stripeBillingAddressEventData;if(d({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=L({currentAddress:n,translatedAddress:q.translatedAddress.address}),{firstName:i,lastName:a}=D({name:s.name}),l=L({currentAddress:r,translatedAddress:q.translatedAddress.address}),{firstName:c,lastName:u}=D({name:l.name}),m=we.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),v=we.promoCode?[{amount:0,productId:null,promoCode:we.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:q.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:s.phone},isTest:e,items:we.items,landedCostAdjustments:v,shipToShortAddressCode:q.shortAddressCode,shipToTaxId:q.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const z=async e=>{const o=window.Zonos.cartId;if(!o)return await(async e=>{var o;const n=t.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=R(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:m.vercel},{promoCode:we.promoCode});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:d,json:l}=await c("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!l||d.length)throw new Error(`Invalid landed cost object: ${(null===(s=d.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await c("/api/zonos-elements/calculate-landed-cost",{body:R(),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(e);const n=await(async({abortController:e,cartId:t})=>{var o,n,r,s,i;const{errors:a,json:d}=await c("/api/zonos-elements/cart-calculate-landed-cost",{body:x(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(r=a[0])||void 0===r?void 0:r.message.includes("signal is aborted"))||(null===(s=a[0])||void 0===s?void 0:s.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:e,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},U=async({checkoutSessionId:e,eventName:o,metadata:r})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:e,eventCreated:a,eventName:o});const u=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((v()||p()||u)&&!window.Zonos.zonosConversionTest)return;const m=n.selectedCountryCode,y=t.organizationId;if(!e)return void h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});y||h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});const f={checkoutSessionId:e,countryCode:m,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},r),{trackEventLogs:d}),organizationId:y};await c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})},_=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},B=e=>e.sort(((e,t)=>e.amount-t.amount)),F=async()=>{var e;const{errors:t,json:o}=await g();return t.length||!o?(u("Failed to retrieve checkout session info before confirming payment ",t),h({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:l}}),{errorMessage:s("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=o.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(u("Landed cost is not found in the checkout session before confirming payment."),h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}}),{errorMessage:s('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},J=({theme:e})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:t.appearance.fontSizeInputValue?`${t.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:t.appearance.fontSizeInputLabel?`${t.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===e?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},M=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:W,reset:$,state:q}=e((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),Y=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},H=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},K=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return y(e)},G=async e=>{var o,r;const s=q.clientSecret;if(!q.stripe)return void d("Skip. Stripe is not initialized");const i=(({clientSecret:e,overrideBorderRadius:o,overridePrimaryColor:r,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=r||t.appearance.colorPrimary,l=s||t.appearance.colorSecondary,c=(window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===t.appearance.theme:d&&f(d))?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},J({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},M({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:e||void 0,customerSessionClientSecret:q.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==e?void 0:e.overrideBorderRadius,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideSecondaryColor:null==e?void 0:e.overrideSecondaryColor,overrideTheme:null==e?void 0:e.overrideTheme,paypalEnabled:null==e?void 0:e.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(q.stripeElementsOptions);if(!q.stripeElements||!q.stripeElementsForBillingAddress)return q.stripeElementsForBillingAddress=null===(o=q.stripe)||void 0===o?void 0:o.elements(i),d("Stripe elements for billing address initialized"),q.stripeElements=null===(r=q.stripe)||void 0===r?void 0:r.elements(i),q.stripeElementsOptions=i,void d("Stripe elements initialized");a||(q.stripeElements.update(i),q.stripeElementsForBillingAddress.update(i),q.stripeElementsOptions=i,q.stripeElements.fetchUpdates()),d("Stripe elements updated")},V=()=>{sessionStorage.removeItem("zonos--client-secret"),$(),q.stripe=window.Zonos.stripe},Z=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const{firstName:i,lastName:a}=D({firstName:t,lastName:n,name:r});return i&&a||h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},Q=async()=>{var e,t,n,r;if(!(null===(e=q.stripeAddressEventData)||void 0===e?void 0:e.complete)||!q.stripeShippingSameAsBilling&&!(null===(t=q.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!q.stripeBillingAddressEventData)return{partiesCreated:!1};if(!we.landedCostData)return{partiesCreated:!1};const s=null===(n=we.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s,i,a;const d=null===(e=we.partiesData.find((e=>"DESTINATION"===e.type)))||void 0===e?void 0:e.id,l=null===(t=we.partiesData.find((e=>"PAYOR"===e.type)))||void 0===t?void 0:t.id;if(!d||!l)return!1;if(q.partyShippingId!==d||q.partyBillingId!==l)return!0;const c=JSON.stringify(null===(o=q.stripeLinkUsedWhenFetchingLC)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=q.stripeLinkEventData)||void 0===n?void 0:n.value),u=JSON.stringify(null===(r=q.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=q.stripeAddressEventData)||void 0===s?void 0:s.value),m=!q.stripeShippingSameAsBilling&&JSON.stringify(null===(i=q.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===i?void 0:i.value)!==JSON.stringify(null===(a=q.stripeBillingAddressEventData)||void 0===a?void 0:a.value);return c||u||m||q.taxIdUsedWhenAsyncAddressUpdate!==q.taxId||q.companyNameUsedWhenAsyncAddressUpdate!==q.companyName})();if(!i)return{partiesCreated:!1};const a=Z({address:q.stripeAddressEventData.value.address,firstName:q.stripeAddressEventData.value.firstName,lastName:q.stripeAddressEventData.value.lastName,name:q.stripeAddressEventData.value.name,phone:q.stripeAddressEventData.value.phone}),d=q.stripeShippingSameAsBilling?a:Z({address:q.stripeBillingAddressEventData.value.address,firstName:q.stripeBillingAddressEventData.value.firstName,lastName:q.stripeBillingAddressEventData.value.lastName,name:q.stripeBillingAddressEventData.value.name,phone:q.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:v,json:p}=await c("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:q.companyName,email:(null===(r=q.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:s,shortAddressCode:q.shortAddressCode,taxId:q.taxId},method:"POST"});return v.length||!p?(u("Error occurs when creating parties",JSON.stringify(v,null,2)),h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:v,json:p}}),{partiesCreated:!1}):(q.companyNameUsedWhenAsyncAddressUpdate=q.companyName,q.stripeAddressUsedWhenAsyncAddressUpdate=q.stripeAddressEventData,q.stripeBillingAddressUsedWhenAsyncAddressUpdate=q.stripeBillingAddressEventData,q.taxIdUsedWhenAsyncAddressUpdate=q.taxId,q.partyBillingId=p.billToPartyId,q.partyShippingId=p.shipToPartyId,we.partiesData=we.partiesData.map((e=>"DESTINATION"===e.type&&e.id!==p.shipToPartyId?Object.assign(Object.assign({},e),{id:p.shipToPartyId}):"PAYOR"===e.type&&e.id!==p.billToPartyId?Object.assign(Object.assign({},e),{id:p.billToPartyId}):e)),{partiesCreated:!0})},X=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),ee=async e=>{var n,r,s,i;const a=(null==e?void 0:e.retries)||0,l=!!(null==e?void 0:e.applyingPromocode),c=(()=>{var e;const t=we.landedCostData&&(null===(e=we.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==we.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=q.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=q.stripeLinkEventData)||void 0===t?void 0:t.value),n=q.stripeAddressEventData&&JSON.stringify(X(q.stripeAddressEventData.value))!==JSON.stringify(q.stripeAddressUsedWhenFetchingLC),r=!q.stripeShippingSameAsBilling&&q.stripeBillingAddressEventData&&JSON.stringify(X(q.stripeBillingAddressEventData.value))!==JSON.stringify(q.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return d("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!we.landedCostData&&!q.isFetchingLandedCost||o||t})();if(!(()=>{var e,o,n,r;const s=!!(null===(e=q.stripeLinkEventData)||void 0===e?void 0:e.complete),i=!!(null===(o=q.stripeAddressEventData)||void 0===o?void 0:o.complete),a=q.stripeShippingSameAsBilling?i:!!(null===(n=q.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(e=>{var o,n;const r=null===(o=t.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=t.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===we.addressFormRenderType&&(s&&e in s?s[e]:null)||(r&&e in r?r[e]:null)})((null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&q.stripeAddressEventData?s&&q.stripeAddressEventData.value.firstName&&q.stripeAddressEventData.value.lastName&&q.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&q.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&q.stripeAddressEventData.value.address.postal_code.length>=3)&&q.stripeAddressEventData.value.phone&&q.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=q.fetchingLandedCostAbortController)||void 0===n||n.abort(),q.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};a?(q.isFetchingLandedCost=!1,setTimeout((()=>{q.isFetchingLandedCost=!0}),300)):q.isFetchingLandedCost=!0,q.stripeAddressEventData&&(q.stripeAddressUsedWhenFetchingLC={countryCode:q.stripeAddressEventData.value.address.country,postalCode:q.stripeAddressEventData.value.address.postal_code,state:q.stripeAddressEventData.value.address.state}),q.stripeBillingAddressEventData&&(q.stripeBillingAddressUsedWhenFetchingLC={countryCode:q.stripeBillingAddressEventData.value.address.country,postalCode:q.stripeBillingAddressEventData.value.address.postal_code,state:q.stripeBillingAddressEventData.value.address.state}),q.stripeLinkEventData&&(q.stripeLinkUsedWhenFetchingLC=Object.assign({},q.stripeLinkEventData));try{xe(),await(async()=>{var e;const t=new AbortController;q.fetchingLandedCostAbortController=t,xe();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await z(t);we.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,we.shippingData=B((null==d?void 0:d.filter(Boolean))||[]),Ce(s),q.fetchingLandedCostAbortController=null,we.partiesData=(null==a?void 0:a.filter(Boolean))||[],we.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&U({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=we.promoCodeApplied&&!we.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));we.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",we.promoCode)})();const e=null===(r=we.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=we.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ke({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(t){if(we.landedCostData=[],we.shippingData=[],t instanceof Error&&t.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(t.message)){if(a<1)return await ee(Object.assign(Object.assign({},e),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=q.stripeAddressEventData)||void 0===i?void 0:i.value;h({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[t.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}u(t)}return q.isFetchingLandedCost=!1,{isRequestNotReady:!1}},te=async()=>{var e,t;await ee({applyingPromocode:!0}),"payment"===we.step&&ze(),await Q();const o=null===(e=we.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=we.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await Pe({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},oe=()=>{we.promoCode="",sessionStorage.removeItem("zonos--promo-code"),we.promoCodeError=!1,we.promoCodeApplied=!1},ne=async()=>{"payment"===we.step&&ze(),oe(),await te()},re=e=>{let t=[],o=!0;const n=window.Zonos.isCollect,r=window.Zonos.isInvoice;switch(e){case"succeeded":t=[s("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",s("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],(n||r)&&(t=[s("Thank you for submitting your payment. We appreciate your prompt attention."),"",s("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[s("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[s("Payment failed. Please try another payment method.")],n&&(t=[s("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[s("Something went wrong.")]}return{isError:o,messages:t}},se=async()=>{var e,o;const{onInventoryCheck:n}=t.checkoutSettings,r=!!(null===(o=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&r){const{errors:e,json:t}=await c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(u("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(q.shouldInventoryRefund=!0,null):null:s("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:we.items},{translate:s,zonosApiRoute:m.vercel})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw h({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:we.items}}),e}},ie=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},ae=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=re(t);return{error:e,messages:o}}const o=e||q.clientSecret;if(!q.stripe||!o)return u("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[s("Something went wrong.")]};const{paymentIntent:n}=await q.stripe.retrievePaymentIntent(o),r=null==n?void 0:n.status,{isError:i,messages:a}=re(r);return{amount:null==n?void 0:n.amount,currency:null==n?void 0:n.currency,error:i,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:r}},de=async e=>{var t,n;const r=!!(null===(t=q.stripePaymentEventData)||void 0===t?void 0:t.complete),i=q.stripeElements,a=q.stripe,l=q.clientSecret;if(q.customErrorMessage=null,!(null===(n=we.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await F();if(!c.valid)throw q.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(a&&i&&r&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),U({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:i,redirect:"if_required"});if(d("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(s("Payment failed. Please try another payment method."))}},le=()=>{var e;const t=we.items.reduce(((e,t)=>e+t.amount*t.quantity),0),r=o.enabledVariantTestKeys||[];return{adjustmentsAmount:we.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=we.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:we.customerAuthenticationToken||void 0,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:q.skipPaymentIntent,varianceTestInput:r}},ce=async()=>{var e;if(!o.checkoutSessionId)return h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}}),void Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});const{errors:t,json:n}=await c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),r=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!r)return u("Error occurs when getting payment intent",JSON.stringify(t,null,2)),h({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:r}}),void Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});Te(n.checkoutSessionPaymentIntentCreate)},ue=async()=>{var e,t;if(!n.targetCurrency)return u("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;q.isFetchingSession=!0;const o=le();d("Checkout session body","info",o);const{errors:r,json:s}=await c("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(q.isFetchingSession=!1,r.length||!s){const t=null===(e=r.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return u("Error occurred when creating checkout session",JSON.stringify(r,null,2)),!1}const i=s.checkoutSessionCreate;return Te(i),ke({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),d("Exchange rate updated for cart items (checkout session create)","info",we.exchangeRate),d("done-init-checkout-session"),!0},me=async()=>{const e=o.checkoutSessionId;if(!e)return u("Failed to update checkout session base currency"),!1;if("LOCAL"===t.checkoutSettings.allowedSettlementCurrencies)return d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:q.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===q.checkoutSettlementCurrency?(d(`Updated checkout session to settlement currency "${r}".`),!0):(u("Failed to update checkout session base currency"),!1)},ve=async({adjustmentsAmount:e,cartId:t,currency:r,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d,storeCreditApplication:l})=>{const m=o.enabledVariantTestKeys||[],{errors:v,json:p}=await c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:q.partyBillingId,cartId:t,currency:r,customerAuthenticationToken:we.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:q.partyShippingId,skipPaymentIntent:q.skipPaymentIntent,storeCreditApplication:l,varianceTestInput:m},method:"POST"});return v.length||!p?(u("Error occurs when updating checkout session",JSON.stringify(v,null,2)),{errors:v,json:p}):{errors:[],json:p}},pe=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},he=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{const s=!!(null==o?void 0:o.complete);if(!s||!(r?s:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=D({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=D({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),v=u&&m?`${u} ${m}`:"",p=i.address,h=null==a?void 0:a.address;return{address:_({address:Object.assign(Object.assign({},p),{name:c}),invalidAdddressList:e}),billingAddress:r?void 0:_({address:h?Object.assign(Object.assign({},h),{name:v}):null,invalidAdddressList:t}),destinationCountry:p.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:q.stripeAddressEventData,stripeBillingAddressEventData:q.stripeBillingAddressEventData,stripeShippingSameAsBilling:q.stripeShippingSameAsBilling});if(!i)return void(q.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=q.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=q.stripeAddressEventData)||void 0===t?void 0:t.value),s=!q.stripeShippingSameAsBilling&&JSON.stringify(null===(o=q.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=q.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:l}=await c("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!l)return u("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(q.translatedAddress={address:{},billingAddress:{}});q.stripeAddressUsedWhenValidatingAddress=q.stripeAddressEventData,q.stripeBillingAddressUsedWhenValidatingAddress=q.stripeBillingAddressEventData;const m=null===(o=q.stripeAddressEventData)||void 0===o?void 0:o.value.address,v=null===(n=q.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;q.translatedAddress={address:m?pe({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:l.address||null}):{},billingAddress:q.stripeShippingSameAsBilling?{}:pe({currentAddress:Object.assign(Object.assign({},v),{name:null===(s=q.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:l.billingAddress||null})}};W("clientSecret",(e=>{e&&q.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:ye,reset:fe,state:we}=e((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:p(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ge=e=>{switch(e){case"DAYS":return s("days");case"WEEKS":return s("weeks");default:return s("business days")}},be=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ge(o.type)}:null},Se=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),Ce=e=>{d("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=we.items.find((t=>Se({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return we.restrictedItems=t,we.items=we.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>Se({item1:t,item2:e})))}))),{cartItems:we.items,restrictedItems:t}};let Oe=null;const Ae=()=>{o.checkoutSessionId=null,Oe&&(clearTimeout(Oe),Oe=null),C(),fe()},Ie=({messages:e,title:t})=>{Ae(),V(),we.step="error",we.error={messages:e,title:t}},ke=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{var n;we.exchangeRate=o.exchangeRate,we.adjustmentTotal=o.adjustments,we.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,we.storeCredit=null!==(n=o.storeCredit)&&void 0!==n?n:0,we.subtotal=o.items,we.total=o.total,we.currency=o.presentmentCurrencyCode,we.dutiesTaxesFeesEstimate=e||null},Ne=()=>!!we.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),Te=e=>{var t,n,r,s,c,u,m;q.clientSecret=e.clientSecret,q.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,q.customerProfile=e.customerProfile,we.checkoutSession=e,O(null!==(n=null===(t=e.customerProfile)||void 0===t?void 0:t.storeCreditBalance)&&void 0!==n?n:null),e.id||h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const v=i(e.varianceTestResults||[]);a(v);const p=(null===(c=null===(s=null===(r=we.checkoutSession)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===c?void 0:c.value)||(null===(m=null===(u=window.Zonos.cartData)||void 0===u?void 0:u.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===m?void 0:m.value)||null;p&&(d(`Found externalConfirmationPageURL: ${p}`),we.externalConfirmationPageURL=p)},je=async({adjustmentsAmount:e,cartId:t,currency:r,dutiesTaxesFeesEstimate:i,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var m;if(l&&we.selectedLandedCost&&(ke({dutiesTaxesFeesEstimate:i,method:we.landedCostMethod,subtotals:we.selectedLandedCost.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",we.exchangeRate)),!o.checkoutSessionId)return d("Could not update cart total without checkout session id","info"),!1;const{errors:v,json:p}=await ve({adjustmentsAmount:e,billToPartyId:q.partyBillingId,cartId:t,currency:r,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:q.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(v.length>0||!p){if(u("Error occurs when updating checkout session."),c){d("Initiating checkout session on failure","info");const e=await ue();return d(`stripeStoreInitCheckoutSession: ${e}`),!!e||(Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")}),!1)}return!1}return l||(ke({method:(null===(m=p.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:p.checkoutSessionUpdate.subtotals}),d("Exchange rate updated for cart items (checkout session update)","info",we.exchangeRate)),Te(p.checkoutSessionUpdate),!0},Ee=e=>{var o,n,r;return"DAP"===e.method&&(null===(n=null===(o=t.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US"))||"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method},Pe=async({applySubtotalsOnly:e,landedCostId:n,selectedShippingOption:r})=>{var s,i,a,l,c,u,m,v,p,h,y;d("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:r}),we.selectedShippingOption=r;const f=be(we.selectedShippingOption);if(f){const{maxTransit:e,minTransit:t,unit:o}=f;we.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else we.selectedShippingOptionTransitTime="";const w=null===(s=we.landedCostData)||void 0===s?void 0:s.find((e=>e.landedCostId===n));if(we.selectedLandedCost=w||null,!w)return!1;const g=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;g&&d(`DAP quote, using estimate: ${g}`,"info"),we.landedCostMethod=Ee(w.landedCost),we.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==w?void 0:w.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));we.isSelectedShippingAboveDeminimis=S,we.isSelectedShippingGuarantee=b;let C=!1;e?(ke({dutiesTaxesFeesEstimate:g,method:we.landedCostMethod,subtotals:w.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",we.exchangeRate),C=!0):C=await je({adjustmentsAmount:we.adjustmentTotal,billToPartyId:q.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(u=w.landedCost)||void 0===u?void 0:u.id,shipToPartyId:q.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=we.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(v=q.stripeAddressEventData)||void 0===v?void 0:v.value.address.country)||"US";return q.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===t.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=we.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=t.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},De=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;d(`==START CHECKOUT TIMEOUT - ${n}==`),we.checkoutTimeoutInterval=setTimeout((()=>{we.checkoutSessionTimeoutShow=!0}),n)},Le=()=>{we.checkoutTimeoutInterval&&(clearTimeout(we.checkoutTimeoutInterval),we.checkoutTimeoutInterval=null)},xe=()=>{we.items=we.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),we.restrictedItems=[]},Re=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:r=!0})=>{var s;we.adjustments=e,we.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(s=t.find(Boolean))||void 0===s?void 0:s.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(we.currency=i,q.isFetchingSession=!0,await je({adjustmentsAmount:d,billToPartyId:q.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:q.partyShippingId,shouldInitSessionOnFailure:r,varianceTestInput:o.enabledVariantTestKeys||[]}),q.isFetchingSession=!1)},ze=()=>{"shipping"===we.step?(we.step="customer-info",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})})):"payment"===we.step?(we.step="shipping",we.tabItems=Object.assign(Object.assign({},we.tabItems),{shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})})):"finish"===we.step&&(we.step="payment",we.tabItems=Object.assign(Object.assign({},we.tabItems),{payment:Object.assign(Object.assign({},we.tabItems.payment),{isDone:!1})}))},Ue=()=>{"customer-info"===we.step?(we.step="shipping",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems["customer-info"]),{isDone:!0})})):"shipping"===we.step?(we.step="payment",we.tabItems=Object.assign(Object.assign({},we.tabItems),{shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!0})})):"payment"===we.step&&(we.step="finish")},_e=()=>{we.step="customer-info",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},we.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})}),we.selectedShippingOption=null,we.isSelectedShippingAboveDeminimis=!1,we.isSelectedShippingGuarantee=!1,we.selectedShippingOptionTransitTime="",we.dutiesTaxesFees=0,we.dutiesTaxesFeesEstimate=0,we.shipping=0,we.total=we.subtotal},Be=()=>{Oe&&clearTimeout(Oe),Oe=setTimeout((()=>{Oe=null,(async()=>{var e,t;if(!o.checkoutSessionId)return void d("Could not update store credit without checkout session id","info");const r=we.selectedLandedCost,s=we.currency||(null===(e=we.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",i=we.adjustments.reduce(((e,t)=>e+t.amount),0),a=we.items.reduce(((e,t)=>e+t.amount*t.quantity),0),{errors:l,json:c}=await ve({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:null==r?void 0:r.landedCostId,presentmentCountryCode:n.selectedCountryCode,storeCreditApplication:S.isEnabled&&null!==S.amountToApply?S.useFullBalance?{mode:"FULL"}:{amount:S.amountToApply,mode:"PARTIAL"}:{mode:"NONE"}});l.length>0||!c?u("Error updating checkout session with store credit"):(ke({method:(null===(t=c.checkoutSessionUpdate.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals}),Te(c.checkoutSessionUpdate))})()}),300)};export{de as A,ie as B,V as C,ye as D,W as E,j as F,Z as G,Pe as H,Ne as I,te as J,ne as K,oe as L,re as M,S as N,C as O,he as P,D as Q,Q as R,be as S,Ee as T,B as U,k as V,T as W,Be as X,N as Y,A as Z,H as a,q as b,ae as c,we as d,Re as e,Ae as f,_e as g,Le as h,G as i,ue as j,ce as k,De as l,le as m,Ie as n,Y as o,Te as p,ee as q,Ue as r,K as s,U as t,me as u,se as v,I as w,E as x,F as y,P as z}
1
+ import{c as e,z as t}from"./p-ed9385f4.js";import{s as o,l as n,e as r,t as s,f as i,b as a}from"./p-a18adf27.js";import{l as d,b as l}from"./p-0a377722.js";import{h as c,l as u,f as m,g as v,a as p,s as h,j as y}from"./p-41dd1cb8.js";import{i as f}from"./p-f6922df5.js";import{g as w}from"./p-5beab541.js";const g=async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await c(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}},{reset:b,state:S}=e((()=>({amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:!1,isEnabled:!1,orderIdCreated:null,remainingBalance:null,useFullBalance:!0}))),C=()=>{b()},O=e=>{d("Store credit balance from session","info",e),S.availableBalance=e},A=async()=>{var e,t;const{errors:o,json:n}=await g();if(o.length||!n)return void u("Failed to refresh store credit balance");const r=null!==(t=null===(e=n.checkoutSession.customerProfile)||void 0===e?void 0:e.storeCreditBalance)&&void 0!==t?t:null;O(r)},I=async()=>{var e;const t=o.checkoutSessionId;if(!t){const e="No checkout session found";return u(e),S.error=e,{error:e,success:!1}}d("Applying store credit","info",{checkoutSessionId:t}),S.isApplying=!0,S.error=null;try{const{errors:o,json:n}=await c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:t},method:"POST"});if(o.length>0||!n){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}return S.appliedAmount=n.amountApplied,S.remainingBalance=n.remainingBalance,S.isApplying=!1,d("Store credit applied","info",{amountApplied:n.amountApplied,remainingBalance:n.remainingBalance}),{error:null,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to apply store credit";return u(t),S.error=t,S.isApplying=!1,{error:t,success:!1}}},k=e=>{S.isEnabled=e,S.error=null,e||(S.amountToApply=null)},N=e=>{if(null===e)return S.amountToApply=null,void(S.error=null);e<=0?S.error="Amount must be greater than zero":null!==S.availableBalance&&e>S.availableBalance?S.error="Amount exceeds available balance":e>we.total+(we.storeCredit||0)?S.error="Amount exceeds order total":(S.error=null,S.amountToApply=e)},T=e=>{if(S.useFullBalance=e,S.error=null,e&&null!==S.availableBalance){const e=Math.min(S.availableBalance,we.total+(we.storeCredit||0));S.amountToApply=e}else e||(S.amountToApply=null)},j=()=>S.isEnabled&&null!==S.availableBalance?S.useFullBalance?Math.min(S.availableBalance,we.total+(we.storeCredit||0)):S.amountToApply||0:0,E=()=>null!==S.amountToApply&&S.amountToApply>0&&we.storeCredit>0&&we.total<=0,P=async()=>{var e,t,n;const r=o.checkoutSessionId;if(!r){const e="No checkout session found";return u(e),S.error=e,{error:e,orderId:null,success:!1}}d("Creating store credit order","info",{checkoutSessionId:r});try{const{errors:o,json:s}=await c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:r},method:"POST"});if(o.length>0||!s){const t=(null===(e=o[0])||void 0===e?void 0:e.message)||"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}const i=(null===(n=null===(t=s.checkoutSessionStoreCreditOrderCreate)||void 0===t?void 0:t.order)||void 0===n?void 0:n.id)||null;return S.orderIdCreated=i,d("Store credit order created","info",{orderId:i}),{error:null,orderId:i,success:!0}}catch(e){const t=e instanceof Error?e.message:"Failed to create store credit order";return u(t),S.error=t,{error:t,orderId:null,success:!1}}},D=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const r=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=r[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||r.slice(1).join(" ").trim()||""}},L=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:v}=e.value.address,p=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[p])||p,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[v])||v}},x=e=>{var t;const s="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=q.stripeLinkEventData,a=q.stripeAddressEventData,d=q.stripeShippingSameAsBilling?q.stripeAddressEventData:q.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=L({currentAddress:a,translatedAddress:q.translatedAddress.address}),{firstName:c,lastName:u}=D({name:l.name}),m=L({currentAddress:d,translatedAddress:q.translatedAddress.address}),{firstName:v,lastName:p}=D({name:m.name}),h=r()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:v,lastName:p,phone:m.phone},cartCurrencyCode:null===(t=we.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||n.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:q.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!s,landedCostAdjustments:we.promoCode?[{amount:0,productId:null,promoCode:we.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:q.shortAddressCode,shipToTaxId:q.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},R=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=q.stripeLinkEventData,n=q.stripeAddressEventData,r=q.stripeShippingSameAsBilling?q.stripeAddressEventData:q.stripeBillingAddressEventData;if(d({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=L({currentAddress:n,translatedAddress:q.translatedAddress.address}),{firstName:i,lastName:a}=D({name:s.name}),l=L({currentAddress:r,translatedAddress:q.translatedAddress.address}),{firstName:c,lastName:u}=D({name:l.name}),m=we.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),v=we.promoCode?[{amount:0,productId:null,promoCode:we.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:q.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:s.phone},isTest:e,items:we.items,landedCostAdjustments:v,shipToShortAddressCode:q.shortAddressCode,shipToTaxId:q.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const z=async e=>{const o=window.Zonos.cartId;if(!o)return await(async e=>{var o;const n=t.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=R(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:m.vercel},{promoCode:we.promoCode});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:d,json:l}=await c("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!l||d.length)throw new Error(`Invalid landed cost object: ${(null===(s=d.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await c("/api/zonos-elements/calculate-landed-cost",{body:R(),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(e);const n=await(async({abortController:e,cartId:t})=>{var o,n,r,s,i;const{errors:a,json:d}=await c("/api/zonos-elements/cart-calculate-landed-cost",{body:x(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(r=a[0])||void 0===r?void 0:r.message.includes("signal is aborted"))||(null===(s=a[0])||void 0===s?void 0:s.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:e,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},U=async({checkoutSessionId:e,eventName:o,metadata:r})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:e,eventCreated:a,eventName:o});const u=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((v()||p()||u)&&!window.Zonos.zonosConversionTest)return;const m=n.selectedCountryCode,y=t.organizationId;if(!e)return void h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});y||h({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:l,checkoutSessionId:e,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});const f={checkoutSessionId:e,countryCode:m,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},r),{trackEventLogs:d}),organizationId:y};await c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})},_=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},B=e=>e.sort(((e,t)=>e.amount-t.amount)),F=async()=>{var e;const{errors:t,json:o}=await g();return t.length||!o?(u("Failed to retrieve checkout session info before confirming payment ",t),h({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:l}}),{errorMessage:s("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=o.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(u("Landed cost is not found in the checkout session before confirming payment."),h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}}),{errorMessage:s('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},J=({theme:e})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:t.appearance.fontSizeInputValue?`${t.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:t.appearance.fontSizeInputLabel?`${t.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===e?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},M=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:W,reset:$,state:q}=e((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),Y=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},H=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},K=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return y(e)},G=async e=>{var o,r;const s=q.clientSecret;if(!q.stripe)return void d("Skip. Stripe is not initialized");const i=(({clientSecret:e,overrideBorderRadius:o,overridePrimaryColor:r,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=r||t.appearance.colorPrimary,l=s||t.appearance.colorSecondary,c=(window.Zonos.isCollect||window.Zonos.isInvoice?"DARK"===t.appearance.theme:d&&f(d))?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},J({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},M({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:e||void 0,customerSessionClientSecret:q.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==e?void 0:e.overrideBorderRadius,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideSecondaryColor:null==e?void 0:e.overrideSecondaryColor,overrideTheme:null==e?void 0:e.overrideTheme,paypalEnabled:null==e?void 0:e.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(q.stripeElementsOptions);if(!q.stripeElements||!q.stripeElementsForBillingAddress)return q.stripeElementsForBillingAddress=null===(o=q.stripe)||void 0===o?void 0:o.elements(i),d("Stripe elements for billing address initialized"),q.stripeElements=null===(r=q.stripe)||void 0===r?void 0:r.elements(i),q.stripeElementsOptions=i,void d("Stripe elements initialized");a||(q.stripeElements.update(i),q.stripeElementsForBillingAddress.update(i),q.stripeElementsOptions=i,q.stripeElements.fetchUpdates()),d("Stripe elements updated")},V=()=>{sessionStorage.removeItem("zonos--client-secret"),$(),q.stripe=window.Zonos.stripe},Z=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const{firstName:i,lastName:a}=D({firstName:t,lastName:n,name:r});return i&&a||h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},Q=async()=>{var e,t,n,r;if(!(null===(e=q.stripeAddressEventData)||void 0===e?void 0:e.complete)||!q.stripeShippingSameAsBilling&&!(null===(t=q.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!q.stripeBillingAddressEventData)return{partiesCreated:!1};if(!we.landedCostData)return{partiesCreated:!1};const s=null===(n=we.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s,i,a;const d=null===(e=we.partiesData.find((e=>"DESTINATION"===e.type)))||void 0===e?void 0:e.id,l=null===(t=we.partiesData.find((e=>"PAYOR"===e.type)))||void 0===t?void 0:t.id;if(!d||!l)return!1;if(q.partyShippingId!==d||q.partyBillingId!==l)return!0;const c=JSON.stringify(null===(o=q.stripeLinkUsedWhenFetchingLC)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=q.stripeLinkEventData)||void 0===n?void 0:n.value),u=JSON.stringify(null===(r=q.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=q.stripeAddressEventData)||void 0===s?void 0:s.value),m=!q.stripeShippingSameAsBilling&&JSON.stringify(null===(i=q.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===i?void 0:i.value)!==JSON.stringify(null===(a=q.stripeBillingAddressEventData)||void 0===a?void 0:a.value);return c||u||m||q.taxIdUsedWhenAsyncAddressUpdate!==q.taxId||q.companyNameUsedWhenAsyncAddressUpdate!==q.companyName})();if(!i)return{partiesCreated:!1};const a=Z({address:q.stripeAddressEventData.value.address,firstName:q.stripeAddressEventData.value.firstName,lastName:q.stripeAddressEventData.value.lastName,name:q.stripeAddressEventData.value.name,phone:q.stripeAddressEventData.value.phone}),d=q.stripeShippingSameAsBilling?a:Z({address:q.stripeBillingAddressEventData.value.address,firstName:q.stripeBillingAddressEventData.value.firstName,lastName:q.stripeBillingAddressEventData.value.lastName,name:q.stripeBillingAddressEventData.value.name,phone:q.stripeBillingAddressEventData.value.phone}),m="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:v,json:p}=await c("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:q.companyName,email:(null===(r=q.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:m,rootId:s,shortAddressCode:q.shortAddressCode,taxId:q.taxId},method:"POST"});return v.length||!p?(u("Error occurs when creating parties",JSON.stringify(v,null,2)),h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:v,json:p}}),{partiesCreated:!1}):(q.companyNameUsedWhenAsyncAddressUpdate=q.companyName,q.stripeAddressUsedWhenAsyncAddressUpdate=q.stripeAddressEventData,q.stripeBillingAddressUsedWhenAsyncAddressUpdate=q.stripeBillingAddressEventData,q.taxIdUsedWhenAsyncAddressUpdate=q.taxId,q.partyBillingId=p.billToPartyId,q.partyShippingId=p.shipToPartyId,we.partiesData=we.partiesData.map((e=>"DESTINATION"===e.type&&e.id!==p.shipToPartyId?Object.assign(Object.assign({},e),{id:p.shipToPartyId}):"PAYOR"===e.type&&e.id!==p.billToPartyId?Object.assign(Object.assign({},e),{id:p.billToPartyId}):e)),{partiesCreated:!0})},X=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),ee=async e=>{var n,r,s,i;const a=(null==e?void 0:e.retries)||0,l=!!(null==e?void 0:e.applyingPromocode),c=(()=>{var e;const t=we.landedCostData&&(null===(e=we.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==we.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=q.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=q.stripeLinkEventData)||void 0===t?void 0:t.value),n=q.stripeAddressEventData&&JSON.stringify(X(q.stripeAddressEventData.value))!==JSON.stringify(q.stripeAddressUsedWhenFetchingLC),r=!q.stripeShippingSameAsBilling&&q.stripeBillingAddressEventData&&JSON.stringify(X(q.stripeBillingAddressEventData.value))!==JSON.stringify(q.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return d("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!we.landedCostData&&!q.isFetchingLandedCost||o||t})();if(!(()=>{var e,o,n,r;const s=!!(null===(e=q.stripeLinkEventData)||void 0===e?void 0:e.complete),i=!!(null===(o=q.stripeAddressEventData)||void 0===o?void 0:o.complete),a=q.stripeShippingSameAsBilling?i:!!(null===(n=q.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(e=>{var o,n;const r=null===(o=t.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=t.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===we.addressFormRenderType&&(s&&e in s?s[e]:null)||(r&&e in r?r[e]:null)})((null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&q.stripeAddressEventData?s&&q.stripeAddressEventData.value.firstName&&q.stripeAddressEventData.value.lastName&&q.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&q.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&q.stripeAddressEventData.value.address.postal_code.length>=3)&&q.stripeAddressEventData.value.phone&&q.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=q.fetchingLandedCostAbortController)||void 0===n||n.abort(),q.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};a?(q.isFetchingLandedCost=!1,setTimeout((()=>{q.isFetchingLandedCost=!0}),300)):q.isFetchingLandedCost=!0,q.stripeAddressEventData&&(q.stripeAddressUsedWhenFetchingLC={countryCode:q.stripeAddressEventData.value.address.country,postalCode:q.stripeAddressEventData.value.address.postal_code,state:q.stripeAddressEventData.value.address.state}),q.stripeBillingAddressEventData&&(q.stripeBillingAddressUsedWhenFetchingLC={countryCode:q.stripeBillingAddressEventData.value.address.country,postalCode:q.stripeBillingAddressEventData.value.address.postal_code,state:q.stripeBillingAddressEventData.value.address.state}),q.stripeLinkEventData&&(q.stripeLinkUsedWhenFetchingLC=Object.assign({},q.stripeLinkEventData));try{xe(),await(async()=>{var e;const t=new AbortController;q.fetchingLandedCostAbortController=t,xe();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await z(t);we.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,we.shippingData=B((null==d?void 0:d.filter(Boolean))||[]),Ce(s),q.fetchingLandedCostAbortController=null,we.partiesData=(null==a?void 0:a.filter(Boolean))||[],we.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&U({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=we.promoCodeApplied&&!we.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));we.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",we.promoCode)})();const e=null===(r=we.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=we.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ke({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(t){if(we.landedCostData=[],we.shippingData=[],t instanceof Error&&t.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(t.message)){if(a<1)return await ee(Object.assign(Object.assign({},e),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=q.stripeAddressEventData)||void 0===i?void 0:i.value;h({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[t.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}u(t)}return q.isFetchingLandedCost=!1,{isRequestNotReady:!1}},te=async()=>{var e,t;await ee({applyingPromocode:!0}),"payment"===we.step&&ze(),await Q();const o=null===(e=we.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=we.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await Pe({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},oe=()=>{we.promoCode="",sessionStorage.removeItem("zonos--promo-code"),we.promoCodeError=!1,we.promoCodeApplied=!1},ne=async()=>{"payment"===we.step&&ze(),oe(),await te()},re=e=>{let t=[],o=!0;const n=window.Zonos.isCollect,r=window.Zonos.isInvoice;switch(e){case"succeeded":t=[s("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",s("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],(n||r)&&(t=[s("Thank you for submitting your payment. We appreciate your prompt attention."),"",s("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[s("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[s("Payment failed. Please try another payment method.")],n&&(t=[s("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[s("Something went wrong.")]}return{isError:o,messages:t}},se=async()=>{var e,o;const{onInventoryCheck:n}=t.checkoutSettings,r=!!(null===(o=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&r){const{errors:e,json:t}=await c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(u("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(q.shouldInventoryRefund=!0,null):null:s("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:we.items},{translate:s,zonosApiRoute:m.vercel})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw h({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:we.items}}),e}},ie=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},ae=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=re(t);return{error:e,messages:o}}const o=e||q.clientSecret;if(!q.stripe||!o)return u("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[s("Something went wrong.")]};const{paymentIntent:n}=await q.stripe.retrievePaymentIntent(o),r=null==n?void 0:n.status,{isError:i,messages:a}=re(r);return{amount:null==n?void 0:n.amount,currency:null==n?void 0:n.currency,error:i,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:r}},de=async e=>{var t,n;const r=!!(null===(t=q.stripePaymentEventData)||void 0===t?void 0:t.complete),i=q.stripeElements,a=q.stripe,l=q.clientSecret;if(q.customErrorMessage=null,!(null===(n=we.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const c=await F();if(!c.valid)throw q.customErrorMessage=c.errorMessage,new Error(c.errorMessage);const u=o.checkoutSessionId;if(a&&i&&r&&l&&u){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",l),e.searchParams.set("zonosCheckoutSessionId",u),U({checkoutSessionId:u,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await a.confirmPayment({confirmParams:{return_url:e.toString()},elements:i,redirect:"if_required"});if(d("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(s("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(s("Payment failed. Please try another payment method."))}},le=()=>{var e;const t=we.items.reduce(((e,t)=>e+t.amount*t.quantity),0),r=o.enabledVariantTestKeys||[];return{adjustmentsAmount:we.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=we.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:we.customerAuthenticationToken||void 0,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:q.skipPaymentIntent,varianceTestInput:r}},ce=async()=>{var e;if(!o.checkoutSessionId)return h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}}),void Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});const{errors:t,json:n}=await c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),r=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!r)return u("Error occurs when getting payment intent",JSON.stringify(t,null,2)),h({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:r}}),void Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")});Te(n.checkoutSessionPaymentIntentCreate)},ue=async()=>{var e,t;if(!n.targetCurrency)return u("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;q.isFetchingSession=!0;const o=le();d("Checkout session body","info",o);const{errors:r,json:s}=await c("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(q.isFetchingSession=!1,r.length||!s){const t=null===(e=r.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return u("Error occurred when creating checkout session",JSON.stringify(r,null,2)),!1}const i=s.checkoutSessionCreate;return Te(i),ke({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),d("Exchange rate updated for cart items (checkout session create)","info",we.exchangeRate),d("done-init-checkout-session"),!0},me=async()=>{const e=o.checkoutSessionId;if(!e)return u("Failed to update checkout session base currency"),!1;if("LOCAL"===t.checkoutSettings.allowedSettlementCurrencies)return d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:q.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===q.checkoutSettlementCurrency?(d(`Updated checkout session to settlement currency "${r}".`),!0):(u("Failed to update checkout session base currency"),!1)},ve=async({adjustmentsAmount:e,cartId:t,currency:r,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d,storeCreditApplication:l})=>{const m=o.enabledVariantTestKeys||[],{errors:v,json:p}=await c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:q.partyBillingId,cartId:t,currency:r,customerAuthenticationToken:we.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:q.partyShippingId,skipPaymentIntent:q.skipPaymentIntent,storeCreditApplication:l,varianceTestInput:m},method:"POST"});return v.length||!p?(u("Error occurs when updating checkout session",JSON.stringify(v,null,2)),{errors:v,json:p}):{errors:[],json:p}},pe=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},he=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{const s=!!(null==o?void 0:o.complete);if(!s||!(r?s:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=D({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=D({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),v=u&&m?`${u} ${m}`:"",p=i.address,h=null==a?void 0:a.address;return{address:_({address:Object.assign(Object.assign({},p),{name:c}),invalidAdddressList:e}),billingAddress:r?void 0:_({address:h?Object.assign(Object.assign({},h),{name:v}):null,invalidAdddressList:t}),destinationCountry:p.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:q.stripeAddressEventData,stripeBillingAddressEventData:q.stripeBillingAddressEventData,stripeShippingSameAsBilling:q.stripeShippingSameAsBilling});if(!i)return void(q.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=q.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=q.stripeAddressEventData)||void 0===t?void 0:t.value),s=!q.stripeShippingSameAsBilling&&JSON.stringify(null===(o=q.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=q.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:l}=await c("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!l)return u("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(q.translatedAddress={address:{},billingAddress:{}});q.stripeAddressUsedWhenValidatingAddress=q.stripeAddressEventData,q.stripeBillingAddressUsedWhenValidatingAddress=q.stripeBillingAddressEventData;const m=null===(o=q.stripeAddressEventData)||void 0===o?void 0:o.value.address,v=null===(n=q.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;q.translatedAddress={address:m?pe({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:l.address||null}):{},billingAddress:q.stripeShippingSameAsBilling?{}:pe({currentAddress:Object.assign(Object.assign({},v),{name:null===(s=q.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:l.billingAddress||null})}};W("clientSecret",(e=>{e&&q.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:ye,reset:fe,state:we}=e((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:p(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ge=e=>{switch(e){case"DAYS":return s("days");case"WEEKS":return s("weeks");default:return s("business days")}},be=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ge(o.type)}:null},Se=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),Ce=e=>{d("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=we.items.find((t=>Se({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return we.restrictedItems=t,we.items=we.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>Se({item1:t,item2:e})))}))),{cartItems:we.items,restrictedItems:t}};let Oe=null;const Ae=()=>{o.checkoutSessionId=null,Oe&&(clearTimeout(Oe),Oe=null),C(),fe()},Ie=({messages:e,title:t})=>{Ae(),V(),we.step="error",we.error={messages:e,title:t}},ke=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{var n;we.exchangeRate=o.exchangeRate,we.adjustmentTotal=o.adjustments,we.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,we.storeCredit=null!==(n=o.storeCredit)&&void 0!==n?n:0,we.subtotal=o.items,we.total=o.total,we.currency=o.presentmentCurrencyCode,we.dutiesTaxesFeesEstimate=e||null},Ne=()=>!!we.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),Te=e=>{var t,n,r,s,c,u,m;q.clientSecret=e.clientSecret,q.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,q.customerProfile=e.customerProfile,we.checkoutSession=e,O(null!==(n=null===(t=e.customerProfile)||void 0===t?void 0:t.storeCreditBalance)&&void 0!==n?n:null),e.id||h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const v=i(e.varianceTestResults||[]);a(v);const p=(null===(c=null===(s=null===(r=we.checkoutSession)||void 0===r?void 0:r.metadata)||void 0===s?void 0:s.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===c?void 0:c.value)||(null===(m=null===(u=window.Zonos.cartData)||void 0===u?void 0:u.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===m?void 0:m.value)||null;p&&(d(`Found externalConfirmationPageURL: ${p}`),we.externalConfirmationPageURL=p)},je=async({adjustmentsAmount:e,cartId:t,currency:r,dutiesTaxesFeesEstimate:i,itemsAmount:a,landedCostId:l,shouldInitSessionOnFailure:c})=>{var m;if(l&&we.selectedLandedCost&&(ke({dutiesTaxesFeesEstimate:i,method:we.landedCostMethod,subtotals:we.selectedLandedCost.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",we.exchangeRate)),!o.checkoutSessionId)return d("Could not update cart total without checkout session id","info"),!1;const{errors:v,json:p}=await ve({adjustmentsAmount:e,billToPartyId:q.partyBillingId,cartId:t,currency:r,id:o.checkoutSessionId,itemsAmount:a,landedCostId:l,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:q.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(v.length>0||!p){if(u("Error occurs when updating checkout session."),c){d("Initiating checkout session on failure","info");const e=await ue();return d(`stripeStoreInitCheckoutSession: ${e}`),!!e||(Ie({messages:[s("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:s("Error creating Checkout")}),!1)}return!1}return l||(ke({method:(null===(m=p.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:p.checkoutSessionUpdate.subtotals}),d("Exchange rate updated for cart items (checkout session update)","info",we.exchangeRate)),Te(p.checkoutSessionUpdate),!0},Ee=e=>{var o,n,r;return"DAP"===e.method&&(null===(n=null===(o=t.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(r=q.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US"))||"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method},Pe=async({applySubtotalsOnly:e,landedCostId:n,selectedShippingOption:r})=>{var s,i,a,l,c,u,m,v,p,h,y;d("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:r}),we.selectedShippingOption=r;const f=be(we.selectedShippingOption);if(f){const{maxTransit:e,minTransit:t,unit:o}=f;we.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else we.selectedShippingOptionTransitTime="";const w=null===(s=we.landedCostData)||void 0===s?void 0:s.find((e=>e.landedCostId===n));if(we.selectedLandedCost=w||null,!w)return!1;const g=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;g&&d(`DAP quote, using estimate: ${g}`,"info"),we.landedCostMethod=Ee(w.landedCost),we.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(c=null===(l=null==w?void 0:w.landedCost)||void 0===l?void 0:l.deMinimis)||void 0===c?void 0:c.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));we.isSelectedShippingAboveDeminimis=S,we.isSelectedShippingGuarantee=b;let C=!1;e?(ke({dutiesTaxesFeesEstimate:g,method:we.landedCostMethod,subtotals:w.subtotals}),d("Exchange rate updated for cart items (landed cost subtotal)","info",we.exchangeRate),C=!0):C=await je({adjustmentsAmount:we.adjustmentTotal,billToPartyId:q.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(u=w.landedCost)||void 0===u?void 0:u.id,shipToPartyId:q.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(m=we.items.find(Boolean))||void 0===m?void 0:m.currencyCode,A=(null===(v=q.stripeAddressEventData)||void 0===v?void 0:v.value.address.country)||"US";return q.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===t.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=we.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(h=t.genericSettings)||void 0===h?void 0:h.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},De=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;d(`==START CHECKOUT TIMEOUT - ${n}==`),we.checkoutTimeoutInterval=setTimeout((()=>{we.checkoutSessionTimeoutShow=!0}),n)},Le=()=>{we.checkoutTimeoutInterval&&(clearTimeout(we.checkoutTimeoutInterval),we.checkoutTimeoutInterval=null)},xe=()=>{we.items=we.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),we.restrictedItems=[]},Re=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:r=!0})=>{var s;we.adjustments=e,we.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(s=t.find(Boolean))||void 0===s?void 0:s.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(we.currency=i,q.isFetchingSession=!0,await je({adjustmentsAmount:d,billToPartyId:q.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:q.partyShippingId,shouldInitSessionOnFailure:r,varianceTestInput:o.enabledVariantTestKeys||[]}),q.isFetchingSession=!1)},ze=()=>{"shipping"===we.step?(we.step="customer-info",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})})):"payment"===we.step?(we.step="shipping",we.tabItems=Object.assign(Object.assign({},we.tabItems),{shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})})):"finish"===we.step&&(we.step="payment",we.tabItems=Object.assign(Object.assign({},we.tabItems),{payment:Object.assign(Object.assign({},we.tabItems.payment),{isDone:!1})}))},Ue=()=>{"customer-info"===we.step?(we.step="shipping",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems["customer-info"]),{isDone:!0})})):"shipping"===we.step?(we.step="payment",we.tabItems=Object.assign(Object.assign({},we.tabItems),{shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!0})})):"payment"===we.step&&(we.step="finish")},_e=()=>{we.step="customer-info",we.tabItems=Object.assign(Object.assign({},we.tabItems),{"customer-info":Object.assign(Object.assign({},we.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},we.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},we.tabItems.shipping),{isDone:!1})}),we.selectedShippingOption=null,we.isSelectedShippingAboveDeminimis=!1,we.isSelectedShippingGuarantee=!1,we.selectedShippingOptionTransitTime="",we.dutiesTaxesFees=0,we.dutiesTaxesFeesEstimate=0,we.shipping=0,we.total=we.subtotal},Be=()=>{Oe&&clearTimeout(Oe),Oe=setTimeout((()=>{Oe=null,(async()=>{var e,t;if(!o.checkoutSessionId)return void d("Could not update store credit without checkout session id","info");const r=we.selectedLandedCost,s=we.currency||(null===(e=we.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",i=we.adjustments.reduce(((e,t)=>e+t.amount),0),a=we.items.reduce(((e,t)=>e+t.amount*t.quantity),0),{errors:l,json:c}=await ve({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:s,id:o.checkoutSessionId,itemsAmount:a,landedCostId:null==r?void 0:r.landedCostId,presentmentCountryCode:n.selectedCountryCode,storeCreditApplication:S.isEnabled&&null!==S.amountToApply?S.useFullBalance?{mode:"FULL"}:{amount:S.amountToApply,mode:"PARTIAL"}:{mode:"NONE"}});l.length>0||!c?u("Error updating checkout session with store credit"):(ke({method:(null===(t=c.checkoutSessionUpdate.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals}),Te(c.checkoutSessionUpdate))})()}),300)};export{de as A,ie as B,V as C,ye as D,W as E,j as F,Z as G,Pe as H,Ne as I,te as J,ne as K,oe as L,re as M,S as N,C as O,he as P,D as Q,Q as R,be as S,Ee as T,B as U,k as V,T as W,Be as X,N as Y,A as Z,H as a,q as b,ae as c,we as d,Re as e,Ae as f,_e as g,Le as h,G as i,ue as j,ce as k,De as l,le as m,Ie as n,Y as o,Te as p,ee as q,Ue as r,K as s,U as t,me as u,se as v,I as w,E as x,F as y,P as z}