@zonos/elements 1.3.218 → 1.3.220

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 (395) hide show
  1. package/dist/cjs/buildCartItemsByTempCart-309fcebf.js +28 -0
  2. package/dist/cjs/{cart-c54d05ce.js → cart-9a9ae4b9.js} +90 -47
  3. package/dist/cjs/cleanHtmlMarkdown-577d0a77.js +999 -0
  4. package/dist/cjs/index.cjs.js +19 -9
  5. package/dist/cjs/isCollectMobileTablet-7a9413e3.js +175 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/localization-0169b27d.js +738 -0
  8. package/dist/cjs/{paypal-d36b5dd1.js → paypal-9ee374a0.js} +12 -8
  9. package/dist/cjs/placeTestOrder-0dfff170.js +93 -0
  10. package/dist/cjs/{localization-ab7e1902.js → translationStore-0c67178f.js} +1023 -734
  11. package/dist/cjs/zonos-address_11.cjs.entry.js +116 -74
  12. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  13. package/dist/cjs/{zonos-banner.cjs.entry.js → zonos-banner_2.cjs.entry.js} +40 -0
  14. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  15. package/dist/cjs/{zonos-cart-items_14.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +70 -1292
  16. package/dist/cjs/zonos-checkout.cjs.entry.js +25 -48
  17. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +92 -0
  19. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +811 -0
  20. package/dist/cjs/zonos-collect.cjs.entry.js +468 -0
  21. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  22. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +168 -0
  23. package/dist/cjs/zonos-controller.cjs.entry.js +84 -28
  24. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -1
  25. package/dist/cjs/zonos-country-select_4.cjs.entry.js +11 -10
  26. package/dist/cjs/zonos-elements.cjs.js +1 -1
  27. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +23 -5
  28. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +34 -33
  29. package/dist/cjs/zonos-hello.cjs.entry.js +8 -7
  30. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  31. package/dist/cjs/zonos-language-select_2.cjs.entry.js +6 -5
  32. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  33. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  34. package/dist/cjs/zonos-stripe-input.cjs.entry.js +8 -5
  35. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  36. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  37. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  38. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  39. package/dist/collection/collection-manifest.json +10 -0
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
  41. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +5 -1
  42. package/dist/collection/components/checkout/zonos-collect/assets/ChevronDownIcon.svg +1 -0
  43. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/assets/empty-item.jpeg +0 -0
  44. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.css +60 -0
  45. package/dist/collection/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.js +39 -0
  46. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/RemoveIcon.svg +1 -0
  47. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/assets/SuccessIcon.svg +1 -0
  48. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.css +90 -0
  49. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +405 -0
  50. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/chevronDownIcon.svg +1 -0
  51. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/globe.svg +3 -0
  52. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconDark.svg +10 -0
  53. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosIconLight.svg +10 -0
  54. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/assets/zonosWordmark.svg +7 -0
  55. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.css +152 -0
  56. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +164 -0
  57. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronDownIcon.svg +1 -0
  58. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/assets/ChevronUpIcon.svg +1 -0
  59. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.css +109 -0
  60. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +194 -0
  61. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/CheckmarkLineIcon.svg +1 -0
  62. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/assets/RemoveLineIcon.svg +1 -0
  63. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.css +98 -0
  64. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +369 -0
  65. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.css +71 -0
  66. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +151 -0
  67. package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.css +78 -0
  68. package/dist/collection/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.js +115 -0
  69. package/dist/collection/components/checkout/zonos-collect/zonos-collect.css +349 -0
  70. package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +547 -0
  71. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  72. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  73. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  74. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  75. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  76. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  77. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  78. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  79. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  80. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  81. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.css +38 -0
  82. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +63 -0
  83. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  84. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  85. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  86. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  87. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  88. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  89. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  90. package/dist/collection/components/common/zonos-skeleton/assets/RemoveLineIcon.svg +3 -0
  91. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.css +40 -0
  92. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +102 -0
  93. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +8 -5
  94. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  95. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  96. package/dist/collection/components/common/zonos-text/zonos-text.css +1 -0
  97. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  98. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  99. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  100. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  101. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  102. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  103. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  104. package/dist/collection/components/main/zonos-controller.js +91 -25
  105. package/dist/collection/components/paypal/zonos-paypal-payment.js +13 -2
  106. package/dist/collection/components/store/checkout/cart.js +36 -15
  107. package/dist/collection/components/store/checkout/collect.js +160 -0
  108. package/dist/collection/components/store/checkout/paypal.js +4 -2
  109. package/dist/collection/components/store/checkout/stripe.js +31 -12
  110. package/dist/collection/components/store/translationStore/strings.arabic.js +51 -0
  111. package/dist/collection/components/store/translationStore/strings.base.js +51 -0
  112. package/dist/collection/components/store/translationStore/strings.chinese.js +51 -0
  113. package/dist/collection/components/store/translationStore/strings.danish.js +51 -0
  114. package/dist/collection/components/store/translationStore/strings.dutch.js +51 -0
  115. package/dist/collection/components/store/translationStore/strings.french.js +51 -0
  116. package/dist/collection/components/store/translationStore/strings.german.js +51 -0
  117. package/dist/collection/components/store/translationStore/strings.hebrew.js +51 -0
  118. package/dist/collection/components/store/translationStore/strings.indonesian.js +51 -0
  119. package/dist/collection/components/store/translationStore/strings.italian.js +51 -0
  120. package/dist/collection/components/store/translationStore/strings.japanese.js +51 -0
  121. package/dist/collection/components/store/translationStore/strings.korean.js +51 -0
  122. package/dist/collection/components/store/translationStore/strings.norwegian.js +51 -0
  123. package/dist/collection/components/store/translationStore/strings.polish.js +51 -0
  124. package/dist/collection/components/store/translationStore/strings.portuguese.js +51 -0
  125. package/dist/collection/components/store/translationStore/strings.russian.js +51 -0
  126. package/dist/collection/components/store/translationStore/strings.spanish.js +51 -0
  127. package/dist/collection/components/store/translationStore/strings.swedish.js +51 -0
  128. package/dist/collection/components/store/translationStore/strings.turkish.js +51 -0
  129. package/dist/collection/components/store/translationStore/strings.vietnamese.js +51 -0
  130. package/dist/collection/components/store/translationStore.js +2 -1
  131. package/dist/collection/components/stripe/zonos-address/zonos-address.js +35 -18
  132. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  133. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  134. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +29 -4
  135. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +9 -1
  136. package/dist/collection/components/utils/checkout/initCollect.js +15 -0
  137. package/dist/collection/components/utils/checkout/isCollectMobileTablet.js +10 -0
  138. package/dist/collection/components/utils/checkout/renderCheckoutCurrency.js +10 -1
  139. package/dist/collection/components/utils/renderFallback.js +7 -0
  140. package/dist/collection/scripts/_getZonosQaUrl.js +5 -1
  141. package/dist/collection/scripts/_zonosBase.js +7 -1
  142. package/dist/collection/types/checkout/api/PartyInfo.js +1 -0
  143. package/dist/collection/types/generated/graphql.internal.types.js +113 -0
  144. package/dist/collection/types/index.js +1 -0
  145. package/dist/esm/buildCartItemsByTempCart-c4488f73.js +26 -0
  146. package/dist/esm/{cart-bb0ee971.js → cart-b2dd578c.js} +68 -27
  147. package/dist/esm/cleanHtmlMarkdown-b5b18743.js +997 -0
  148. package/dist/esm/index.js +19 -9
  149. package/dist/esm/isCollectMobileTablet-7f9a5e2b.js +168 -0
  150. package/dist/esm/loader.js +1 -1
  151. package/dist/esm/localization-d7125e4e.js +719 -0
  152. package/dist/esm/{paypal-bd4520eb.js → paypal-555bbf1e.js} +7 -4
  153. package/dist/esm/placeTestOrder-2d67c1a9.js +90 -0
  154. package/dist/esm/{localization-d8326254.js → translationStore-13502f49.js} +1023 -718
  155. package/dist/esm/zonos-address_11.entry.js +85 -43
  156. package/dist/esm/zonos-badge.entry.js +3 -3
  157. package/dist/esm/{zonos-banner.entry.js → zonos-banner_2.entry.js} +40 -1
  158. package/dist/esm/zonos-button_3.entry.js +3 -3
  159. package/dist/esm/{zonos-cart-items_14.entry.js → zonos-cart-items_12.entry.js} +20 -1240
  160. package/dist/esm/zonos-checkout.entry.js +6 -29
  161. package/dist/esm/zonos-collapse.entry.js +2 -2
  162. package/dist/esm/zonos-collect-cart-items_3.entry.js +86 -0
  163. package/dist/esm/zonos-collect-finish_6.entry.js +802 -0
  164. package/dist/esm/zonos-collect.entry.js +464 -0
  165. package/dist/esm/zonos-component.entry.js +1 -1
  166. package/dist/esm/zonos-confirm-dialog_2.entry.js +163 -0
  167. package/dist/esm/zonos-controller.entry.js +84 -28
  168. package/dist/esm/zonos-country-flag.entry.js +2 -1
  169. package/dist/esm/zonos-country-select_4.entry.js +11 -10
  170. package/dist/esm/zonos-elements.js +1 -1
  171. package/dist/esm/zonos-empty-state-payment_4.entry.js +23 -5
  172. package/dist/esm/zonos-hello-dialog.entry.js +6 -5
  173. package/dist/esm/zonos-hello.entry.js +2 -1
  174. package/dist/esm/zonos-input.entry.js +4 -4
  175. package/dist/esm/zonos-language-select_2.entry.js +6 -5
  176. package/dist/esm/zonos-link.entry.js +1 -1
  177. package/dist/esm/zonos-logo.entry.js +2 -2
  178. package/dist/esm/zonos-stripe-input.entry.js +9 -6
  179. package/dist/esm/zonos-text.entry.js +1 -1
  180. package/dist/esm/zonos-toggle.entry.js +2 -2
  181. package/dist/esm/zonos-tooltip.entry.js +2 -2
  182. package/dist/esm/zonos-v-stack.entry.js +2 -2
  183. package/dist/esm-es5/buildCartItemsByTempCart-c4488f73.js +1 -0
  184. package/dist/esm-es5/cart-b2dd578c.js +1 -0
  185. package/dist/esm-es5/cleanHtmlMarkdown-b5b18743.js +1 -0
  186. package/dist/esm-es5/index.js +1 -1
  187. package/dist/esm-es5/isCollectMobileTablet-7f9a5e2b.js +1 -0
  188. package/dist/esm-es5/loader.js +1 -1
  189. package/dist/esm-es5/localization-d7125e4e.js +1 -0
  190. package/dist/esm-es5/paypal-555bbf1e.js +17 -0
  191. package/dist/esm-es5/placeTestOrder-2d67c1a9.js +1 -0
  192. package/dist/esm-es5/translationStore-13502f49.js +1 -0
  193. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  194. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  195. package/dist/esm-es5/zonos-banner_2.entry.js +1 -0
  196. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  197. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
  198. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  199. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  200. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -0
  201. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -0
  202. package/dist/esm-es5/zonos-collect.entry.js +1 -0
  203. package/dist/esm-es5/zonos-component.entry.js +1 -1
  204. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -0
  205. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  206. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  207. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  208. package/dist/esm-es5/zonos-elements.js +1 -1
  209. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  210. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  211. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  212. package/dist/esm-es5/zonos-input.entry.js +1 -1
  213. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  214. package/dist/esm-es5/zonos-link.entry.js +1 -1
  215. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  216. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  217. package/dist/esm-es5/zonos-text.entry.js +1 -1
  218. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  219. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  220. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  221. package/dist/scripts/index.d.ts +470 -2
  222. package/dist/scripts/index.js +1 -1
  223. package/dist/scripts/loadZonos.js +1 -1
  224. package/dist/scripts/zonos.js +1 -1
  225. package/dist/types/components/checkout/zonos-collect/zonos-collect-cart-items/zonos-collect-cart-items.d.ts +4 -0
  226. package/dist/types/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.d.ts +50 -0
  227. package/dist/types/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.d.ts +25 -0
  228. package/dist/types/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.d.ts +29 -0
  229. package/dist/types/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.d.ts +62 -0
  230. package/dist/types/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.d.ts +22 -0
  231. package/dist/types/components/checkout/zonos-collect/zonos-collect-subtotal/zonos-collect-subtotal.d.ts +10 -0
  232. package/dist/types/components/checkout/zonos-collect/zonos-collect.d.ts +86 -0
  233. package/dist/types/components/common/zonos-h-stack/zonos-h-stack.d.ts +9 -0
  234. package/dist/types/components/common/zonos-skeleton/zonos-skeleton.d.ts +17 -0
  235. package/dist/types/components/main/zonos-controller.d.ts +5 -0
  236. package/dist/types/components/paypal/zonos-paypal-payment.d.ts +3 -0
  237. package/dist/types/components/store/checkout/cart.d.ts +23 -3
  238. package/dist/types/components/store/checkout/collect.d.ts +21 -0
  239. package/dist/types/components/store/checkout/paypal.d.ts +4 -3
  240. package/dist/types/components/store/checkout/stripe.d.ts +6 -2
  241. package/dist/types/components/store/translationStore/strings.arabic.d.ts +51 -0
  242. package/dist/types/components/store/translationStore/strings.base.d.ts +51 -0
  243. package/dist/types/components/store/translationStore/strings.chinese.d.ts +51 -0
  244. package/dist/types/components/store/translationStore/strings.danish.d.ts +51 -0
  245. package/dist/types/components/store/translationStore/strings.dutch.d.ts +51 -0
  246. package/dist/types/components/store/translationStore/strings.french.d.ts +51 -0
  247. package/dist/types/components/store/translationStore/strings.german.d.ts +51 -0
  248. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +51 -0
  249. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +51 -0
  250. package/dist/types/components/store/translationStore/strings.italian.d.ts +51 -0
  251. package/dist/types/components/store/translationStore/strings.japanese.d.ts +51 -0
  252. package/dist/types/components/store/translationStore/strings.korean.d.ts +51 -0
  253. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +51 -0
  254. package/dist/types/components/store/translationStore/strings.polish.d.ts +51 -0
  255. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +51 -0
  256. package/dist/types/components/store/translationStore/strings.russian.d.ts +51 -0
  257. package/dist/types/components/store/translationStore/strings.spanish.d.ts +51 -0
  258. package/dist/types/components/store/translationStore/strings.swedish.d.ts +51 -0
  259. package/dist/types/components/store/translationStore/strings.turkish.d.ts +51 -0
  260. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +51 -0
  261. package/dist/types/components/store/translationStore.d.ts +2 -1
  262. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +1 -2
  263. package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +3 -1
  264. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  265. package/dist/types/components/utils/checkout/initCollect.d.ts +1 -0
  266. package/dist/types/components/utils/checkout/isCollectMobileTablet.d.ts +4 -0
  267. package/dist/types/components/utils/renderFallback.d.ts +6 -0
  268. package/dist/types/components.d.ts +401 -2
  269. package/dist/types/scripts/_zonosBase.d.ts +5 -0
  270. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
  271. package/dist/types/types/checkout/api/CheckoutSession.d.ts +9 -1
  272. package/dist/types/types/checkout/api/CreateParty.d.ts +24 -0
  273. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +6 -1
  274. package/dist/types/types/checkout/api/PartyInfo.d.ts +24 -0
  275. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  276. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  277. package/dist/types/types/generated/graphql.internal.types.d.ts +616 -5
  278. package/dist/types/types/generated/graphql.internal.types.ts +626 -6
  279. package/dist/types/types/index.d.ts +1 -0
  280. package/dist/zonos-elements/index.esm.js +1 -1
  281. package/dist/zonos-elements/{p-7b5de646.entry.js → p-02667a58.entry.js} +1 -1
  282. package/dist/zonos-elements/p-031d646e.system.js +1 -0
  283. package/dist/zonos-elements/p-0e07e1d6.entry.js +1 -0
  284. package/dist/zonos-elements/p-0ef2a242.js +1 -0
  285. package/dist/zonos-elements/p-126087a2.system.entry.js +1 -0
  286. package/dist/zonos-elements/{p-c7d5d45d.entry.js → p-14f9bc8c.entry.js} +1 -1
  287. package/dist/zonos-elements/p-27d9abab.js +1 -0
  288. package/dist/zonos-elements/p-2813d72e.system.js +1 -0
  289. package/dist/zonos-elements/p-295d9c07.system.entry.js +1 -0
  290. package/dist/zonos-elements/p-29c80a34.js +1 -0
  291. package/dist/zonos-elements/p-2a6c964d.js +1 -0
  292. package/dist/zonos-elements/p-2b3c7c77.system.entry.js +1 -0
  293. package/dist/zonos-elements/p-2b8897d1.system.entry.js +1 -0
  294. package/dist/zonos-elements/{p-544c173a.system.entry.js → p-30432622.system.entry.js} +1 -1
  295. package/dist/zonos-elements/p-3462e9e4.system.entry.js +1 -0
  296. package/dist/zonos-elements/p-372c2fc5.entry.js +1 -0
  297. package/dist/zonos-elements/p-3c1b1be1.system.entry.js +1 -0
  298. package/dist/zonos-elements/p-40a4266f.js +1 -0
  299. package/dist/zonos-elements/{p-47ffacd8.system.entry.js → p-421dfb66.system.entry.js} +1 -1
  300. package/dist/zonos-elements/{p-288761b1.system.entry.js → p-4f8563ad.system.entry.js} +1 -1
  301. package/dist/zonos-elements/p-52d35358.system.entry.js +1 -0
  302. package/dist/zonos-elements/p-567f7de7.entry.js +1 -0
  303. package/dist/zonos-elements/p-5d9410da.entry.js +1 -0
  304. package/dist/zonos-elements/p-637b22ee.system.entry.js +1 -0
  305. package/dist/zonos-elements/p-63a42823.entry.js +1 -0
  306. package/dist/zonos-elements/p-69451a50.system.js +1 -0
  307. package/dist/zonos-elements/p-6b3a0874.entry.js +1 -0
  308. package/dist/zonos-elements/p-73c1e91f.js +1 -0
  309. package/dist/zonos-elements/p-759ef3ca.entry.js +1 -0
  310. package/dist/zonos-elements/p-79d8c3f3.system.entry.js +1 -0
  311. package/dist/zonos-elements/{p-3f31901f.entry.js → p-7c4e7651.entry.js} +1 -1
  312. package/dist/zonos-elements/{p-1c45cd15.entry.js → p-7d2d2c94.entry.js} +1 -1
  313. package/dist/zonos-elements/{p-1ac8bfbb.system.entry.js → p-7e5bd9af.system.entry.js} +1 -1
  314. package/dist/zonos-elements/p-7ecbb2cb.entry.js +1 -0
  315. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  316. package/dist/zonos-elements/p-82e88a33.system.js +1 -0
  317. package/dist/zonos-elements/p-849b47aa.entry.js +1 -0
  318. package/dist/zonos-elements/p-8dd47520.system.entry.js +1 -0
  319. package/dist/zonos-elements/p-932600b7.js +1 -0
  320. package/dist/zonos-elements/p-960e0ab1.system.entry.js +1 -0
  321. package/dist/zonos-elements/p-9c5b8239.system.js +1 -0
  322. package/dist/zonos-elements/{p-d55aec11.system.entry.js → p-9fdd3264.system.entry.js} +1 -1
  323. package/dist/zonos-elements/p-a08a005d.entry.js +1 -0
  324. package/dist/zonos-elements/p-a10de7fb.entry.js +1 -0
  325. package/dist/zonos-elements/p-a49b5e7f.system.entry.js +1 -0
  326. package/dist/zonos-elements/{p-62813488.entry.js → p-a5b0a636.entry.js} +1 -1
  327. package/dist/zonos-elements/p-a61a9b65.system.entry.js +1 -0
  328. package/dist/zonos-elements/{p-d6fa2dc2.entry.js → p-a77ed1b9.entry.js} +1 -1
  329. package/dist/zonos-elements/{p-eeb01de6.system.entry.js → p-a800965d.system.entry.js} +1 -1
  330. package/dist/zonos-elements/p-b2ae8eb7.system.js +1 -0
  331. package/dist/zonos-elements/p-b3d5bcf9.entry.js +1 -0
  332. package/dist/zonos-elements/{p-da4c01da.system.entry.js → p-b669050d.system.entry.js} +1 -1
  333. package/dist/zonos-elements/p-b9e9b82f.system.entry.js +1 -0
  334. package/dist/zonos-elements/{p-714c28b1.system.entry.js → p-ba18c5f5.system.entry.js} +1 -1
  335. package/dist/zonos-elements/p-bbf48b31.entry.js +1 -0
  336. package/dist/zonos-elements/{p-77666360.entry.js → p-c4b3c878.entry.js} +1 -1
  337. package/dist/zonos-elements/p-c7b57886.js +17 -0
  338. package/dist/zonos-elements/p-c803753e.entry.js +1 -0
  339. package/dist/zonos-elements/{p-e640e8b8.entry.js → p-cbb01de9.entry.js} +1 -1
  340. package/dist/zonos-elements/p-ce15d62d.system.js +1 -0
  341. package/dist/zonos-elements/p-d291e964.system.entry.js +1 -0
  342. package/dist/zonos-elements/p-d3485a03.system.js +1 -0
  343. package/dist/zonos-elements/{p-59eaebe3.system.entry.js → p-de626806.system.entry.js} +1 -1
  344. package/dist/zonos-elements/p-e5388438.system.entry.js +1 -0
  345. package/dist/zonos-elements/p-e77b6e42.entry.js +1 -0
  346. package/dist/zonos-elements/p-ea8aff21.system.js +17 -0
  347. package/dist/zonos-elements/{p-7ab62a26.system.entry.js → p-eb6a35ce.system.entry.js} +1 -1
  348. package/dist/zonos-elements/{p-92cc26b7.system.entry.js → p-ee6f8c02.system.entry.js} +1 -1
  349. package/dist/zonos-elements/{p-a98b1e8d.entry.js → p-efa6203f.entry.js} +1 -1
  350. package/dist/zonos-elements/{p-edc77ea1.entry.js → p-f4fa8720.entry.js} +1 -1
  351. package/dist/zonos-elements/{p-ebaaaee9.entry.js → p-fa90adb8.entry.js} +1 -1
  352. package/dist/zonos-elements/p-fe7e2dc4.entry.js +1 -0
  353. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  354. package/package.json +1 -1
  355. package/dist/cjs/zonos-card.cjs.entry.js +0 -49
  356. package/dist/esm/zonos-card.entry.js +0 -45
  357. package/dist/esm-es5/cart-bb0ee971.js +0 -1
  358. package/dist/esm-es5/localization-d8326254.js +0 -1
  359. package/dist/esm-es5/paypal-bd4520eb.js +0 -17
  360. package/dist/esm-es5/zonos-banner.entry.js +0 -1
  361. package/dist/esm-es5/zonos-card.entry.js +0 -1
  362. package/dist/esm-es5/zonos-cart-items_14.entry.js +0 -1
  363. package/dist/zonos-elements/p-043f57e8.system.entry.js +0 -1
  364. package/dist/zonos-elements/p-0631d2b9.js +0 -1
  365. package/dist/zonos-elements/p-0a6ac265.system.js +0 -1
  366. package/dist/zonos-elements/p-0f041dc5.system.entry.js +0 -1
  367. package/dist/zonos-elements/p-1432a217.system.entry.js +0 -1
  368. package/dist/zonos-elements/p-1b51b738.system.entry.js +0 -1
  369. package/dist/zonos-elements/p-3a1513ae.system.entry.js +0 -1
  370. package/dist/zonos-elements/p-3b8d11dd.entry.js +0 -1
  371. package/dist/zonos-elements/p-4333afcb.entry.js +0 -1
  372. package/dist/zonos-elements/p-4d0d89da.system.entry.js +0 -1
  373. package/dist/zonos-elements/p-5dd9cb44.system.entry.js +0 -1
  374. package/dist/zonos-elements/p-605a21ac.entry.js +0 -1
  375. package/dist/zonos-elements/p-674981ad.system.js +0 -1
  376. package/dist/zonos-elements/p-6d090b53.entry.js +0 -1
  377. package/dist/zonos-elements/p-73c8c551.system.entry.js +0 -1
  378. package/dist/zonos-elements/p-795d223d.entry.js +0 -1
  379. package/dist/zonos-elements/p-8218ff62.system.entry.js +0 -1
  380. package/dist/zonos-elements/p-82f80c8a.entry.js +0 -1
  381. package/dist/zonos-elements/p-88f7256d.js +0 -1
  382. package/dist/zonos-elements/p-8b083884.entry.js +0 -1
  383. package/dist/zonos-elements/p-a449940d.entry.js +0 -1
  384. package/dist/zonos-elements/p-a5a4ad2f.entry.js +0 -1
  385. package/dist/zonos-elements/p-a5d45585.system.entry.js +0 -1
  386. package/dist/zonos-elements/p-a751e819.system.entry.js +0 -1
  387. package/dist/zonos-elements/p-ad556be6.entry.js +0 -1
  388. package/dist/zonos-elements/p-b4792af0.entry.js +0 -1
  389. package/dist/zonos-elements/p-b9ff6458.entry.js +0 -1
  390. package/dist/zonos-elements/p-d3dbae8c.system.js +0 -1
  391. package/dist/zonos-elements/p-ebb9b902.system.js +0 -17
  392. package/dist/zonos-elements/p-ef1ce617.system.entry.js +0 -1
  393. package/dist/zonos-elements/p-ef75da6f.js +0 -17
  394. package/dist/zonos-elements/p-f3dbe934.entry.js +0 -1
  395. package/dist/zonos-elements/p-f741407e.system.entry.js +0 -1
@@ -2,11 +2,12 @@ import { r as registerInstance, h, H as Host, a as getElement, c as createEvent
2
2
  import { f as zonosStoreFontFamily } from './zonosStore-c456b933.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-87593ff4.js';
5
- import { c as stripeStore, t as trackConversionEvent } from './cart-bb0ee971.js';
6
- import { s as storageStore } from './localization-d8326254.js';
5
+ import { c as stripeStore, t as trackConversionEvent } from './cart-b2dd578c.js';
6
+ import { s as storageStore } from './localization-d7125e4e.js';
7
7
  import { b as logError, l as log } from './handleFetch-99218189.js';
8
- import { d as paypalStoreInitButtons } from './paypal-bd4520eb.js';
8
+ import { d as paypalStoreInitButtons, e as paypalStoreOnChange } from './paypal-555bbf1e.js';
9
9
  import './VarianceTest-fef2d958.js';
10
+ import './translationStore-13502f49.js';
10
11
  import './isDarkColor-1f58b6be.js';
11
12
 
12
13
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -179,12 +180,20 @@ const ZonosPayment = class {
179
180
  }
180
181
  }
181
182
  watchInitStripe() {
183
+ var _a;
182
184
  if (!this.stripeElements) {
183
185
  return;
184
186
  }
185
187
  // Create and mount the Authentication Element in ${type} mode
186
188
  const paymentElement = stripeStore.stripePaymentElement ||
187
189
  this.stripeElements.create('payment', {
190
+ defaultValues: {
191
+ billingDetails: {
192
+ address: {
193
+ country: (_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country,
194
+ },
195
+ },
196
+ },
188
197
  layout: 'tabs',
189
198
  });
190
199
  const paymentElementContainer = this.el.querySelector('.zonos--payment-component');
@@ -207,7 +216,7 @@ const ZonosPayment = class {
207
216
  }
208
217
  render() {
209
218
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
210
- return (h(Host, { key: '7210a20afba18d167a6e7d875ba23daa0db774e4', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '4f043b3149cca48d2f4463a826541ebe35d0b6ca', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '15721e208e90b969c075877680a02dca5bb81689', class: "zonos--payment-component" }), h("div", { key: '36d5767821464db479feff18e6368e862550c777', class: "zonos--payment-paypal-container" })));
219
+ return (h(Host, { key: 'c0b27f25785a9f6de2705e16d97f1bf5f7bcb0a4', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '1cfdb16f94a5219882da9da013a6e2de6a6b3c3f', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: 'bb5ac07b4c32f2469f4825426160542d9729d332', class: "zonos--payment-component" }), h("div", { key: '34f805b56fa151e8a3102361df9fb8b3e636dc75', class: "zonos--payment-paypal-container" })));
211
220
  }
212
221
  get el() { return getElement(this); }
213
222
  static get watchers() { return {
@@ -226,6 +235,7 @@ const ZonosPaypalPayment = class {
226
235
  registerInstance(this, hostRef);
227
236
  this.paypalSessionDone = createEvent(this, "paypalSessionDone", 7);
228
237
  this.paypalSessionFail = createEvent(this, "paypalSessionFail", 7);
238
+ this.storeUnsubscribeList = [];
229
239
  }
230
240
  async loadPaypal() {
231
241
  if (!window.Zonos.paypal) {
@@ -257,12 +267,20 @@ const ZonosPaypalPayment = class {
257
267
  await paypalButton.render(container);
258
268
  });
259
269
  }
270
+ componentWillLoad() {
271
+ this.storeUnsubscribeList = [
272
+ paypalStoreOnChange('paypal', this.loadPaypal.bind(this)),
273
+ ];
274
+ }
260
275
  componentDidLoad() {
261
276
  // @Watch doesn't get trigger on initial load
262
277
  void this.loadPaypal();
263
278
  }
279
+ disconnectedCallback() {
280
+ this.storeUnsubscribeList.forEach(unsubscribe => unsubscribe());
281
+ }
264
282
  render() {
265
- return (h(Host, { key: 'e8c839cc9d0286f5ae4643243b14fa66f9584833', class: "zonos--paypal-payment zonos--elements" }, h("div", { key: 'cac06948de1ccca97ba65eca10b3e5d9f3a9a362', class: "zonos--payment-paypal-container" })));
283
+ return (h(Host, { key: 'bcf11ef0ceab1d847c237ec26ec604440983c16f', class: "zonos--paypal-payment zonos--elements" }, h("div", { key: 'ce5033f39b2e9644e30fc1e0e35f64e5d9b9730d', class: "zonos--payment-paypal-container" })));
266
284
  }
267
285
  get el() { return getElement(this); }
268
286
  };
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-55a03023.js';
2
- import { l as localizationStore, t as translate, d as currencyFormat } from './localization-d8326254.js';
2
+ import { l as localizationStore, d as currencyFormat } from './localization-d7125e4e.js';
3
+ import { t as translate } from './translationStore-13502f49.js';
3
4
  import { z as zonosStore } from './zonosStore-c456b933.js';
4
5
  import { c as classes } from './classes-0d95c529.js';
5
6
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
@@ -343,18 +344,18 @@ const ZonosHelloDialog = class {
343
344
  const defaultMessage = formatStringWithLinks(defaultMessageStr);
344
345
  const currentPage = this.getCurrentPageEnum();
345
346
  const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
346
- return (h(Host, { key: '048945538b24e429425ba47f0964a2c16a8c2d3d', class: "zonos--elements" }, h("div", { key: '539cb35da5f85ec64a166757eb09389262232d3e', class: classes([
347
+ return (h(Host, { key: '178654e9b701bb68a4d47495897445cf87806c37', class: "zonos--elements" }, h("div", { key: 'eb0f3ced0226513df3911e0664aff10d523fdac7', class: classes([
347
348
  'zonos--hello-dialog',
348
349
  animateLeft && 'zonos--hello-dialog-animate-from-left',
349
350
  animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
350
351
  !!this.mobileLocationOverride &&
351
352
  'zonos--hello-dialog-mobile-override',
352
353
  this.isOpen && 'zonos--hello-dialog-open',
353
- ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'ef1ad9355d3244d96971217311f1c674adeb6ee3' }, h("div", { key: '463e7752c0a1c11c6c86bf0dd8031b81511c0c14', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '89c1ae9d62c5b6c21472597c1afc5733a1cb8512', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '2657decc4b955f00eeb360018791e18a7a4ac70a', spacing: 24 }, h("zonos-country-flag", { key: '57e9c4bdfc7a14e0268097a5c0c79ef508011347', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: 'cda79b1e8487d72ed6ca33e2298731953ad9620e', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '17d98d8f62d953c2b41ee46678ae4bea26b09ca5', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '856cebfb2d0d34a52d23f3eb8ccc7a64ef16e822', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '905f5e46a8eba8d9ff69af0ee5f51dadd168878e', spacing: 8 }, this.restrictedItems.map(item => {
354
+ ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'f185f2d707a3b9628896a7e15f2a0ad20da112ec' }, h("div", { key: '80c53ad6728b221bedbfaec2ec77fee96029e12b', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '31b71832bee5e4515dbf060746f022d9c91502af', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '5f11c3b0355ba0c85cf134522b6e21fd28dfe16c', spacing: 24 }, h("zonos-country-flag", { key: '6d6dcad7e3700f67c4261995d867aacb42715404', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: '7a325a9b94e58dc5f8dba5baba9a00f835466ee2', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '24e2407475b740b50ca07fe9278363fdefc27d01', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '6b38dee6ec6fcf39e02c5225155e2af69c367a39', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '567d126d05f236fa0aab764d78b1692ebfe82f8b', spacing: 8 }, this.restrictedItems.map(item => {
354
355
  var _a;
355
356
  return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
356
- }), h("zonos-card", { key: '600e71f5ccd6f2f86d5fe00833f480b5059fa145', spacing: "12px" }, h("zonos-v-stack", { key: '75cc0236d7f59ef08e7700ef326c079b2eb273a2', spacing: 12 }, hasInclusivePrices ? (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), h("zonos-text", null, inclusivePriceMessage))) : (h(Fragment, null, dutyDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis icon", content: ImportIcon }), h("zonos-text", { "aria-label": "Duty de minimis message" }, dutyDeMinimisMessage))), taxDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Tax de minimis icon", content: MoneyIcon }), h("zonos-text", { "aria-label": "Tax de minimis message" }, taxDeMinimisMessage))))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
357
- additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '70c60065a548ab2e178df64062991b8160d62f55', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '14da13080459253ab355f60f67216f99741b69a2' }, h("zonos-country-select", { key: 'e18e90eb0e68450ceb833aa999f24108fd154eb8', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '56255cb5629ee7600378d13ee700adf1d3c73f51' }, h("zonos-language-select", { key: '3d74f4c28c067ea9f94da2d3274abf4d750bcab7', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
357
+ }), h("zonos-card", { key: 'e96943bc58d47531f748217858939ddf2a586441', spacing: "12px" }, h("zonos-v-stack", { key: '3e1850a86542ad66c224e4b81f1c5442e7716f6d', spacing: 12 }, hasInclusivePrices ? (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), h("zonos-text", null, inclusivePriceMessage))) : (h(Fragment, null, dutyDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis icon", content: ImportIcon }), h("zonos-text", { "aria-label": "Duty de minimis message" }, dutyDeMinimisMessage))), taxDeMinimisMessage && (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Tax de minimis icon", content: MoneyIcon }), h("zonos-text", { "aria-label": "Tax de minimis message" }, taxDeMinimisMessage))))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
358
+ additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '33e41b69e4a5b00623f3e412609e7162cb560c38', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: 'fa17c20b3d893ed9f2249bbceca5237fa48bc64e' }, h("zonos-country-select", { key: '15a5924f176c4a805405684c3eda90f47979cf0b', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: 'ab1d061a3c9c68b43c4203fa14af2ffcf7d33e82' }, h("zonos-language-select", { key: '97f4c760e65d7af39160a1ff978d8a7b0864a763', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
358
359
  }
359
360
  static get assetsDirs() { return ["assets"]; }
360
361
  static get watchers() { return {
@@ -1,6 +1,7 @@
1
1
  import { r as registerInstance, h, H as Host, a as getElement } from './index-55a03023.js';
2
2
  import { d as debounce_1 } from './debounce-c34d1270.js';
3
- import { l as localizationStore, i as isValidSelector, t as translate, g as getZCountryUrlParam, h as setZCountryUrlParam, j as currencyDisplay, k as currencyConvertAndFormat, m as currencyConvert, d as currencyFormat } from './localization-d8326254.js';
3
+ import { l as localizationStore, i as isValidSelector, g as getZCountryUrlParam, h as setZCountryUrlParam, j as currencyDisplay, k as currencyConvertAndFormat, m as currencyConvert, d as currencyFormat } from './localization-d7125e4e.js';
4
+ import { t as translate } from './translationStore-13502f49.js';
4
5
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-c456b933.js';
5
6
  import { c as classes } from './classes-0d95c529.js';
6
7
  import { h as handleFetch, b as logError, l as log } from './handleFetch-99218189.js';
@@ -38,17 +38,17 @@ const ZonosInput = class {
38
38
  this.inputChange.emit(newValue);
39
39
  }
40
40
  render() {
41
- return (h(Host, { key: '87c0f3819db82f5b731ec02f1dda30888131989a', class: classes([
41
+ return (h(Host, { key: '52acbcb39e71fb56029f7aa44b62b2189aa27fd7', class: classes([
42
42
  'zonos--input zonos--elements',
43
43
  this.inputSize,
44
44
  this.isError && 'has-error',
45
45
  ]), style: {
46
46
  '--zonos--border-radius': getBorderRadius(),
47
47
  '--zonos--font-family': zonosStoreFontFamily(),
48
- } }, h("div", { key: '0eb35699b27eb262797a599441877b5600d989f0', class: classes([
48
+ } }, h("div", { key: '9f4566c8f668d633ec5283319d67b8de93703524', class: classes([
49
49
  'zonos--label-wrapper',
50
50
  this.isDisabled && 'disabled',
51
- ]) }, h("input", { key: '75973f2c81e28a0007b047375ead0c5e6f055a14', class: classes([
51
+ ]) }, h("input", { key: '72de2d08535a007c0e77a037f9d236f0dc45f56e', class: classes([
52
52
  'zonos--floated-input',
53
53
  !!this.inputLabel && 'has-label',
54
54
  this.inputValue && 'has-content',
@@ -56,7 +56,7 @@ const ZonosInput = class {
56
56
  ]), disabled: this.isDisabled, onInput: e => {
57
57
  const input = e.target;
58
58
  this.inputChange.emit(input.value);
59
- }, placeholder: this.inputPlaceholder, type: "text", value: this.value }), h("label", { key: '23ee9731bfef0417522714dc48a97949eecad145', class: "zonos--floated-label", "data-label": this.inputLabel }))));
59
+ }, placeholder: this.inputPlaceholder, type: "text", value: this.value }), h("label", { key: 'e4d54ac95efa67ce8c7e56b3a2625e99c417f04d', class: "zonos--floated-label", "data-label": this.inputLabel }))));
60
60
  }
61
61
  get el() { return getElement(this); }
62
62
  static get watchers() { return {
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-55a03023.js';
2
- import { p as localizationStoreUpdateSelectedLocale, t as translate, l as localizationStore } from './localization-d8326254.js';
2
+ import { p as localizationStoreUpdateSelectedLocale, l as localizationStore } from './localization-d7125e4e.js';
3
+ import { t as translate } from './translationStore-13502f49.js';
3
4
  import { f as zonosStoreFontFamily } from './zonosStore-c456b933.js';
4
5
  import { l as languages } from './ILanguage-cd6acb72.js';
5
6
  import './handleFetch-99218189.js';
@@ -30,9 +31,9 @@ const ZonosLanguageSelect = class {
30
31
  }
31
32
  render() {
32
33
  const { selectedLocale } = localizationStore;
33
- return (h(Host, { key: 'cc711dba7371852eab6e20994389ae3b95bb3be7', class: "zonos--elements", style: {
34
+ return (h(Host, { key: '232674c6f35113c6ad3f1094e6e6d4128b4d4c02', class: "zonos--elements", style: {
34
35
  '--zonos--font-family': zonosStoreFontFamily(),
35
- } }, h("div", { key: '47135e2b7363a3179139a7b8e23cb22435ce3299', class: "zonos--language-select" }, h("zonos-select-dialog-header", { key: '3bf830e585fa6478f560c57dfa978721af47ad19', handleOnClose: () => this.handleOnClose(), label: translate('Select a language') }), h("div", { key: 'f693b231755087ec849f5a759b2dc43e2695b24f', class: "zonos--language-select-content" }, languages.map(language => (h("button", { class: "zonos--language-select-button", onClick: () => this.languageSelected(language.code) }, h("zonos-text", { textColor: "gray-800" }, language.translatedLabel), language.code === selectedLocale && (h("zonos-icon", { content: GreenCheckDuotoneIcon, size: 16 })))))))));
36
+ } }, h("div", { key: '014d1364e165e4ee4e9cf304791fc10fdfb6d87c', class: "zonos--language-select" }, h("zonos-select-dialog-header", { key: '65b454467b033cd061ab08693e857eed75c76511', handleOnClose: () => this.handleOnClose(), label: translate('Select a language') }), h("div", { key: '6ea8fca0b44ada24b9b2b84e22584ba1a7459dc4', class: "zonos--language-select-content" }, languages.map(language => (h("button", { class: "zonos--language-select-button", onClick: () => this.languageSelected(language.code) }, h("zonos-text", { textColor: "gray-800" }, language.translatedLabel), language.code === selectedLocale && (h("zonos-icon", { content: GreenCheckDuotoneIcon, size: 16 })))))))));
36
37
  }
37
38
  };
38
39
  ZonosLanguageSelect.style = ZonosLanguageSelectStyle0;
@@ -56,9 +57,9 @@ const ZonosSelectDialogHeader = class {
56
57
  this.label = '';
57
58
  }
58
59
  render() {
59
- return (h(Host, { key: '184508c2af24eedda1e4a59db89f787cd71a345f', class: "zonos--elements", style: {
60
+ return (h(Host, { key: 'cc65559ef7867bbd8e7990556b50434faa0a905c', class: "zonos--elements", style: {
60
61
  '--zonos--font-family': zonosStoreFontFamily(),
61
- } }, h("zonos-v-stack", { key: '28bd290a2307c13e93036ee988f71bba87e76b19', class: "zonos--select-dialog-header-wrapper", spacing: 8 }, h("div", { key: '49c2a1c0c44d9950907f47d90c9a34a83e5158da', class: "zonos--select-dialog-header" }, h("zonos-text", { key: '244ef10f5ee38d4a056ad6c076185d42ca3cd174', type: "boldLabel" }, this.label), h("zonos-button", { key: 'dab99b609f1a3250f73e2f25b837c9300a964090', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close select dialog", content: RemoveIcon, size: 20 }), noBackground: true, onClick: () => this.handleOnClose() })), h("slot", { key: 'b2fdb25cdc7c6382ec8d171aa14f1f4b7f33a4e8' }))));
62
+ } }, h("zonos-v-stack", { key: '77c280b12744520b4a172193f88798aa53d33eb7', class: "zonos--select-dialog-header-wrapper", spacing: 8 }, h("div", { key: 'eaba9d1e50f71f23e330e989521d2156a617b22d', class: "zonos--select-dialog-header" }, h("zonos-text", { key: 'ddddc6b5bca87cf44cbc7428d402f44c67422cb6', type: "boldLabel" }, this.label), h("zonos-button", { key: '313e3955ba8bafc9a1b36b4c1c8f99e975fb8dd3', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close select dialog", content: RemoveIcon, size: 20 }), noBackground: true, onClick: () => this.handleOnClose() })), h("slot", { key: '9af2821c22f3e37d52b6f03bf544fcaca1c0ed7b' }))));
62
63
  }
63
64
  };
64
65
  ZonosSelectDialogHeader.style = ZonosSelectDialogHeaderStyle0;
@@ -12,7 +12,7 @@ const ZonosLink = class {
12
12
  this.href = '';
13
13
  }
14
14
  render() {
15
- return (h(Host, { key: '41f0a757a334338631250764599ac99e28c41ed2', class: "zonos--elements" }, h("a", { key: 'b6e84f40141e8de85d005c05426f885f242ffc53', href: this.href, rel: this.rel, target: this.target, title: this.linkTitle }, h("slot", { key: 'dd5ed33f163d7958fb7806992e003d2279ee1f5b' }))));
15
+ return (h(Host, { key: '7c6ecf4d61e7dfb56491e58814478c906423473b', class: "zonos--elements" }, h("a", { key: '05bc59fb4940fa48d37a10cfe9df3c495d60785f', href: this.href, rel: this.rel, target: this.target, title: this.linkTitle }, h("slot", { key: '07b51a0a95cd5a7b392bb5efef96c8e4dd4bb9b3' }))));
16
16
  }
17
17
  };
18
18
  ZonosLink.style = ZonosLinkStyle0;
@@ -22,11 +22,11 @@ const ZonosLogo = class {
22
22
  const filterColor = this.theme === 'DARK'
23
23
  ? 'invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)'
24
24
  : 'whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)';
25
- return (h(Host, { key: 'c41a277084d4880e1f452a1f7ca097ad3507059f', class: classes(['zonos--elements zonos--logo']), style: {
25
+ return (h(Host, { key: '0f0fe90d3ef58b5a7b934361567e92b03630b46a', class: classes(['zonos--elements zonos--logo']), style: {
26
26
  '--zonos--filter-color': filterColor,
27
27
  '--zonos--font-family': zonosStoreFontFamily(),
28
28
  '--zonos--width': this.width,
29
- } }, h("img", { key: '01361446c08074a8f8b4cac206a999e381d5d903', alt: "Zonos Logo", src: getAssetPath('./assets/ZonosLogo.png') })));
29
+ } }, h("img", { key: 'ec026a1a596d985aa50c18f8ebffc8683e62cc05', alt: "Zonos Logo", src: getAssetPath('./assets/ZonosLogo.png') })));
30
30
  }
31
31
  static get assetsDirs() { return ["assets"]; }
32
32
  };
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-55a03023.js';
2
- import { f as zonosStoreFontFamily, z as zonosStore } from './zonosStore-c456b933.js';
2
+ import { z as zonosStore, f as zonosStoreFontFamily } from './zonosStore-c456b933.js';
3
3
  import { i as inheritAriaAttributes, a as inheritAttributes } from './helpers-2f6955b1.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import { g as getBorderRadius } from './getBorderRadius-87593ff4.js';
@@ -68,9 +68,12 @@ const ZonosStripeInput = class {
68
68
  render() {
69
69
  const primaryColor = this.overridePrimaryColor || zonosStore.appearance.colorPrimary;
70
70
  const secondaryColor = this.overrideSecondaryColor || zonosStore.appearance.colorSecondary;
71
- const isDark = primaryColor && isDarkColor(primaryColor);
71
+ // Always use theme from appearance settings if it's collect
72
+ const isDark = window.Zonos.isCollect
73
+ ? zonosStore.appearance.theme === 'DARK'
74
+ : primaryColor && isDarkColor(primaryColor);
72
75
  const fontSize = zonosStore.appearance.fontSizeInputValue || 16;
73
- return (h(Host, { key: 'ce50e8c3f41abc7f7605a4423dc21c5fce755c9a', class: classes([
76
+ return (h(Host, { key: '0bed90e63595e6036b9342e15c999bb7e7971240', class: classes([
74
77
  'zonos--input zonos--elements',
75
78
  isDark && 'dark',
76
79
  (this.isError || !!this.error) && 'has-error',
@@ -79,10 +82,10 @@ const ZonosStripeInput = class {
79
82
  '--zonos--font-family': zonosStoreFontFamily(),
80
83
  '--zonos--font-size': `${fontSize}px`,
81
84
  '--zonos--primary-color': secondaryColor,
82
- } }, h("div", { key: '8953c4cf31d9de771ef8f6351476d5db9de5655a', class: classes([
85
+ } }, h("div", { key: '00e5c3a220aaeee221c5cc104d2463f5468067cf', class: classes([
83
86
  'zonos--label-wrapper',
84
87
  this.isDisabled && 'disabled',
85
- ]) }, h("input", Object.assign({ key: 'c66c0e5787191ab6bb804755da7477e222b3ff40' }, this.inheritedAttributes, { autoComplete: this.autoComplete, class: classes([
88
+ ]) }, h("input", Object.assign({ key: '25459f6bc07647962676edd724630cd7726bb680' }, this.inheritedAttributes, { autoComplete: this.autoComplete, class: classes([
86
89
  'zonos--floated-input',
87
90
  !!this.inputLabel && 'has-label',
88
91
  this.internalValue && 'has-content',
@@ -92,7 +95,7 @@ const ZonosStripeInput = class {
92
95
  this.inputChange.emit(input.value);
93
96
  this.el.inputValue = input.value;
94
97
  this.el.dispatchEvent(new Event('change'));
95
- }, placeholder: this.inputPlaceholder || '', required: this.required, type: "text", value: this.internalValue })), h("div", { key: '17c7fa7ef87bf765203cadb3ff24ead25ac45332', class: "zonos--floated-label" }, h("label", { key: '4d7c8e503bd0dc0081b13a36c2a1c5f976ee93e3', htmlFor: this.inputId }, this.inputLabel))), this.error && (h("zonos-text", { key: '1352d1d09b05a25ced56d31b16cf1f203b0eaaec', textColor: "red-600", type: "caption" }, this.error))));
98
+ }, placeholder: this.inputPlaceholder || '', required: this.required, type: "text", value: this.internalValue })), h("div", { key: '145634dac24ef37cd206847537bea2f641f3b5a0', class: "zonos--floated-label" }, h("label", { key: '70eabcab7a30e851086a2b79107968f9a999c67e', htmlFor: this.inputId }, this.inputLabel))), this.error && (h("zonos-text", { key: '55ab6d14b5e6c98c665f41a1c4c1dd70523ee91f', textColor: "red-600", type: "caption" }, this.error))));
96
99
  }
97
100
  get el() { return getElement(this); }
98
101
  static get watchers() { return {
@@ -105,7 +105,7 @@ const textOptions = {
105
105
  },
106
106
  };
107
107
 
108
- const zonosTextCss = ":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{color:var(--zonos--color)}:host(.zonos--text-size-3xl)>*,:host(.zonos--text-size-3xl){font-size:var(--zonos--font-size-3xl, var(--zonos-elements-font-size-3xl))}:host(.zonos--text-size-2xl)>*,:host(.zonos--text-size-2xl){font-size:var(--zonos--font-size-2xl, var(--zonos-elements-font-size-2xl))}:host(.zonos--text-size-xl)>*,:host(.zonos--text-size-xl){font-size:var(--zonos--font-size-xl, var(--zonos-elements-font-size-xl))}:host(.zonos--text-size-l)>*,:host(.zonos--text-size-l){font-size:var(--zonos--font-size-l, var(--zonos-elements-font-size-l))}:host(.zonos--text-size-base)>*,:host(.zonos--text-size-base){font-size:var(--zonos--font-size-base, var(--zonos-elements-font-size-base))}:host(.zonos--text-size-s)>*,:host(.zonos--text-size-s){font-size:var(--zonos--font-size-s, var(--zonos-elements-font-size-s))}:host(.zonos--text-size-xs)>*,:host(.zonos--text-size-xs){font-size:var(--zonos--font-size-xs, var(--zonos-elements-font-size-xs))}:host(.zonos--text-weight-900)>*,:host(.zonos--text-weight-900){font-weight:900}:host(.zonos--text-weight-700)>*,:host(.zonos--text-weight-700){font-weight:700}:host(.zonos--text-weight-600)>*,:host(.zonos--text-weight-600){font-weight:600}:host(.zonos--text-weight-500)>*,:host(.zonos--text-weight-500){font-weight:500}:host(.zonos--text-weight-400)>*,:host(.zonos--text-weight-400){font-weight:400}";
108
+ const zonosTextCss = ":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{color:var(--zonos--color)}:host(.zonos--text-size-3xl)>*,:host(.zonos--text-size-3xl){font-size:var(--zonos--font-size-3xl, var(--zonos-elements-font-size-3xl))}:host(.zonos--text-size-2xl)>*,:host(.zonos--text-size-2xl){font-size:var(--zonos--font-size-2xl, var(--zonos-elements-font-size-2xl));line-height:32px}:host(.zonos--text-size-xl)>*,:host(.zonos--text-size-xl){font-size:var(--zonos--font-size-xl, var(--zonos-elements-font-size-xl))}:host(.zonos--text-size-l)>*,:host(.zonos--text-size-l){font-size:var(--zonos--font-size-l, var(--zonos-elements-font-size-l))}:host(.zonos--text-size-base)>*,:host(.zonos--text-size-base){font-size:var(--zonos--font-size-base, var(--zonos-elements-font-size-base))}:host(.zonos--text-size-s)>*,:host(.zonos--text-size-s){font-size:var(--zonos--font-size-s, var(--zonos-elements-font-size-s))}:host(.zonos--text-size-xs)>*,:host(.zonos--text-size-xs){font-size:var(--zonos--font-size-xs, var(--zonos-elements-font-size-xs))}:host(.zonos--text-weight-900)>*,:host(.zonos--text-weight-900){font-weight:900}:host(.zonos--text-weight-700)>*,:host(.zonos--text-weight-700){font-weight:700}:host(.zonos--text-weight-600)>*,:host(.zonos--text-weight-600){font-weight:600}:host(.zonos--text-weight-500)>*,:host(.zonos--text-weight-500){font-weight:500}:host(.zonos--text-weight-400)>*,:host(.zonos--text-weight-400){font-weight:400}";
109
109
  const ZonosTextStyle0 = zonosTextCss;
110
110
 
111
111
  const ZonosText = class {
@@ -16,9 +16,9 @@ const ZonosToggle = class {
16
16
  this.options = [];
17
17
  }
18
18
  render() {
19
- return (h(Host, { key: '9a526e8fee8e4c5af558442c82f7acbc634706c3', class: classes(['zonos--elements zonos--toggle']), style: {
19
+ return (h(Host, { key: '1b844d11272181b9c81c2bfb03a13a1ad412cb9f', class: classes(['zonos--elements zonos--toggle']), style: {
20
20
  '--zonos--font-family': zonosStoreFontFamily(),
21
- } }, h("div", { key: '97ca281e8e782c3b08231c6ba705325bbf16d402', class: "wrapper" }, this.options.map(option => {
21
+ } }, h("div", { key: 'f5991e19ea02a82ae1f6e7529bb3bb77e66b7165', class: "wrapper" }, this.options.map(option => {
22
22
  const selected = option.value === this.value;
23
23
  return (h("button", { class: classes(['zonos--option', selected && 'selected']), key: option.value, onClick: () => {
24
24
  this.toggleChanged.emit(option.value);
@@ -18,10 +18,10 @@ const ZonosTooltip = class {
18
18
  this.showTooltip = false;
19
19
  }
20
20
  render() {
21
- return (h(Host, { key: 'd984faacc8d79f2001c84fb69c30f3665dca44aa', class: "zonos--elements" }, h("div", { key: '327f9d077f2400f05ff3c4337b566c461a2d05cf', class: "zonos--tooltip", onMouseEnter: () => (this.showTooltip = true), onMouseLeave: () => (this.showTooltip = false) }, h("slot", { key: '24315359176ca625f18a856d781624850d05de17' }), h("div", { key: '296041bbebddd0250c6d5d9649e6502571a08533', class: classes([
21
+ return (h(Host, { key: 'd96671c8c9b426cbde335b3d8024a56f4e188281', class: "zonos--elements" }, h("div", { key: 'de75e111a65033501e9907992df0d9ae8cbf5df5', class: "zonos--tooltip", onMouseEnter: () => (this.showTooltip = true), onMouseLeave: () => (this.showTooltip = false) }, h("slot", { key: '3d8297ef44c97112e29a62a31b3acf47789726a9' }), h("div", { key: 'ee777f084991e28255a2957cf3585110f14c65d5', class: classes([
22
22
  this.showTooltip && 'zonos--show-tooltip',
23
23
  'zonos--tooltip-content',
24
- ]) }, h("zonos-text", { key: '5a2828baf420acb666eb1f0029c8d0b9eadd55ce', size: "s", textColor: "gray-0", type: "boldLabel" }, this.label), h("zonos-text", { key: '1bd8bf5085edfdc3d42db03e460062bf744c174b', size: "xs", textColor: "gray-0" }, this.subtitle)))));
24
+ ]) }, h("zonos-text", { key: 'fb22b220feb39c31111d45a393024e7df4d3e314', size: "s", textColor: "gray-0", type: "boldLabel" }, this.label), h("zonos-text", { key: '6019665e4e0b8eb4390a70b5d90cdcc4f16c6ba3', size: "xs", textColor: "gray-0" }, this.subtitle)))));
25
25
  }
26
26
  };
27
27
  ZonosTooltip.style = ZonosTooltipStyle0;
@@ -16,9 +16,9 @@ const VStack = class {
16
16
  this.spacing = 24;
17
17
  }
18
18
  render() {
19
- return (h(Host, { key: '558218f6135d5fcc9f3649b76c568a9f514aa8e8', style: {
19
+ return (h(Host, { key: 'd65f235ba8ffaefff1ec5e5bbd8bba1313e97a83', style: {
20
20
  '--zonos--font-family': zonosStoreFontFamily(),
21
- } }, h("div", { key: '86af63aa01214db20cc094ddcbfd05b3ee28f1ed', class: classes(['vstack']), style: { 'grid-row-gap': `${this.spacing}px` } }, h("slot", { key: '4786fb44cbf865a548c900b752f9b13709f1f935' }))));
21
+ } }, h("div", { key: '31806036975f9640fdccafcc11053596dd17f4ef', class: classes(['vstack']), style: { 'grid-row-gap': `${this.spacing}px` } }, h("slot", { key: 'a3c5a3f592f86cfd9ebb810c72e2e22011ec4758' }))));
22
22
  }
23
23
  };
24
24
  VStack.style = ZonosVStackStyle0;
@@ -0,0 +1 @@
1
+ var buildCartItemsByTempCart=function(t){var e=t.items.map((function(t){return{amount:t.amount,attributes:t.attributes||[],countryOfOrigin:t.countryOfOrigin||undefined,currencyCode:t.currencyCode,description:t.description||"",imageUrl:t.imageUrl||"",itemType:t.itemType||"PHYSICAL_GOOD",measurements:t.measurements||[],name:t.name||t.description||"",productId:t.productId||"",quantity:t.quantity||0,sku:t.sku||""}}))||[];return{adjustments:t.adjustments,cartItems:e}};export{buildCartItemsByTempCart as b};
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):n(e.value).then(a,s)}d((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return d([e,t])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++){if(i||!(o in t)){if(!i)i=Array.prototype.slice.call(t,0,o);i[o]=t[o]}}return e.concat(i||Array.prototype.slice.call(t))};import{z as zonosStore,c as createStore}from"./zonosStore-c456b933.js";import{s as storageStore,l as localizationStore,f as filterValidTests,b as storageStoreSetEnabledVariantTestKeys}from"./localization-d7125e4e.js";import{t as translate}from"./translationStore-13502f49.js";import{l as log,f as fallbackApiList,h as handleFetch,g as getIsTestMode,a as getIsStagingMode,s as sendErrorLog,d as allLogs,b as logError,j as jsonParse}from"./handleFetch-99218189.js";import{i as isDarkColor}from"./isDarkColor-1f58b6be.js";import{g as getBorderRadius}from"./getBorderRadius-87593ff4.js";var extractName=function(e){var t=e.firstName,r=e.lastName,o=e.name;var n;if(!o&&!t&&!r){return{firstName:"",lastName:""}}var i=(o===null||o===void 0?void 0:o.split(/\s+/))||[];var a=(t===null||t===void 0?void 0:t.trim())||((n=i[0])===null||n===void 0?void 0:n.trim())||"";var s=(r===null||r===void 0?void 0:r.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}};var getTranslatedAddress=function(e){var t=e.currentAddress,r=e.translatedAddress;var o,n,i,a,s,d;var c=t.value.address,l=c.city,u=c.country,v=c.line1,S=c.line2,p=c.postal_code,f=c.state;var h=t.value.name||[t.value.firstName,t.value.lastName].join(" ");return{city:((o=r.city)===null||o===void 0?void 0:o[l])||l,country:u,line1:((n=r.line1)===null||n===void 0?void 0:n[v])||v,line2:((i=r.line2)===null||i===void 0?void 0:i[S||""])||S||"",name:((a=r.name)===null||a===void 0?void 0:a[h])||h,phone:t.value.phone||"",postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[p])||p,state:((d=r.state)===null||d===void 0?void 0:d[f])||f}};var prepCartCalculateLandedCost=function(e){var t;var r=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=stripeStore.stripeLinkEventData;var n=stripeStore.stripeAddressEventData;var i=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;if(!n||!i){throw new Error("Missing stripe address data")}var a=getTranslatedAddress({currentAddress:n,translatedAddress:stripeStore.translatedAddress.address});var s=extractName({name:a.name}),d=s.firstName,c=s.lastName;var l=getTranslatedAddress({currentAddress:i,translatedAddress:stripeStore.translatedAddress.address});var u=extractName({name:l.name}),v=u.firstName,S=u.lastName;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:S,phone:l.phone},cartCurrencyCode:(t=cartStore.items[0])===null||t===void 0?void 0:t.currencyCode,cartId:e,checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:d,lastName:c,phone:a.phone},isTest:!!r,landedCostAdjustments:cartStore.promoCode?[{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}};var prepCalculateLandedCost=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var t=stripeStore.stripeLinkEventData;var r=stripeStore.stripeAddressEventData;var o=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;log({stripeAddressData:r,stripeBillingAddressData:o},"info");if(!r||!o){throw new Error("Missing stripe address data")}var n=getTranslatedAddress({currentAddress:r,translatedAddress:stripeStore.translatedAddress.address});var i=extractName({name:n.name}),a=i.firstName,s=i.lastName;var d=getTranslatedAddress({currentAddress:o,translatedAddress:stripeStore.translatedAddress.address});var c=extractName({name:d.name}),l=c.firstName,u=c.lastName;var v=cartStore.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var S=cartStore.promoCode?__spreadArray([{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}],v,true):v;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:u,phone:d.phone},checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:t===null||t===void 0?void 0:t.value.email,firstName:a,lastName:s,phone:n.phone},isTest:e,items:cartStore.items,landedCostAdjustments:S,shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:n.line1,addressLine2:n.line2,city:n.city,country:n.country,postalCode:n.postal_code,state:n.state}}};var triggerBuildLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:a=prepCalculateLandedCost();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:fallbackApiList["vercel"]})];case 1:s=u.sent();if(!s||!((t=s.checkoutSessionWorkflow)===null||t===void 0?void 0:t.length)&&((r=s.errors)===null||r===void 0?void 0:r.length)){throw new Error("Failed to build landed cost: ".concat(((n=(o=s===null||s===void 0?void 0:s.errors)===null||o===void 0?void 0:o[0])===null||n===void 0?void 0:n.message)||"Unknown error"))}return[4,handleFetch("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=u.sent(),c=d.errors,l=d.json;if(!l||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:r=zonosStore.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,triggerBuildLandedCost(r)];case 1:o=d.sent();return[2,o];case 2:return[4,handleFetch("/api/zonos-elements/calculate-landed-cost",{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:n=d.sent(),i=n.errors,a=n.json;if(i.length||!a){s=((t=i[0])===null||t===void 0?void 0:t.message)==="The user aborted a request.";if(s){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}i.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!a){throw new Error("Failed to calculate landed cost")}return[2,a]}return[2,a]}}))}))};var cartCalculateLandedCost=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l;var u=e.abortController,v=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,handleFetch("/api/zonos-elements/cart-calculate-landed-cost",{body:prepCartCalculateLandedCost(v),method:"POST",signal:u===null||u===void 0?void 0:u.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){c=typeof((t=s[0])===null||t===void 0?void 0:t.message)==="string"&&(((r=s[0])===null||r===void 0?void 0:r.message)==="The user aborted a request."||((o=s[0])===null||o===void 0?void 0:o.message.includes("signal is aborted"))||((n=s[0])===null||n===void 0?void 0:n.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=c?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,d]}}))}))};var __rest=undefined&&undefined.__rest||function(e,t){var r={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0)r[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++){if(t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n]))r[o[n]]=e[o[n]]}return r};var calculateLandedCostNormalized=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=window.Zonos.cartId;if(!!t)return[3,2];return[4,calculateLandedCost(e)];case 1:r=a.sent();return[2,r];case 2:return[4,cartCalculateLandedCost({abortController:e,cartId:t})];case 3:o=a.sent(),n=o.cartWorkflow,i=__rest(o,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:n.items})]}}))}))};var trackConversionEvent=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.checkoutSessionId,u=e.eventName,v=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();n=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:l,eventCreated:o,eventName:u});i=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);a=getIsTestMode()||getIsStagingMode();if((a||i)&&!window.Zonos.zonosConversionTest){return[2]}s=localizationStore.selectedCountryCode;d=zonosStore.organizationId;if(!l){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No checkout session id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:v,organizationId:d,trackEventLogs:n}});return[2]}if(!d){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No organization id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:v,organizationId:d,trackEventLogs:n}})}c={checkoutSessionId:l,countryCode:s,eventCreated:o,eventName:u,metadata:Object.assign(Object.assign({},v),{trackEventLogs:n}),organizationId:d};return[4,handleFetch("/api/zonos-elements/track-conversion-event",{body:c,method:"POST"})];case 1:e.sent();return[2]}}))}))};var getExcludeAddressFieldsObject=function(e){var t=e.address,r=e.invalidAdddressList;if(!t){return}if(!r){return}var o={};if(r.city){o.city=t.city}if(r.line1){o.line1=t.line1}if(r.line2){o.line2=t.line2}if(r.postal_code){o.postal_code=t.postal_code}if(r.state){o.state=t.state}if(r.name){o.name=t.name}return Object.keys(o).length?o:undefined};var buildTranslateRequest=function(e){var t=e.addressInvalidCharactersList,r=e.billingAddressInvalidCharactersList,o=e.stripeAddressEventData,n=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(o===null||o===void 0?void 0:o.complete);var s=i?a:!!(n===null||n===void 0?void 0:n.complete);if(!a||!s){return null}if(!t&&!r){return null}var d=o.value;var c=(n===null||n===void 0?void 0:n.value)||null;var l=extractName({firstName:d.firstName,lastName:d.lastName,name:d.name}),u=l.firstName,v=l.lastName;var S="".concat(u," ").concat(v);var p=extractName({firstName:c===null||c===void 0?void 0:c.firstName,lastName:c===null||c===void 0?void 0:c.lastName,name:(c===null||c===void 0?void 0:c.name)||""}),f=p.firstName,h=p.lastName;var m=f&&h?"".concat(f," ").concat(h):"";var g=d.address;var y=c===null||c===void 0?void 0:c.address;return{address:getExcludeAddressFieldsObject({address:Object.assign(Object.assign({},g),{name:S}),invalidAdddressList:t}),billingAddress:!i?getExcludeAddressFieldsObject({address:y?Object.assign(Object.assign({},y),{name:m}):null,invalidAdddressList:r}):undefined,destinationCountry:g.country}};var sortServiceLevelOptionsByAmount=function(e){var t=e.sort((function(e,t){return e.amount-t.amount}));return t};var getCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:if(!storageStore.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",storageStore.checkoutSessionId);return[4,handleFetch("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:t=n.sent(),r=t.errors,o=t.json;return[2,{errors:r,json:o}]}}))}))};var validateCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:return[4,getCheckoutSession()];case 1:t=n.sent(),r=t.errors,o=t.json;if(r.length||!o){logError("Failed to retrieve checkout session info before confirming payment ",r);void sendErrorLog({endpoint:"validateCheckoutSession",errors:r.map((function(e){return e.message})),metadata:{allLogs:allLogs}});return[2,{errorMessage:translate("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=o.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){logError("Landed cost is not found in the checkout session before confirming payment.");void sendErrorLog({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:allLogs}});return[2,{errorMessage:translate('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))};var addressRuleStyle=function(e){var t=e.theme;var r={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:zonosStore.appearance.fontSizeInputValue?"".concat(zonosStore.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:zonosStore.appearance.fontSizeInputLabel?"".concat(zonosStore.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius({overrideBorderStyle:t}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius({overrideBorderStyle:t}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var _m=createStore((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),stripeStoreOnChange=_m.onChange,reset$1=_m.reset,stripeStore=_m.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRadius,o=e.overridePrimaryColor,n=e.overrideSecondaryColor,i=e.overrideTheme,a=e.paypalEnabled;var s=o||zonosStore.appearance.colorPrimary;var d=n||zonosStore.appearance.colorSecondary;var c=s&&isDarkColor(s)?"night":"flat";var l=i==="DARK"?"night":"flat";var u=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:i||"LIGHT"})),theme:i?l:c,variables:Object.assign(Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"})),{colorPrimary:d})},clientSecret:t||undefined,customerSessionClientSecret:stripeStore.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],u,true),locale:localizationStore.selectedLocale}};var stripeStoreCleanupDomesticShippingSession=function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")};var stripeStoreSaveDomesticShippingSession=function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))};var stripeStoreGetDomesticShippingSession=function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return jsonParse(e)};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){o=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2]}n=getStripeOptions({clientSecret:o,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(n)===JSON.stringify(stripeStore.stripeElementsOptions);if(!stripeStore.stripeElements||!stripeStore.stripeElementsForBillingAddress){stripeStore.stripeElementsForBillingAddress=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(n);log("Stripe elements for billing address initialized");stripeStore.stripeElements=(r=stripeStore.stripe)===null||r===void 0?void 0:r.elements(n);stripeStore.stripeElementsOptions=n;log("Stripe elements initialized");return[2]}if(!i){stripeStore.stripeElements.update(n);stripeStore.stripeElementsForBillingAddress.update(n);stripeStore.stripeElementsOptions=n;void stripeStore.stripeElements.fetchUpdates()}log("Stripe elements updated");return[2]}))}))};var stripeStoreReset=function(){sessionStorage.removeItem("zonos--client-secret");reset$1();stripeStore.stripe=window.Zonos.stripe};var checkIsAddressOutdatedForValidation=function(){var e,t,r,o;var n=JSON.stringify((e=stripeStore.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value);var i=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeBillingAddressUsedWhenValidatingAddress)===null||o===void 0?void 0:o.value);return n||i};var checkIsAddressOutdatedForAsyncAddressUpdate=function(){var e,t,r,o,n,i;var a=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var s=JSON.stringify((r=stripeStore.stripeAddressUsedWhenAsyncAddressUpdate)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value);var d=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((n=stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||n===void 0?void 0:n.value)!==JSON.stringify((i=stripeStore.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var c=stripeStore.taxIdUsedWhenAsyncAddressUpdate!==stripeStore.taxId;var l=stripeStore.companyNameUsedWhenAsyncAddressUpdate!==stripeStore.companyName;return a||s||d||c||l};var stripeStoreBuildAddressForPartyCreate=function(e){var t=e.address,r=e.firstName,o=e.lastName,n=e.name,i=e.phone;var a=extractName({firstName:r,lastName:o,name:n}),s=a.firstName,d=a.lastName;if(!s||!d){void sendErrorLog({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,firstName:r,lastName:o,name:n}})}if(!i){void sendErrorLog({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,phone:i}})}return{city:t.city,country:t.country,firstName:s,lastName:d,line1:t.line1,line2:t.line2,phone:i||"",postal_code:t.postal_code,state:t.state}};var stripeStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l,u;return __generator(this,(function(v){switch(v.label){case 0:if(!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!stripeStore.stripeShippingSameAsBilling&&!((t=stripeStore.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete)||!stripeStore.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!cartStore.landedCostData){return[2,{partiesCreated:false}]}n=(r=cartStore.landedCostData.find(Boolean))===null||r===void 0?void 0:r.landedCost.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}i=checkIsAddressOutdatedForAsyncAddressUpdate();if(!i){return[2,{partiesCreated:false}]}a=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeAddressEventData.value.address,firstName:stripeStore.stripeAddressEventData.value.firstName,lastName:stripeStore.stripeAddressEventData.value.lastName,name:stripeStore.stripeAddressEventData.value.name,phone:stripeStore.stripeAddressEventData.value.phone});s=stripeStore.stripeShippingSameAsBilling?a:stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:s,companyName:stripeStore.companyName,email:((o=stripeStore.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:n,taxId:stripeStore.taxId},method:"POST"})];case 1:c=v.sent(),l=c.errors,u=c.json;if(l.length||!u){logError("Error occurs when creating parties",JSON.stringify(l,null,2));void sendErrorLog({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:l,json:u}});return[2,{partiesCreated:false}]}stripeStore.companyNameUsedWhenAsyncAddressUpdate=stripeStore.companyName;stripeStore.stripeAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeBillingAddressEventData;stripeStore.taxIdUsedWhenAsyncAddressUpdate=stripeStore.taxId;stripeStore.partyBillingId=u.billToPartyId;stripeStore.partyShippingId=u.shipToPartyId;return[2,{partiesCreated:true}]}}))}))};var buildAddressForLCPrefetch=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var checkIsAddressOutdatedForLCPrefetch=function(){var e,t;var r=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var o=stripeStore.stripeAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeAddressEventData.value))!==JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC);var n=!stripeStore.stripeShippingSameAsBilling&&stripeStore.stripeBillingAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeBillingAddressEventData.value))!==JSON.stringify(stripeStore.stripeBillingAddressUsedWhenFetchingLC);return r||o||n};var isPrefetchInfoOutdated=function(){var e;var t=cartStore.landedCostData&&((e=cartStore.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==cartStore.subtotal;var r=checkIsAddressOutdatedForLCPrefetch();log("isPrefetchInfoOutdated","info",{isAddressOutdated:r});return!cartStore.landedCostData&&!stripeStore.isFetchingLandedCost||r||t};var getCountryField=function(e){var t,r;var o=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields;var n=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var i=n&&e in n?n[e]:null;var a=o&&e in o?o[e]:null;if(cartStore.addressFormRenderType==="stripe"){return i||a}return a};var isAddressReadyToRequestLandedCost=function(){var e,t,r,o;var n=!!((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.complete);var a=stripeStore.stripeShippingSameAsBilling?i:!!((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete);var s=((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US";var d=getCountryField(s);if(i&&a&&n){return true}if(!d||!stripeStore.stripeAddressEventData){return i&&a&&n}var c=stripeStore.stripeAddressEventData.value.address.line1.length>0;var l=stripeStore.stripeAddressEventData.value.firstName&&stripeStore.stripeAddressEventData.value.lastName;var u=!d.stateRequired||d.stateRequired&&stripeStore.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&stripeStore.stripeAddressEventData.value.address.postal_code.length>=3;var S=stripeStore.stripeAddressEventData.value.phone&&stripeStore.stripeAddressEventData.value.phone.length>0;return n&&l&&c&&u&&v&&S};var stripeCalculateLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:t=new AbortController;stripeStore.fetchingLandedCostAbortController=t;cartStoreResetCartItems();return[4,calculateLandedCostNormalized(t)];case 1:r=u.sent(),o=r.checkoutSessionWorkflow,n=r.errors,i=r.itemCreateWorkflow,a=r.landedCostCalculateWorkflow,s=r.partyCreateWorkflow,d=r.shipmentRatingCalculateWorkflow;cartStore.customQuotingError=((e=n===null||n===void 0?void 0:n.find((function(e){var t;return((t=e.extensions)===null||t===void 0?void 0:t.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;cartStore.shippingData=sortServiceLevelOptionsByAmount((d===null||d===void 0?void 0:d.filter(Boolean))||[]);cartStoreCheckItemRestrictions(i);stripeStore.fetchingLandedCostAbortController=null;cartStore.partiesData=(s===null||s===void 0?void 0:s.filter(Boolean))||[];cartStore.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var t=a===null||a===void 0?void 0:a.find((function(t){return(t===null||t===void 0?void 0:t.id)===e.landedCostId}));if(!t){return null}return Object.assign(Object.assign({},e),{landedCost:t})})).filter(Boolean))||[];c=storageStore.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void trackConversionEvent({checkoutSessionId:c,eventName:"checkout_quoteReceived"})}l=cartStore.promoCodeApplied&&!cartStore.landedCostData.find((function(e){var t;return(t=e.landedCost.appliedAdjustments)===null||t===void 0?void 0:t.find((function(e){return e.type==="PROMO_CODE"}))}));cartStore.promoCodeError=l;if(!l){sessionStorage.setItem("zonos--promo-code",cartStore.promoCode)}return[2]}}))}))};var stripeStorePrefetchLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,v,S,p;return __generator(this,(function(f){switch(f.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=isPrefetchInfoOutdated();d=isAddressReadyToRequestLandedCost();if(!d){return[2,{isRequestNotReady:true}]}if(s){(t=stripeStore.fetchingLandedCostAbortController)===null||t===void 0?void 0:t.abort();stripeStore.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){stripeStore.isFetchingLandedCost=false;setTimeout((function(){stripeStore.isFetchingLandedCost=true}),300)}else{stripeStore.isFetchingLandedCost=true}if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeAddressEventData.value.address.country,postalCode:stripeStore.stripeAddressEventData.value.address.postal_code,state:stripeStore.stripeAddressEventData.value.address.state}}if(stripeStore.stripeBillingAddressEventData){stripeStore.stripeBillingAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeBillingAddressEventData.value.address.country,postalCode:stripeStore.stripeBillingAddressEventData.value.address.postal_code,state:stripeStore.stripeBillingAddressEventData.value.address.state}}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}f.label=1;case 1:f.trys.push([1,3,,7]);cartStoreResetCartItems();return[4,stripeCalculateLandedCost()];case 2:f.sent();c=(r=cartStore.shippingData)===null||r===void 0?void 0:r.find(Boolean);l=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find((function(e){return e.landedCost.shipmentRating.id===(c===null||c===void 0?void 0:c.id)}));u=!!l?l.subtotals:null;if(u){cartStoreApplySubtotals({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:u})}return[3,7];case 3:v=f.sent();cartStore.landedCostData=[];cartStore.shippingData=[];S=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!S.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,stripeStorePrefetchLandedCost(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:f.sent();return[2,{isRequestNotReady:false}];case 5:p=(n=stripeStore.stripeAddressEventData)===null||n===void 0?void 0:n.value;void sendErrorLog({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:p}});f.label=6;case 6:logError(v);return[3,7];case 7:stripeStore.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))};var stripeStoreApplyPromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:return[4,stripeStorePrefetchLandedCost({applyingPromocode:true})];case 1:n.sent();if(cartStore.step==="payment"){cartStorePreviousStep()}return[4,stripeStoreAsyncAddressUpdate()];case 2:n.sent();r=(e=cartStore.shippingData)===null||e===void 0?void 0:e.find(Boolean);o=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.id===(r===null||r===void 0?void 0:r.id)}));if(!r||!o){return[2]}return[4,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:false,landedCostId:o.landedCostId,selectedShippingOption:r})];case 3:n.sent();return[2]}}))}))};var stripeStoreResetPromoCode=function(){cartStore.promoCode="";sessionStorage.removeItem("zonos--promo-code");cartStore.promoCodeError=false;cartStore.promoCodeApplied=false};var stripeStoreRemovePromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(cartStore.step==="payment"){cartStorePreviousStep()}stripeStoreResetPromoCode();return[4,stripeStoreApplyPromoCode()];case 1:e.sent();return[2]}}))}))};var stripeStoreMessageBasedOnStatus=function(e){var t=[];var r=true;var o=window.Zonos.isCollect;switch(e){case"succeeded":{t=[translate("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."),"",translate("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(o){t=[translate("Thank you for submitting your payment. We appreciate your prompt attention."),"",translate("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.")]}r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];if(o){t=[translate("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{r=false;t=[translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};var stripeStoreHandleInventoryCheck=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,s;return __generator(this,(function(c){switch(c.label){case 0:r=zonosStore.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,handleFetch("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:n=c.sent(),i=n.errors,a=n.json;if(i.length||!a){logError("Error occurs when handling inventory refund","warn",JSON.stringify(i));return[2,null]}if(!a.available||a.status===204){return[2,translate("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(a.available||a.status===200){stripeStore.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}c.label=3;case 3:c.trys.push([3,5,,6]);return[4,r({items:cartStore.items})];case 4:s=c.sent();return[2,s];case 5:d=c.sent();s=d instanceof Error?d.message:"Unknown error";void sendErrorLog({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(s)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:cartStore.items}});throw d;case 6:return[2]}}))}))};var stripeStoreHandleInventoryRefund=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:r=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!r){return[2]}return[4,handleFetch("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:o.sent();return[2]}}))}))};var stripeStoreRetrievePayment=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.clientSecret,u=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(u){t=stripeStoreMessageBasedOnStatus(u),r=t.isError,o=t.messages;return[2,{error:r,messages:o}]}n=l||stripeStore.clientSecret;if(!stripeStore.stripe||!n){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[translate("Something went wrong.")]}]}return[4,stripeStore.stripe.retrievePaymentIntent(n)];case 1:i=e.sent().paymentIntent;a=i===null||i===void 0?void 0:i.status;s=stripeStoreMessageBasedOnStatus(a),d=s.isError,c=s.messages;return[2,{error:d,messages:c,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:a}]}}))}))};var stripeStoreConfirmPayment=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,v;return __generator(this,(function(S){switch(S.label){case 0:o=!!((t=stripeStore.stripePaymentEventData)===null||t===void 0?void 0:t.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;stripeStore.customErrorMessage=null;if(!((r=cartStore.selectedLandedCost)===null||r===void 0?void 0:r.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,validateCheckoutSession()];case 1:s=S.sent();if(!s.valid){stripeStore.customErrorMessage=s.errorMessage;throw new Error(s.errorMessage)}d=storageStore.checkoutSessionId;if(!(i&&n&&o&&a&&d))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",a);c.searchParams.set("zonosCheckoutSessionId",d);void trackConversionEvent({checkoutSessionId:d,eventName:"checkout_paymentInfoCompleted"});return[4,i.confirmPayment({confirmParams:{return_url:c.toString()},elements:n,redirect:"if_required"})];case 2:l=S.sent(),u=l.error,v=l.paymentIntent;log("Payment intent confirmed","info",{error:u,paymentIntent:v});if((v===null||v===void 0?void 0:v.status)==="requires_action"){throw new Error(translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(u){if(u.type==="card_error"||u.type==="validation_error"){throw new Error(u.message)}if(u.type==="invalid_request_error"){if(u.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(v.status==="requires_payment_method"){throw new Error(translate("Payment failed. Please try another payment method."))}S.label=3;case 3:return[2]}}))}))};var getCheckoutSessionBody=function(){var e;var t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);var r=storageStore.enabledVariantTestKeys||[];var o={adjustmentsAmount:cartStore.adjustments.reduce((function(e,t){return e+t.amount}),0),cartId:window.Zonos.cartId,currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:localizationStore.selectedLocale}],presentmentCountryCode:localizationStore.selectedCountryCode,skipPaymentIntent:stripeStore.skipPaymentIntent,varianceTestInput:r};return o};var stripeStoreGetPaymentIntent=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2]}return[4,handleFetch("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:storageStore.checkoutSessionId},method:"POST"})];case 1:t=i.sent(),r=t.errors,o=t.json;n=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(r.length||!n){logError("Error occurs when getting payment intent",JSON.stringify(r,null,2));void sendErrorLog({endpoint:"Error creating payment intent",errors:r.map((function(e){return e.message})),metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,clientSecret:n}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2]}cartStoreSetCheckoutSession(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))};var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:if(!localizationStore.targetCurrency){logError("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}stripeStore.isFetchingSession=true;r=getCheckoutSessionBody();log("Checkout session body","info",r);return[4,handleFetch("/api/zonos-elements/create-checkout-session",{body:r,method:"POST"})];case 1:o=d.sent(),n=o.errors,i=o.json;stripeStore.isFetchingSession=false;if(n.length||!i){a=(e=n.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(a)&&a.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}logError("Error occurred when creating checkout session",JSON.stringify(n,null,2));return[2,false]}s=i.checkoutSessionCreate;cartStoreSetCheckoutSession(s);cartStoreApplySubtotals({method:((t=s.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:s.subtotals});log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2,true]}}))}))};var stripeStoreUpdateCheckoutSessionBaseCurrency=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:e=storageStore.checkoutSessionId;if(!e){logError("Failed to update checkout session base currency");return[2,false]}if(zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){log('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,handleFetch("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:stripeStore.checkoutSettlementCurrency},method:"POST"})];case 1:t=o.sent().json;r=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||r!==stripeStore.checkoutSettlementCurrency){logError("Failed to update checkout session base currency");return[2,false]}log('Updated checkout session to settlement currency "'.concat(r,'".'));return[2,true]}}))}))};var stripeStoreUpdateCheckoutSession=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustmentsAmount,a=e.cartId,s=e.currency,d=e.id,c=e.itemsAmount,l=e.landedCostId,u=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:t=storageStore.enabledVariantTestKeys||[];return[4,handleFetch("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:i,billToPartyId:stripeStore.partyBillingId,cartId:a,currency:s,customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,id:d,itemsAmount:c,landedCostId:l,metadata:[{key:"language",value:localizationStore.selectedLocale}],presentmentCountryCode:u,shipToPartyId:stripeStore.partyShippingId,skipPaymentIntent:stripeStore.skipPaymentIntent,varianceTestInput:t},method:"POST"})];case 1:r=e.sent(),o=r.errors,n=r.json;if(o.length||!n){logError("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:n}]}return[2,{errors:[],json:n}]}}))}))};var buildTranslatedAddress=function(e){var t,r,o,n,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var c={};if(!d){return c}var l=d.city,u=d.line1,v=d.line2,S=d.name,p=d.postal_code,f=d.state;if(s.city&&l){c.city=(t={},t[s.city]=l,t)}if(s.line1&&u){c.line1=(r={},r[s.line1]=u,r)}if(s.line2&&v){c.line2=(o={},o[s.line2]=v,o)}if(s.postal_code&&p){c.postal_code=(n={},n[s.postal_code]=p,n)}if(s.state&&f){c.state=(i={},i[s.state]=f,i)}if(s.name&&S){c.name=(a={},a[s.name]=S,a)}return c};var stripeStoreTranslateAddressToLatin=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u;var v=e.addressInvalidCharactersList,S=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=buildTranslateRequest({addressInvalidCharactersList:v,billingAddressInvalidCharactersList:S,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeBillingAddressEventData:stripeStore.stripeBillingAddressEventData,stripeShippingSameAsBilling:stripeStore.stripeShippingSameAsBilling});if(!i){stripeStore.translatedAddress={address:{},billingAddress:{}};return[2]}a=checkIsAddressOutdatedForValidation();if(!a){return[2]}return[4,handleFetch("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,c=s.json;if(d.length||!c){logError("Error occurs when translating address to latin",JSON.stringify(d,null,2));stripeStore.translatedAddress={address:{},billingAddress:{}};return[2]}stripeStore.stripeAddressUsedWhenValidatingAddress=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenValidatingAddress=stripeStore.stripeBillingAddressEventData;l=(t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value.address;u=(r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value.address;stripeStore.translatedAddress={address:l?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},l),{name:(o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:!stripeStore.stripeShippingSameAsBilling?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},u),{name:(n=stripeStore.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.name}),translatedAddressResult:c.billingAddress||null}):{}};return[2]}}))}))};stripeStoreOnChange("clientSecret",(function(e){if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var _o=createStore((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:getIsStagingMode(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),cartStoreOnChange=_o.onChange,reset=_o.reset,cartStore=_o.state;var getTransitUnit=function(e){switch(e){case"DAYS":return translate("days");case"WEEKS":return translate("weeks");case"BUSINESS_DAYS":default:return translate("business days")}};var cartStoreGetShippingTransitInfo=function(e){var t;var r=(t=e.shippingProfile)===null||t===void 0?void 0:t.transitTime;if(!(r===null||r===void 0?void 0:r.min)||!(r===null||r===void 0?void 0:r.max)||!(r===null||r===void 0?void 0:r.type)){return null}return{maxTransit:r.max,minTransit:r.min,unit:getTransitUnit(r.type)}};var getMatchItem=function(e){var t=e.item1,r=e.item2;if(!t||!r){return false}return r.sku&&t.sku&&t.sku===r.sku||r.description&&t.description&&t.description===r.description||t.name&&r.name&&t.name===r.name};var cartStoreCheckItemRestrictions=function(e){log("Checking item restrictions");var t=e.map((function(e){if(!e.restriction){return null}var t=e.restriction;var r=cartStore.items.find((function(t){return getMatchItem({item1:t,item2:e})}));return Object.assign(Object.assign({matchedItem:r},e),{restriction:t})})).filter(Boolean);cartStore.restrictedItems=t;cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!t.find((function(t){return getMatchItem({item1:t,item2:e})}))})}));return{cartItems:cartStore.items,restrictedItems:t}};var cartStoreReset=function(){storageStore.checkoutSessionId=null;reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStoreReset();stripeStoreReset();cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){var t=e.dutiesTaxesFeesEstimate,r=e.method,o=e.subtotals;cartStore.exchangeRate=o.exchangeRate;cartStore.adjustmentTotal=o.adjustments;cartStore.dutiesTaxesFees=r==="DAP"?null:o.landedCostTotal;cartStore.subtotal=o.items;cartStore.total=o.total;cartStore.currency=o.presentmentCurrencyCode;cartStore.dutiesTaxesFeesEstimate=t||null};var cartStoreHasOneEligibleItem=function(){var e=cartStore.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))};var cartStoreSetCheckoutSession=function(e){var t,r,o,n,i;stripeStore.clientSecret=e.clientSecret;stripeStore.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;stripeStore.customerProfile=e.customerProfile;cartStore.checkoutSession=e;if(!e.id){void sendErrorLog({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:allLogs,checkoutSession:e}})}if(e.id){storageStore.checkoutSessionId=e.id}var a=filterValidTests(e.varianceTestResults||[]);storageStoreSetEnabledVariantTestKeys(a);var s=((o=(r=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.metadata)===null||r===void 0?void 0:r.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((i=(n=window.Zonos.cartData)===null||n===void 0?void 0:n.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||i===void 0?void 0:i.value)||null;if(s){log("Found externalConfirmationPageURL: ".concat(s));cartStore.externalConfirmationPageURL=s}};var cartStoreReCalculateTotal=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a;var s=e.adjustmentsAmount,d=e.cartId,c=e.currency,l=e.dutiesTaxesFeesEstimate,u=e.itemsAmount,v=e.landedCostId,S=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(v&&cartStore.selectedLandedCost){r=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:l,method:cartStore.landedCostMethod,subtotals:r});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}if(!storageStore.checkoutSessionId){log("Could not update cart total without checkout session id","info");return[2,false]}return[4,stripeStoreUpdateCheckoutSession({adjustmentsAmount:s,billToPartyId:stripeStore.partyBillingId,cartId:d,currency:c,id:storageStore.checkoutSessionId,itemsAmount:u,landedCostId:v,presentmentCountryCode:localizationStore.selectedCountryCode,shipToPartyId:stripeStore.partyShippingId,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 1:o=e.sent(),n=o.errors,i=o.json;if(!(n.length>0||!i))return[3,4];logError("Error occurs when updating checkout session.");if(!S)return[3,3];log("Initiating checkout session on failure","info");return[4,stripeStoreInitCheckoutSession()];case 2:a=e.sent();log("stripeStoreInitCheckoutSession: ".concat(a));if(!a){cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!v){cartStoreApplySubtotals({method:((t=i.checkoutSessionUpdate.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:i.checkoutSessionUpdate.subtotals});log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}cartStoreSetCheckoutSession(i.checkoutSessionUpdate);return[2,true]}}))}))};var cartStoreGetMethod=function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u,v,S,p,f,h,m,g,y,w,C,b,A,O,_;var k=e.applySubtotalsOnly,I=e.landedCostId,E=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:log("Updating selected shipping option","info",{landedCostId:I,selectedShippingOption:E});cartStore.selectedShippingOption=E;v=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);if(v){S=v.maxTransit,p=v.minTransit,f=v.unit;cartStore.selectedShippingOptionTransitTime="".concat(p,"-").concat(S," ").concat(f)}else{cartStore.selectedShippingOptionTransitTime=""}h=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===I}));cartStore.selectedLandedCost=h||null;if(!h){return[2,false]}m=((r=h.landedCost.amountSubtotals)===null||r===void 0?void 0:r.landedCostTotal)||0;g=h.subtotals.exchangeRate.rate;y=m*g;if(y){log("DAP quote, using estimate: ".concat(y),"info")}cartStore.landedCostMethod=cartStoreGetMethod(h.landedCost);cartStore.shipping=h.subtotals.shipping;w=((o=h===null||h===void 0?void 0:h.landedCost)===null||o===void 0?void 0:o.landedCostGuaranteeCode)==="ZONOS";C=!!((i=(n=h===null||h===void 0?void 0:h.landedCost)===null||n===void 0?void 0:n.deMinimis)===null||i===void 0?void 0:i.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=C;cartStore.isSelectedShippingGuarantee=w;b=false;if(!k)return[3,1];A=h.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:y,method:cartStore.landedCostMethod,subtotals:A});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate);b=true;return[3,3];case 1:return[4,cartStoreReCalculateTotal({adjustmentsAmount:cartStore.adjustmentTotal,billToPartyId:stripeStore.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:y,landedCostId:(a=h.landedCost)===null||a===void 0?void 0:a.id,shipToPartyId:stripeStore.partyShippingId,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 2:b=e.sent();e.label=3;case 3:O=(s=cartStore.items.find(Boolean))===null||s===void 0?void 0:s.currencyCode;_=((d=stripeStore.stripeAddressEventData)===null||d===void 0?void 0:d.value.address.country)||"US";stripeStore.shouldRenderPayInUsdButton=O==="USD"&&zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((c=cartStore.checkoutSession)===null||c===void 0?void 0:c.subtotals.presentmentCurrencyCode)!=="USD"&&!!((u=(l=zonosStore.genericSettings)===null||l===void 0?void 0:l.usdSettlementCountryEnabled)===null||u===void 0?void 0:u.includes(_));return[2,b]}}))}))};var cartStoreStartCheckoutInterval=function(e){var t=e.isPreview,r=e.sessionTimeout;if(t){return}var o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):r;log("==START CHECKOUT TIMEOUT - ".concat(n,"=="));cartStore.checkoutTimeoutInterval=setTimeout((function(){cartStore.checkoutSessionTimeoutShow=true}),n)};var cartStoreClearCheckoutInterval=function(){if(cartStore.checkoutTimeoutInterval){clearTimeout(cartStore.checkoutTimeoutInterval);cartStore.checkoutTimeoutInterval=null}};var getCartItemToUse=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var cartStoreResetCartItems=function(){cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));cartStore.restrictedItems=[]};var cartStoreUpdateItems=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,d=e.shouldInitSessionOnFailure,c=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:cartStore.adjustments=i;cartStore.items=getCartItemToUse(a);r=(t=a.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=a.reduce((function(e,t){return e+t.amount*t.quantity}),0);n=i.reduce((function(e,t){return e+t.amount}),0);if(!r||!o){return[2]}cartStore.currency=r;stripeStore.isFetchingSession=true;return[4,cartStoreReCalculateTotal({adjustmentsAmount:n,billToPartyId:stripeStore.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:s,shipToPartyId:stripeStore.partyShippingId,shouldInitSessionOnFailure:c,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 1:e.sent();stripeStore.isFetchingSession=false;return[2]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionTransitTime="";cartStore.dutiesTaxesFees=0;cartStore.dutiesTaxesFeesEstimate=0;cartStore.shipping=0;cartStore.total=cartStore.subtotal};var cartStorePreviousStep=function(){if(cartStore.step==="shipping"){cartStore.step="customer-info";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="payment"){cartStore.step="shipping";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="finish"){cartStore.step="payment";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false})})}};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:true})})}else if(cartStore.step==="shipping"){cartStore.step="payment";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:true})})}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStoreResetTabItems=function(){cartStore.step="customer-info";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})});cartStoreResetSelectedShippingOption()};export{stripeStoreOnChange as A,stripeStoreBuildAddressForPartyCreate as B,cartStoreUpdateSelectedShippingOption as C,cartStoreHasOneEligibleItem as D,stripeStoreApplyPromoCode as E,stripeStoreRemovePromoCode as F,stripeStoreResetPromoCode as G,stripeStoreMessageBasedOnStatus as H,stripeStoreTranslateAddressToLatin as I,extractName as J,cartStoreOnChange as K,stripeStoreAsyncAddressUpdate as L,cartStoreGetShippingTransitInfo as M,cartStoreGetMethod as N,sortServiceLevelOptionsByAmount as O,stripeStoreCleanupDomesticShippingSession as a,stripeStoreSaveDomesticShippingSession as b,stripeStore as c,stripeStoreRetrievePayment as d,cartStore as e,cartStoreUpdateItems as f,cartStoreReset as g,cartStoreResetTabItems as h,initStripeElements as i,cartStoreClearCheckoutInterval as j,stripeStoreInitCheckoutSession as k,stripeStoreGetPaymentIntent as l,cartStoreStartCheckoutInterval as m,getCheckoutSessionBody as n,cartStoreUpdateToErrorState as o,cartStoreSetCheckoutSession as p,stripeStorePrefetchLandedCost as q,cartStoreNextStep as r,stripeStoreGetDomesticShippingSession as s,trackConversionEvent as t,stripeStoreUpdateCheckoutSessionBaseCurrency as u,stripeStoreHandleInventoryCheck as v,stripeStoreConfirmPayment as w,stripeStoreHandleInventoryRefund as x,stripeStoreReset as y,validateCheckoutSession as z};
@@ -0,0 +1 @@
1
+ function extend(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r){if(r.hasOwnProperty(t))e[t]=r[t]}}return e}function repeat(e,n){return Array(n+1).join(e)}function trimLeadingNewlines(e){return e.replace(/^\n*/,"")}function trimTrailingNewlines(e){var n=e.length;while(n>0&&e[n-1]==="\n")n--;return e.substring(0,n)}var blockElements=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function isBlock(e){return is(e,blockElements)}var voidElements=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function isVoid(e){return is(e,voidElements)}function hasVoid(e){return has(e,voidElements)}var meaningfulWhenBlankElements=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function isMeaningfulWhenBlank(e){return is(e,meaningfulWhenBlankElements)}function hasMeaningfulWhenBlank(e){return has(e,meaningfulWhenBlankElements)}function is(e,n){return n.indexOf(e.nodeName)>=0}function has(e,n){return e.getElementsByTagName&&n.some((function(n){return e.getElementsByTagName(n).length}))}var rules={};rules.paragraph={filter:"p",replacement:function(e){return"\n\n"+e+"\n\n"}};rules.lineBreak={filter:"br",replacement:function(e,n,r){return r.br+"\n"}};rules.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,n,r){var t=Number(n.nodeName.charAt(1));if(r.headingStyle==="setext"&&t<3){var i=repeat(t===1?"=":"-",e.length);return"\n\n"+e+"\n"+i+"\n\n"}else{return"\n\n"+repeat("#",t)+" "+e+"\n\n"}}};rules.blockquote={filter:"blockquote",replacement:function(e){e=e.replace(/^\n+|\n+$/g,"");e=e.replace(/^/gm,"> ");return"\n\n"+e+"\n\n"}};rules.list={filter:["ul","ol"],replacement:function(e,n){var r=n.parentNode;if(r.nodeName==="LI"&&r.lastElementChild===n){return"\n"+e}else{return"\n\n"+e+"\n\n"}}};rules.listItem={filter:"li",replacement:function(e,n,r){e=e.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var t=r.bulletListMarker+" ";var i=n.parentNode;if(i.nodeName==="OL"){var u=i.getAttribute("start");var a=Array.prototype.indexOf.call(i.children,n);t=(u?Number(u)+a:a+1)+". "}return t+e+(n.nextSibling&&!/\n$/.test(e)?"\n":"")}};rules.indentedCodeBlock={filter:function(e,n){return n.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,n,r){return"\n\n "+n.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}};rules.fencedCodeBlock={filter:function(e,n){return n.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,n,r){var t=n.firstChild.getAttribute("class")||"";var i=(t.match(/language-(\S+)/)||[null,""])[1];var u=n.firstChild.textContent;var a=r.fence.charAt(0);var l=3;var o=new RegExp("^"+a+"{3,}","gm");var s;while(s=o.exec(u)){if(s[0].length>=l){l=s[0].length+1}}var f=repeat(a,l);return"\n\n"+f+i+"\n"+u.replace(/\n$/,"")+"\n"+f+"\n\n"}};rules.horizontalRule={filter:"hr",replacement:function(e,n,r){return"\n\n"+r.hr+"\n\n"}};rules.inlineLink={filter:function(e,n){return n.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,n){var r=n.getAttribute("href");if(r)r=r.replace(/([()])/g,"\\$1");var t=cleanAttribute(n.getAttribute("title"));if(t)t=' "'+t.replace(/"/g,'\\"')+'"';return"["+e+"]("+r+t+")"}};rules.referenceLink={filter:function(e,n){return n.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,n,r){var t=n.getAttribute("href");var i=cleanAttribute(n.getAttribute("title"));if(i)i=' "'+i+'"';var u;var a;switch(r.linkReferenceStyle){case"collapsed":u="["+e+"][]";a="["+e+"]: "+t+i;break;case"shortcut":u="["+e+"]";a="["+e+"]: "+t+i;break;default:var l=this.references.length+1;u="["+e+"]["+l+"]";a="["+l+"]: "+t+i}this.references.push(a);return u},references:[],append:function(e){var n="";if(this.references.length){n="\n\n"+this.references.join("\n")+"\n\n";this.references=[]}return n}};rules.emphasis={filter:["em","i"],replacement:function(e,n,r){if(!e.trim())return"";return r.emDelimiter+e+r.emDelimiter}};rules.strong={filter:["strong","b"],replacement:function(e,n,r){if(!e.trim())return"";return r.strongDelimiter+e+r.strongDelimiter}};rules.code={filter:function(e){var n=e.previousSibling||e.nextSibling;var r=e.parentNode.nodeName==="PRE"&&!n;return e.nodeName==="CODE"&&!r},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");var n=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"";var r="`";var t=e.match(/`+/gm)||[];while(t.indexOf(r)!==-1)r=r+"`";return r+n+e+n+r}};rules.image={filter:"img",replacement:function(e,n){var r=cleanAttribute(n.getAttribute("alt"));var t=n.getAttribute("src")||"";var i=cleanAttribute(n.getAttribute("title"));var u=i?' "'+i+'"':"";return t?"!["+r+"]"+"("+t+u+")":""}};function cleanAttribute(e){return e?e.replace(/(\n+\s*)+/g,"\n"):""}function Rules(e){this.options=e;this._keep=[];this._remove=[];this.blankRule={replacement:e.blankReplacement};this.keepReplacement=e.keepReplacement;this.defaultRule={replacement:e.defaultReplacement};this.array=[];for(var n in e.rules)this.array.push(e.rules[n])}Rules.prototype={add:function(e,n){this.array.unshift(n)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var n;if(n=findRule(this.array,e,this.options))return n;if(n=findRule(this._keep,e,this.options))return n;if(n=findRule(this._remove,e,this.options))return n;return this.defaultRule},forEach:function(e){for(var n=0;n<this.array.length;n++)e(this.array[n],n)}};function findRule(e,n,r){for(var t=0;t<e.length;t++){var i=e[t];if(filterValue(i,n,r))return i}return void 0}function filterValue(e,n,r){var t=e.filter;if(typeof t==="string"){if(t===n.nodeName.toLowerCase())return true}else if(Array.isArray(t)){if(t.indexOf(n.nodeName.toLowerCase())>-1)return true}else if(typeof t==="function"){if(t.call(e,n,r))return true}else{throw new TypeError("`filter` needs to be a string, array, or function")}}function collapseWhitespace(e){var n=e.element;var r=e.isBlock;var t=e.isVoid;var i=e.isPre||function(e){return e.nodeName==="PRE"};if(!n.firstChild||i(n))return;var u=null;var a=false;var l=null;var o=next(l,n,i);while(o!==n){if(o.nodeType===3||o.nodeType===4){var s=o.data.replace(/[ \r\n\t]+/g," ");if((!u||/ $/.test(u.data))&&!a&&s[0]===" "){s=s.substr(1)}if(!s){o=remove(o);continue}o.data=s;u=o}else if(o.nodeType===1){if(r(o)||o.nodeName==="BR"){if(u){u.data=u.data.replace(/ $/,"")}u=null;a=false}else if(t(o)||i(o)){u=null;a=true}else if(u){a=false}}else{o=remove(o);continue}var f=next(l,o,i);l=o;o=f}if(u){u.data=u.data.replace(/ $/,"");if(!u.data){remove(u)}}}function remove(e){var n=e.nextSibling||e.parentNode;e.parentNode.removeChild(e);return n}function next(e,n,r){if(e&&e.parentNode===n||r(n)){return n.nextSibling||n.parentNode}return n.firstChild||n.nextSibling||n.parentNode}var root=typeof window!=="undefined"?window:{};function canParseHTMLNatively(){var e=root.DOMParser;var n=false;try{if((new e).parseFromString("","text/html")){n=true}}catch(e){}return n}function createHTMLParser(){var e=function(){};{if(shouldUseActiveX()){e.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");n.designMode="on";n.open();n.write(e);n.close();return n}}else{e.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");n.open();n.write(e);n.close();return n}}}return e}function shouldUseActiveX(){var e=false;try{document.implementation.createHTMLDocument("").open()}catch(n){if(root.ActiveXObject)e=true}return e}var HTMLParser=canParseHTMLNatively()?root.DOMParser:createHTMLParser();function RootNode(e,n){var r;if(typeof e==="string"){var t=htmlParser().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");r=t.getElementById("turndown-root")}else{r=e.cloneNode(true)}collapseWhitespace({element:r,isBlock:isBlock,isVoid:isVoid,isPre:n.preformattedCode?isPreOrCode:null});return r}var _htmlParser;function htmlParser(){_htmlParser=_htmlParser||new HTMLParser;return _htmlParser}function isPreOrCode(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Node(e,n){e.isBlock=isBlock(e);e.isCode=e.nodeName==="CODE"||e.parentNode.isCode;e.isBlank=isBlank(e);e.flankingWhitespace=flankingWhitespace(e,n);return e}function isBlank(e){return!isVoid(e)&&!isMeaningfulWhenBlank(e)&&/^\s*$/i.test(e.textContent)&&!hasVoid(e)&&!hasMeaningfulWhenBlank(e)}function flankingWhitespace(e,n){if(e.isBlock||n.preformattedCode&&e.isCode){return{leading:"",trailing:""}}var r=edgeWhitespace(e.textContent);if(r.leadingAscii&&isFlankedByWhitespace("left",e,n)){r.leading=r.leadingNonAscii}if(r.trailingAscii&&isFlankedByWhitespace("right",e,n)){r.trailing=r.trailingNonAscii}return{leading:r.leading,trailing:r.trailing}}function edgeWhitespace(e){var n=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:n[1],leadingAscii:n[2],leadingNonAscii:n[3],trailing:n[4],trailingNonAscii:n[5],trailingAscii:n[6]}}function isFlankedByWhitespace(e,n,r){var t;var i;var u;if(e==="left"){t=n.previousSibling;i=/ $/}else{t=n.nextSibling;i=/^ /}if(t){if(t.nodeType===3){u=i.test(t.nodeValue)}else if(r.preformattedCode&&t.nodeName==="CODE"){u=false}else if(t.nodeType===1&&!isBlock(t)){u=i.test(t.textContent)}}return u}var reduce=Array.prototype.reduce;var escapes=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function TurndownService(e){if(!(this instanceof TurndownService))return new TurndownService(e);var n={rules:rules,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:false,blankReplacement:function(e,n){return n.isBlock?"\n\n":""},keepReplacement:function(e,n){return n.isBlock?"\n\n"+n.outerHTML+"\n\n":n.outerHTML},defaultReplacement:function(e,n){return n.isBlock?"\n\n"+e+"\n\n":e}};this.options=extend({},n,e);this.rules=new Rules(this.options)}TurndownService.prototype={turndown:function(e){if(!canConvert(e)){throw new TypeError(e+" is not a string, or an element/document/fragment node.")}if(e==="")return"";var n=process.call(this,new RootNode(e,this.options));return postProcess.call(this,n)},use:function(e){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.use(e[n])}else if(typeof e==="function"){e(this)}else{throw new TypeError("plugin must be a Function or an Array of Functions")}return this},addRule:function(e,n){this.rules.add(e,n);return this},keep:function(e){this.rules.keep(e);return this},remove:function(e){this.rules.remove(e);return this},escape:function(e){return escapes.reduce((function(e,n){return e.replace(n[0],n[1])}),e)}};function process(e){var n=this;return reduce.call(e.childNodes,(function(e,r){r=new Node(r,n.options);var t="";if(r.nodeType===3){t=r.isCode?r.nodeValue:n.escape(r.nodeValue)}else if(r.nodeType===1){t=replacementForNode.call(n,r)}return join(e,t)}),"")}function postProcess(e){var n=this;this.rules.forEach((function(r){if(typeof r.append==="function"){e=join(e,r.append(n.options))}}));return e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function replacementForNode(e){var n=this.rules.forNode(e);var r=process.call(this,e);var t=e.flankingWhitespace;if(t.leading||t.trailing)r=r.trim();return t.leading+n.replacement(r,e,this.options)+t.trailing}function join(e,n){var r=trimTrailingNewlines(e);var t=trimLeadingNewlines(n);var i=Math.max(e.length-r.length,n.length-t.length);var u="\n\n".substring(0,i);return r+u+t}function canConvert(e){return e!=null&&(typeof e==="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var turndownService=new TurndownService;var cleanHtmlMarkdown=function(e){var n=turndownService.turndown(e);var r=n.replace(/^\#+\s+/gm,"").trim();if(!r){return[]}var t=r.split(/[\n\r]+/gm);return t};export{cleanHtmlMarkdown as c};