@zonos/elements 1.3.233 → 1.3.235

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 (420) hide show
  1. package/dist/cjs/{cart-bc615014.js → cart-22ced7cc.js} +33 -29
  2. package/dist/cjs/{shouldRenderTaxIdInput-9b8a8de1.js → containsNonLatinChars-2be5129b.js} +0 -23
  3. package/dist/cjs/{hasInclusivePrice-84145546.js → hasInclusivePrice-ca85cabd.js} +1 -1
  4. package/dist/cjs/index.cjs.js +11 -7
  5. package/dist/cjs/invoice-8fd4242c.js +151 -0
  6. package/dist/cjs/{renderFallback-c2576fbe.js → isCollectMobileTablet-7962c57f.js} +2 -11
  7. package/dist/cjs/isInvoiceMobileTablet-dde41e4e.js +15 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{translationStore-08d3ff9c.js → localization-8ef6250a.js} +1059 -1
  10. package/dist/cjs/{paypal-1d6f1a71.js → paypal-4a086f84.js} +7 -8
  11. package/dist/cjs/placeTestOrder-f25d08ee.js +45 -0
  12. package/dist/cjs/{placeTestOrder-a5469e40.js → renderCheckoutCurrency-5494e45b.js} +2 -42
  13. package/dist/cjs/renderFallback-78b54537.js +12 -0
  14. package/dist/cjs/shouldRenderTaxIdInput-eda13ef8.js +25 -0
  15. package/dist/cjs/throttle-7dd64984.js +76 -0
  16. package/dist/cjs/{zonos-address_11.cjs.entry.js → zonos-address-display_9.cjs.entry.js} +62 -668
  17. package/dist/cjs/zonos-address_4.cjs.entry.js +715 -0
  18. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  19. package/dist/cjs/{zonos-banner_2.cjs.entry.js → zonos-banner.cjs.entry.js} +0 -40
  20. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  21. package/dist/cjs/{zonos-empty-state-payment_4.cjs.entry.js → zonos-card_5.cjs.entry.js} +44 -6
  22. package/dist/cjs/{zonos-cart-items_13.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +75 -92
  23. package/dist/cjs/zonos-checkout.cjs.entry.js +20 -21
  24. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  25. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +5 -6
  26. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +66 -65
  27. package/dist/cjs/zonos-collect.cjs.entry.js +25 -25
  28. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  29. package/dist/cjs/zonos-controller.cjs.entry.js +39 -10
  30. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -2
  31. package/dist/cjs/zonos-country-select_4.cjs.entry.js +10 -11
  32. package/dist/cjs/zonos-elements.cjs.js +1 -1
  33. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +30 -31
  34. package/dist/cjs/zonos-hello.cjs.entry.js +7 -8
  35. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  36. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +94 -0
  37. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +686 -0
  38. package/dist/cjs/zonos-invoice.cjs.entry.js +468 -0
  39. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -6
  40. package/dist/cjs/zonos-link.cjs.entry.js +24 -0
  41. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  42. package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
  43. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  44. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  45. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  46. package/dist/collection/collection-manifest.json +8 -0
  47. package/dist/collection/components/checkout/zonos-invoice/assets/ChevronDownIcon.svg +1 -0
  48. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/assets/empty-item.jpeg +0 -0
  49. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.css +72 -0
  50. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +87 -0
  51. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/RemoveIcon.svg +1 -0
  52. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/SuccessIcon.svg +1 -0
  53. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.css +90 -0
  54. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +405 -0
  55. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/chevronDownIcon.svg +1 -0
  56. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/globe.svg +3 -0
  57. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconDark.svg +10 -0
  58. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconLight.svg +10 -0
  59. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosWordmark.svg +7 -0
  60. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.css +155 -0
  61. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +165 -0
  62. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronDownIcon.svg +1 -0
  63. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronUpIcon.svg +1 -0
  64. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.css +117 -0
  65. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +175 -0
  66. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/CheckmarkLineIcon.svg +1 -0
  67. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/RemoveLineIcon.svg +1 -0
  68. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.css +98 -0
  69. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +368 -0
  70. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.css +71 -0
  71. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +151 -0
  72. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.css +83 -0
  73. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +65 -0
  74. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.css +350 -0
  75. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +547 -0
  76. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  77. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  78. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  79. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  80. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  81. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  82. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  83. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  84. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  85. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  86. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
  87. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  88. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  89. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  90. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  91. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  92. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  93. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  94. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
  95. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +5 -5
  96. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  97. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  98. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  99. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  100. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  101. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  102. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  103. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  104. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  105. package/dist/collection/components/main/zonos-controller.js +45 -4
  106. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  107. package/dist/collection/components/store/checkout/invoice.js +148 -0
  108. package/dist/collection/components/store/checkout/stripe.js +8 -3
  109. package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
  110. package/dist/collection/components/store/translationStore/strings.base.js +9 -0
  111. package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
  112. package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
  113. package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
  114. package/dist/collection/components/store/translationStore/strings.french.js +9 -0
  115. package/dist/collection/components/store/translationStore/strings.german.js +9 -0
  116. package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
  117. package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
  118. package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
  119. package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
  120. package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
  121. package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
  122. package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
  123. package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
  124. package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
  125. package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
  126. package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
  127. package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
  128. package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
  129. package/dist/collection/components/stripe/zonos-address/zonos-address.js +8 -5
  130. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  131. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  132. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  133. package/dist/collection/components/utils/checkout/initInvoice.js +15 -0
  134. package/dist/collection/components/utils/checkout/isInvoiceMobileTablet.js +10 -0
  135. package/dist/collection/scripts/_zonosBase.js +4 -0
  136. package/dist/collection/types/generated/graphql.frontend.types.js +4 -0
  137. package/dist/collection/types/generated/graphql.internal.types.js +239 -5
  138. package/dist/esm/{cart-14f305b3.js → cart-66aecbb3.js} +9 -5
  139. package/dist/esm/{shouldRenderTaxIdInput-8bc112bb.js → containsNonLatinChars-2d8810c3.js} +1 -23
  140. package/dist/esm/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
  141. package/dist/esm/index.js +11 -7
  142. package/dist/esm/invoice-c7452847.js +146 -0
  143. package/dist/esm/{renderFallback-dbf1e3ae.js → isCollectMobileTablet-921002b0.js} +3 -11
  144. package/dist/esm/isInvoiceMobileTablet-1f7b614e.js +12 -0
  145. package/dist/esm/loader.js +1 -1
  146. package/dist/esm/{translationStore-690c4e04.js → localization-04b05867.js} +1041 -2
  147. package/dist/esm/{paypal-fded8844.js → paypal-56564874.js} +2 -3
  148. package/dist/esm/placeTestOrder-6b9eda9e.js +43 -0
  149. package/dist/esm/{placeTestOrder-2250f719.js → renderCheckoutCurrency-cb808110.js} +3 -42
  150. package/dist/esm/renderFallback-3f010b48.js +10 -0
  151. package/dist/esm/shouldRenderTaxIdInput-d45ceeb4.js +23 -0
  152. package/dist/esm/throttle-ce2432ab.js +74 -0
  153. package/dist/esm/{zonos-address_11.entry.js → zonos-address-display_9.entry.js} +32 -636
  154. package/dist/esm/zonos-address_4.entry.js +708 -0
  155. package/dist/esm/zonos-badge.entry.js +3 -3
  156. package/dist/esm/{zonos-banner_2.entry.js → zonos-banner.entry.js} +1 -40
  157. package/dist/esm/zonos-button_3.entry.js +3 -3
  158. package/dist/esm/{zonos-empty-state-payment_4.entry.js → zonos-card_5.entry.js} +44 -7
  159. package/dist/esm/{zonos-cart-items_13.entry.js → zonos-cart-items_12.entry.js} +15 -31
  160. package/dist/esm/zonos-checkout.entry.js +3 -4
  161. package/dist/esm/zonos-collapse.entry.js +2 -2
  162. package/dist/esm/zonos-collect-cart-items_3.entry.js +5 -6
  163. package/dist/esm/zonos-collect-finish_6.entry.js +7 -6
  164. package/dist/esm/zonos-collect.entry.js +5 -5
  165. package/dist/esm/zonos-component.entry.js +1 -1
  166. package/dist/esm/zonos-controller.entry.js +39 -10
  167. package/dist/esm/zonos-country-flag.entry.js +1 -2
  168. package/dist/esm/zonos-country-select_4.entry.js +10 -11
  169. package/dist/esm/zonos-elements.js +1 -1
  170. package/dist/esm/zonos-hello-dialog.entry.js +6 -7
  171. package/dist/esm/zonos-hello.entry.js +1 -2
  172. package/dist/esm/zonos-input.entry.js +4 -4
  173. package/dist/esm/zonos-invoice-cart-items_2.entry.js +89 -0
  174. package/dist/esm/zonos-invoice-finish_5.entry.js +678 -0
  175. package/dist/esm/zonos-invoice.entry.js +464 -0
  176. package/dist/esm/zonos-language-select_2.entry.js +5 -6
  177. package/dist/esm/zonos-link.entry.js +20 -0
  178. package/dist/esm/zonos-logo.entry.js +2 -2
  179. package/dist/esm/zonos-stripe-input.entry.js +5 -5
  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/cart-66aecbb3.js +1 -0
  184. package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +1 -0
  185. package/dist/esm-es5/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
  186. package/dist/esm-es5/index.js +1 -1
  187. package/dist/esm-es5/invoice-c7452847.js +1 -0
  188. package/dist/esm-es5/isCollectMobileTablet-921002b0.js +1 -0
  189. package/dist/esm-es5/isInvoiceMobileTablet-1f7b614e.js +1 -0
  190. package/dist/esm-es5/loader.js +1 -1
  191. package/dist/esm-es5/localization-04b05867.js +1 -0
  192. package/dist/esm-es5/{paypal-fded8844.js → paypal-56564874.js} +1 -1
  193. package/dist/esm-es5/placeTestOrder-6b9eda9e.js +1 -0
  194. package/dist/esm-es5/renderCheckoutCurrency-cb808110.js +1 -0
  195. package/dist/esm-es5/renderFallback-3f010b48.js +1 -0
  196. package/dist/esm-es5/shouldRenderTaxIdInput-d45ceeb4.js +1 -0
  197. package/dist/esm-es5/throttle-ce2432ab.js +1 -0
  198. package/dist/esm-es5/zonos-address-display_9.entry.js +1 -0
  199. package/dist/esm-es5/zonos-address_4.entry.js +1 -0
  200. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  201. package/dist/esm-es5/zonos-banner.entry.js +1 -0
  202. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  203. package/dist/esm-es5/zonos-card_5.entry.js +1 -0
  204. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
  205. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  206. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  207. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  208. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  209. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  210. package/dist/esm-es5/zonos-component.entry.js +1 -1
  211. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  212. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  213. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  214. package/dist/esm-es5/zonos-elements.js +1 -1
  215. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  216. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  217. package/dist/esm-es5/zonos-input.entry.js +1 -1
  218. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -0
  219. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -0
  220. package/dist/esm-es5/zonos-invoice.entry.js +1 -0
  221. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  222. package/dist/esm-es5/zonos-link.entry.js +1 -0
  223. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  224. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  225. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  226. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  227. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  228. package/dist/scripts/index.d.ts +356 -0
  229. package/dist/scripts/index.js +1 -1
  230. package/dist/scripts/loadZonos.js +1 -1
  231. package/dist/scripts/zonos.js +1 -1
  232. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.d.ts +10 -0
  233. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.d.ts +50 -0
  234. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.d.ts +25 -0
  235. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.d.ts +28 -0
  236. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.d.ts +62 -0
  237. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.d.ts +22 -0
  238. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.d.ts +7 -0
  239. package/dist/types/components/checkout/zonos-invoice/zonos-invoice.d.ts +86 -0
  240. package/dist/types/components/main/zonos-controller.d.ts +4 -0
  241. package/dist/types/components/store/checkout/invoice.d.ts +19 -0
  242. package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
  243. package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
  244. package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
  245. package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
  246. package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
  247. package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
  248. package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
  249. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
  250. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
  251. package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
  252. package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
  253. package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
  254. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
  255. package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
  256. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
  257. package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
  258. package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
  259. package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
  260. package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
  261. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
  262. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  263. package/dist/types/components/utils/checkout/initInvoice.d.ts +1 -0
  264. package/dist/types/components/utils/checkout/isInvoiceMobileTablet.d.ts +4 -0
  265. package/dist/types/components.d.ts +351 -0
  266. package/dist/types/scripts/_zonosBase.d.ts +5 -0
  267. package/dist/types/types/checkout/api/CheckoutSession.d.ts +4 -0
  268. package/dist/types/types/checkout/api/PartyInfo.d.ts +21 -0
  269. package/dist/types/types/generated/graphql.frontend.types.d.ts +5 -1
  270. package/dist/types/types/generated/graphql.frontend.types.ts +5 -1
  271. package/dist/types/types/generated/graphql.internal.types.d.ts +285 -8
  272. package/dist/types/types/generated/graphql.internal.types.ts +367 -10
  273. package/dist/zonos-elements/index.esm.js +1 -1
  274. package/dist/zonos-elements/p-00719e49.entry.js +1 -0
  275. package/dist/zonos-elements/p-01b0a2e2.js +1 -0
  276. package/dist/zonos-elements/p-01dada4e.js +1 -0
  277. package/dist/zonos-elements/p-0c64dbbb.js +1 -0
  278. package/dist/zonos-elements/p-0cd5bcb3.entry.js +1 -0
  279. package/dist/zonos-elements/p-0e82fcea.entry.js +1 -0
  280. package/dist/zonos-elements/p-10316d4d.system.entry.js +1 -0
  281. package/dist/zonos-elements/{p-0a90dd80.system.entry.js → p-121c60c1.system.entry.js} +1 -1
  282. package/dist/zonos-elements/{p-bf9d889f.entry.js → p-14314ad3.entry.js} +1 -1
  283. package/dist/zonos-elements/p-170314a3.js +1 -0
  284. package/dist/zonos-elements/p-17a09191.entry.js +1 -0
  285. package/dist/zonos-elements/p-18bc6c7a.entry.js +1 -0
  286. package/dist/zonos-elements/{p-a25428eb.system.js → p-18d20206.system.js} +2 -2
  287. package/dist/zonos-elements/p-1a30fe18.system.entry.js +1 -0
  288. package/dist/zonos-elements/{p-c7b658cb.entry.js → p-1c4d12f0.entry.js} +1 -1
  289. package/dist/zonos-elements/p-1f3549c6.js +1 -0
  290. package/dist/zonos-elements/p-2250e585.entry.js +1 -0
  291. package/dist/zonos-elements/p-248dd596.system.entry.js +1 -0
  292. package/dist/zonos-elements/{p-5f398c28.entry.js → p-264690d7.entry.js} +1 -1
  293. package/dist/zonos-elements/p-2670438c.system.js +1 -0
  294. package/dist/zonos-elements/p-27f6930b.js +1 -0
  295. package/dist/zonos-elements/{p-eea0eb57.system.entry.js → p-2f869f2c.system.entry.js} +1 -1
  296. package/dist/zonos-elements/p-30c661b3.system.entry.js +1 -0
  297. package/dist/zonos-elements/p-34bf7bbe.system.js +1 -0
  298. package/dist/zonos-elements/p-38913b2f.entry.js +1 -0
  299. package/dist/zonos-elements/p-3bec13dd.system.js +1 -0
  300. package/dist/zonos-elements/{p-00ec22b2.entry.js → p-43a22d85.entry.js} +1 -1
  301. package/dist/zonos-elements/p-44b50260.entry.js +1 -0
  302. package/dist/zonos-elements/p-48dc96f9.system.entry.js +1 -0
  303. package/dist/zonos-elements/p-4aa86184.system.entry.js +1 -0
  304. package/dist/zonos-elements/p-4d594c8e.system.js +1 -0
  305. package/dist/zonos-elements/p-4ffbb0d6.system.js +1 -0
  306. package/dist/zonos-elements/{p-452fb638.system.entry.js → p-5062dcf3.system.entry.js} +1 -1
  307. package/dist/zonos-elements/p-50f31c12.system.entry.js +1 -0
  308. package/dist/zonos-elements/{p-c5cb2364.system.entry.js → p-57cee1b5.system.entry.js} +1 -1
  309. package/dist/zonos-elements/p-59a76f73.entry.js +1 -0
  310. package/dist/zonos-elements/{p-d556c6d1.system.entry.js → p-5afb9260.system.entry.js} +1 -1
  311. package/dist/zonos-elements/{p-88ea9f82.entry.js → p-6626d240.entry.js} +1 -1
  312. package/dist/zonos-elements/p-6688473e.entry.js +1 -0
  313. package/dist/zonos-elements/p-6f23a26a.system.js +1 -0
  314. package/dist/zonos-elements/{p-82739127.js → p-73c737aa.js} +2 -2
  315. package/dist/zonos-elements/p-757d4c62.system.entry.js +1 -0
  316. package/dist/zonos-elements/p-7aa50ef2.entry.js +1 -0
  317. package/dist/zonos-elements/p-7e17667d.js +1 -0
  318. package/dist/zonos-elements/p-7e469c5c.entry.js +1 -0
  319. package/dist/zonos-elements/p-7f91617c.system.entry.js +1 -0
  320. package/dist/zonos-elements/p-81e3eb5b.js +1 -0
  321. package/dist/zonos-elements/p-82febf70.system.js +1 -0
  322. package/dist/zonos-elements/{p-770852bf.system.entry.js → p-836db369.system.entry.js} +1 -1
  323. package/dist/zonos-elements/p-83b3f824.system.entry.js +1 -0
  324. package/dist/zonos-elements/p-851011aa.system.entry.js +1 -0
  325. package/dist/zonos-elements/{p-936b54c1.entry.js → p-865536f0.entry.js} +1 -1
  326. package/dist/zonos-elements/{p-b1fd1ec2.system.entry.js → p-8792fef2.system.entry.js} +1 -1
  327. package/dist/zonos-elements/p-890bfc42.system.entry.js +1 -0
  328. package/dist/zonos-elements/{p-c288c6da.system.entry.js → p-89a5e936.system.entry.js} +1 -1
  329. package/dist/zonos-elements/p-8af188f8.system.js +1 -0
  330. package/dist/zonos-elements/p-8d3a62fb.entry.js +1 -0
  331. package/dist/zonos-elements/{p-00ac999f.system.entry.js → p-8dc025c7.system.entry.js} +1 -1
  332. package/dist/zonos-elements/p-944d00da.entry.js +1 -0
  333. package/dist/zonos-elements/p-9479f155.system.js +1 -0
  334. package/dist/zonos-elements/p-95dc475b.system.js +1 -0
  335. package/dist/zonos-elements/p-976afc17.system.js +1 -0
  336. package/dist/zonos-elements/p-9b9bfb6d.entry.js +1 -0
  337. package/dist/zonos-elements/{p-55e2e4ed.entry.js → p-9f1bd9b8.entry.js} +1 -1
  338. package/dist/zonos-elements/p-9fa32fdf.js +1 -0
  339. package/dist/zonos-elements/p-a2a0bf4e.js +1 -0
  340. package/dist/zonos-elements/p-a610c24e.system.entry.js +1 -0
  341. package/dist/zonos-elements/{p-9b8750f3.entry.js → p-aedd3911.entry.js} +1 -1
  342. package/dist/zonos-elements/{p-db628e49.system.entry.js → p-b5c31ca4.system.entry.js} +1 -1
  343. package/dist/zonos-elements/p-ba456282.system.entry.js +1 -0
  344. package/dist/zonos-elements/{p-31af91f0.entry.js → p-bd603c1a.entry.js} +1 -1
  345. package/dist/zonos-elements/p-c2442878.system.js +1 -1
  346. package/dist/zonos-elements/p-c8cc20d9.system.js +1 -0
  347. package/dist/zonos-elements/p-dc5fb21c.js +1 -0
  348. package/dist/zonos-elements/p-dc94d7eb.js +1 -0
  349. package/dist/zonos-elements/{p-540cec7e.system.entry.js → p-e9e6bea7.system.entry.js} +1 -1
  350. package/dist/zonos-elements/p-eb9ee025.system.js +1 -0
  351. package/dist/zonos-elements/p-ed8ae947.system.entry.js +1 -0
  352. package/dist/zonos-elements/p-f1d4d6da.entry.js +1 -0
  353. package/dist/zonos-elements/p-f1d9dd4e.entry.js +1 -0
  354. package/dist/zonos-elements/p-f3962950.system.entry.js +1 -0
  355. package/dist/zonos-elements/p-f4e976ae.entry.js +1 -0
  356. package/dist/zonos-elements/p-f513b231.entry.js +1 -0
  357. package/dist/zonos-elements/p-f64207fa.system.entry.js +1 -0
  358. package/dist/zonos-elements/{p-31975752.entry.js → p-fa322dc1.entry.js} +1 -1
  359. package/dist/zonos-elements/p-fb9fb873.system.entry.js +1 -0
  360. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  361. package/package.json +1 -1
  362. package/dist/cjs/localization-39516612.js +0 -884
  363. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +0 -168
  364. package/dist/esm/localization-c5029ffc.js +0 -863
  365. package/dist/esm/zonos-confirm-dialog_2.entry.js +0 -163
  366. package/dist/esm-es5/cart-14f305b3.js +0 -1
  367. package/dist/esm-es5/localization-c5029ffc.js +0 -1
  368. package/dist/esm-es5/placeTestOrder-2250f719.js +0 -1
  369. package/dist/esm-es5/renderFallback-dbf1e3ae.js +0 -1
  370. package/dist/esm-es5/shouldRenderTaxIdInput-8bc112bb.js +0 -1
  371. package/dist/esm-es5/translationStore-690c4e04.js +0 -1
  372. package/dist/esm-es5/zonos-address_11.entry.js +0 -1
  373. package/dist/esm-es5/zonos-banner_2.entry.js +0 -1
  374. package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
  375. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +0 -1
  376. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +0 -1
  377. package/dist/zonos-elements/p-03ff7b01.system.entry.js +0 -1
  378. package/dist/zonos-elements/p-100f6a88.system.entry.js +0 -1
  379. package/dist/zonos-elements/p-143d706b.entry.js +0 -1
  380. package/dist/zonos-elements/p-14d7489d.js +0 -1
  381. package/dist/zonos-elements/p-1bfae137.entry.js +0 -1
  382. package/dist/zonos-elements/p-1d5aa016.system.js +0 -1
  383. package/dist/zonos-elements/p-1eae4987.entry.js +0 -1
  384. package/dist/zonos-elements/p-23b45714.system.entry.js +0 -1
  385. package/dist/zonos-elements/p-2557b96b.js +0 -1
  386. package/dist/zonos-elements/p-2ca8b037.entry.js +0 -1
  387. package/dist/zonos-elements/p-2dbcecf4.entry.js +0 -1
  388. package/dist/zonos-elements/p-316f9052.system.entry.js +0 -1
  389. package/dist/zonos-elements/p-3185968f.entry.js +0 -1
  390. package/dist/zonos-elements/p-4e41143a.system.entry.js +0 -1
  391. package/dist/zonos-elements/p-52b87408.system.entry.js +0 -1
  392. package/dist/zonos-elements/p-561be3a2.system.js +0 -1
  393. package/dist/zonos-elements/p-5c680f72.js +0 -1
  394. package/dist/zonos-elements/p-5f77d19e.js +0 -1
  395. package/dist/zonos-elements/p-74ca7739.entry.js +0 -1
  396. package/dist/zonos-elements/p-767a31a8.system.js +0 -1
  397. package/dist/zonos-elements/p-78a6e775.system.js +0 -1
  398. package/dist/zonos-elements/p-7c705c76.system.js +0 -1
  399. package/dist/zonos-elements/p-81ba2820.system.entry.js +0 -1
  400. package/dist/zonos-elements/p-84078c57.system.js +0 -1
  401. package/dist/zonos-elements/p-8a23bbf5.js +0 -1
  402. package/dist/zonos-elements/p-905d2490.entry.js +0 -1
  403. package/dist/zonos-elements/p-93f2e1ee.system.entry.js +0 -1
  404. package/dist/zonos-elements/p-a0a4e43d.system.entry.js +0 -1
  405. package/dist/zonos-elements/p-a2819807.system.entry.js +0 -1
  406. package/dist/zonos-elements/p-a6e74856.entry.js +0 -1
  407. package/dist/zonos-elements/p-ae940a99.js +0 -1
  408. package/dist/zonos-elements/p-b7ea5f4f.system.entry.js +0 -1
  409. package/dist/zonos-elements/p-c0c458f7.system.entry.js +0 -1
  410. package/dist/zonos-elements/p-c1ecab92.entry.js +0 -1
  411. package/dist/zonos-elements/p-c50cc926.entry.js +0 -1
  412. package/dist/zonos-elements/p-cf765af3.system.js +0 -1
  413. package/dist/zonos-elements/p-e03e1a62.entry.js +0 -1
  414. package/dist/zonos-elements/p-e7874318.system.entry.js +0 -1
  415. package/dist/zonos-elements/p-e8949e7e.entry.js +0 -1
  416. package/dist/zonos-elements/p-ea0b5d10.system.js +0 -1
  417. package/dist/zonos-elements/p-eae3462c.entry.js +0 -1
  418. package/dist/zonos-elements/p-eeb1081e.js +0 -1
  419. package/dist/zonos-elements/p-f892595d.system.entry.js +0 -1
  420. package/dist/zonos-elements/p-fd3b46ee.entry.js +0 -1
@@ -0,0 +1,715 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-69fa8852.js');
6
+ const throttle = require('./throttle-7dd64984.js');
7
+ const cart = require('./cart-22ced7cc.js');
8
+ const localization = require('./localization-8ef6250a.js');
9
+ const zonosStore = require('./zonosStore-37a4b4f4.js');
10
+ const handleFetch = require('./handleFetch-954f30e1.js');
11
+ const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-eda13ef8.js');
12
+ const classes = require('./classes-b7918f56.js');
13
+ const VarianceTest = require('./VarianceTest-bec00ea8.js');
14
+ const TaxId = require('./TaxId-12acedde.js');
15
+ const getBorderRadius = require('./getBorderRadius-2ef1170d.js');
16
+ require('./debounce-815d1517.js');
17
+ require('./isDarkColor-878e600e.js');
18
+
19
+ const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address,.sc-zonos-address-h .zonos--tax-id-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
20
+ const ZonosAddressStyle0 = zonosAddressCss;
21
+
22
+ const ZonosAddress = class {
23
+ constructor(hostRef) {
24
+ index.registerInstance(this, hostRef);
25
+ this.invalidCharacters = index.createEvent(this, "invalidCharacters", 7);
26
+ this.taxIdChanged = index.createEvent(this, "taxIdChanged", 7);
27
+ this.storeUnsubscribeList = [];
28
+ /**
29
+ * Google autocomplete overlay is conflict with our button, this is to adjust z index of the autocomplete
30
+ */
31
+ this.isAutoCompleteAdjusted = false;
32
+ /**
33
+ * Default address for stripe
34
+ */
35
+ this.defaultAddress = [];
36
+ /**
37
+ * Error message for tax id input
38
+ */
39
+ this.taxIdErrorMessage = '';
40
+ this.stripe = window.Zonos.stripe;
41
+ /**
42
+ * Check if the address is dirty or not to scroll into view. When the component is mounted, if the data is filled with address line 1, it's considered dirty
43
+ */
44
+ this.isDirtyAddress = false;
45
+ /**
46
+ * Local address event for stripe address element
47
+ */
48
+ this.isAddressFilled = false;
49
+ /**
50
+ * Local checkout session id to check if the address is filled after checkout is loaded
51
+ */
52
+ this.checkoutSessionId = localization.storageStore.checkoutSessionId;
53
+ /**
54
+ * Track previous country and postal code to detect changes
55
+ */
56
+ this.prevCountry = null;
57
+ this.prevPostalCode = null;
58
+ /**
59
+ * Check if the tracking event is sent
60
+ */
61
+ this.trackingSent = false;
62
+ this.prefetchLandedCost = throttle.throttle_1(cart.stripeStorePrefetchLandedCost, 1000);
63
+ }
64
+ getStripeAddressInstance() {
65
+ if (this.type === 'billing') {
66
+ return {
67
+ stripeAddressElement: cart.stripeStore.stripeBillingAddressElement,
68
+ stripeAddressEventData: cart.stripeStore.stripeBillingAddressEventData,
69
+ stripeElements: cart.stripeStore.stripeElementsForBillingAddress,
70
+ };
71
+ }
72
+ return {
73
+ stripeAddressElement: cart.stripeStore.stripeAddressElement,
74
+ stripeAddressEventData: cart.stripeStore.stripeAddressEventData,
75
+ stripeElements: cart.stripeStore.stripeElements,
76
+ };
77
+ }
78
+ updateAddressEventData({ event, type, }) {
79
+ switch (type) {
80
+ case 'billing':
81
+ cart.stripeStore.stripeBillingAddressEventData = event;
82
+ break;
83
+ default: {
84
+ cart.stripeStore.stripeAddressEventData = event;
85
+ break;
86
+ }
87
+ }
88
+ // Only trigger landed cost prefetch for shipping address
89
+ if (type === 'shipping') {
90
+ // if line 1 has something, trigger prefetch
91
+ if (event.value.address.line1.length) {
92
+ void this.prefetchLandedCost();
93
+ }
94
+ }
95
+ }
96
+ isAddressFilledChanged() {
97
+ // Sometimes address elements is loaded with prefilled data before checkout is loaded, need to not send the event if checkout session id is not available, and send the event after checkout is loaded
98
+ if (!localization.storageStore.checkoutSessionId) {
99
+ return;
100
+ }
101
+ // Only need to track the event if the shipping address is filled
102
+ if (this.isAddressFilled &&
103
+ !this.trackingSent &&
104
+ this.type === 'shipping') {
105
+ this.trackingSent = true;
106
+ const checkoutSessionId = localization.storageStore.checkoutSessionId;
107
+ void cart.trackConversionEvent({
108
+ checkoutSessionId,
109
+ eventName: 'checkout_customerInfoFilled',
110
+ });
111
+ }
112
+ }
113
+ updateAddressElement({ stripeAddressElement, type, }) {
114
+ if (type === 'shipping') {
115
+ cart.stripeStore.stripeAddressElement = stripeAddressElement;
116
+ return;
117
+ }
118
+ cart.stripeStore.stripeBillingAddressElement = stripeAddressElement;
119
+ }
120
+ async watchInitStripe() {
121
+ this.stripe = window.Zonos.stripe;
122
+ const { stripeAddressEventData, stripeElements } = this.getStripeAddressInstance();
123
+ if (!this.stripe || !stripeElements) {
124
+ handleFetch.logError("Stripe is not initialized. Couldn't load stripe element.");
125
+ return;
126
+ }
127
+ // remove phone from default address if it's not provided, stripe
128
+ // will throw error if key phone exist and its value is empty or 'undefined'.
129
+ const defaultAddress = this.defaultAddress.map(address => (Object.assign(Object.assign({}, address), { name: address.name, phone: address.phone || undefined })));
130
+ const shippableCountries = localization.localizationStore.shippingZoneCountries;
131
+ const shippingZone = shippableCountries
132
+ ? Object.values(shippableCountries).map(country => country.code)
133
+ : [];
134
+ // Show all countries in checkout if the query param is present
135
+ const checkoutAllCountries = new URLSearchParams(window.location.search).has('zonosCheckoutAllCountries');
136
+ const allowedCountries = this.type === 'shipping' ? shippingZone : [];
137
+ const defaultAddressCountry = (stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address.country) ||
138
+ localization.getFallbackDefaultCountryCode(allowedCountries);
139
+ VarianceTest.log(`Stripe country code: ${defaultAddressCountry}`, 'info');
140
+ const addressElement = stripeElements.create('address', {
141
+ allowedCountries: checkoutAllCountries ? [] : allowedCountries,
142
+ // only show the default address if stripeAddressEventData is not provided
143
+ contacts: defaultAddress.length && !stripeAddressEventData
144
+ ? this.defaultAddress
145
+ : [],
146
+ defaultValues: {
147
+ address: Object.assign(Object.assign({}, stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address), { country: defaultAddressCountry }),
148
+ firstName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.firstName,
149
+ lastName: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.lastName,
150
+ phone: stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.phone,
151
+ },
152
+ display: {
153
+ name: 'split',
154
+ },
155
+ fields: {
156
+ phone: 'always',
157
+ },
158
+ mode: this.type,
159
+ validation: {
160
+ phone: {
161
+ required: 'always',
162
+ },
163
+ },
164
+ });
165
+ addressElement.mount(this.el.querySelector('.zonos--address-component'));
166
+ // Initialize previous values if address data exists
167
+ if (stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address) {
168
+ this.prevCountry = stripeAddressEventData.value.address.country;
169
+ this.prevPostalCode = stripeAddressEventData.value.address.postal_code;
170
+ }
171
+ addressElement.on('change', event => {
172
+ const eventValue = event.value;
173
+ if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
174
+ this.isDirtyAddress = true;
175
+ if (!this.isAutoCompleteAdjusted) {
176
+ const googleAutoComplete = this.el.querySelector('iframe[src*="autocomplete-suggestions"]');
177
+ if (googleAutoComplete) {
178
+ googleAutoComplete.style.zIndex = '3';
179
+ }
180
+ this.isAutoCompleteAdjusted = true;
181
+ }
182
+ // stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
183
+ setTimeout(() => {
184
+ // scroll directly into view if it's mobile
185
+ if (handleFetch.isCheckoutMobile()) {
186
+ this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
187
+ }
188
+ else {
189
+ // scroll into the end of the page so the address placeholder won't be hidden
190
+ const yOffset = this.type === 'shipping' ? 100 : 600;
191
+ const parentWrapper = this.el.closest('.zonos--group');
192
+ const y = this.el.getBoundingClientRect().top + yOffset;
193
+ parentWrapper === null || parentWrapper === void 0 ? void 0 : parentWrapper.scrollTo({ behavior: 'smooth', top: y });
194
+ }
195
+ }, 600);
196
+ }
197
+ const { firstName, lastName } = cart.extractName({
198
+ firstName: eventValue.firstName,
199
+ lastName: eventValue.lastName,
200
+ name: eventValue.name,
201
+ });
202
+ this.updateAddressEventData({
203
+ event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName,
204
+ lastName }) }),
205
+ type: this.type,
206
+ });
207
+ });
208
+ this.updateAddressElement({
209
+ stripeAddressElement: addressElement,
210
+ type: this.type,
211
+ });
212
+ }
213
+ defaultAddressChanged(newAddress, oldAddress) {
214
+ // check if stringified json of oldAddress is different from newAddress
215
+ const oldAddressString = JSON.stringify(oldAddress);
216
+ const newAddressString = JSON.stringify(newAddress);
217
+ // No need to reset address element if the default address is the same
218
+ if (oldAddressString === newAddressString) {
219
+ return;
220
+ }
221
+ VarianceTest.log('Reset address element when default address property is changed', 'info', {
222
+ defaultAddress: this.defaultAddress,
223
+ });
224
+ const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
225
+ stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.clear();
226
+ stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
227
+ // Reset stripe address event data
228
+ if (this.type === 'shipping') {
229
+ cart.stripeStore.stripeAddressEventData = null;
230
+ }
231
+ else {
232
+ cart.stripeStore.stripeBillingAddressEventData = null;
233
+ }
234
+ void this.watchInitStripe();
235
+ }
236
+ isInTaxIdCountry(countryCode) {
237
+ return TaxId.countryRequireTaxId.includes(countryCode);
238
+ }
239
+ /**
240
+ * Render tax id input based on ship to country code
241
+ */
242
+ renderTaxIdInput() {
243
+ var _a;
244
+ // No need to render tax id input for billing address
245
+ if (this.type === 'billing') {
246
+ return null;
247
+ }
248
+ const countryCode = (_a = cart.stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country;
249
+ // Don't render tax id input if the country is not provided
250
+ if (!countryCode) {
251
+ return null;
252
+ }
253
+ // This just to type guard the countryCode, if it's able to get to this point it should already be in country that has tax id input
254
+ if (!this.isInTaxIdCountry(countryCode)) {
255
+ return null;
256
+ }
257
+ const taxIdInputRendered = shouldRenderTaxIdInput.shouldRenderTaxIdInput({
258
+ companyName: cart.stripeStore.companyName,
259
+ countryCode,
260
+ });
261
+ // Don't render tax id input if the country doesn't require tax id
262
+ if (!taxIdInputRendered) {
263
+ return null;
264
+ }
265
+ const taxIdInputInfo = TaxId.shipToTaxIdLabels[countryCode];
266
+ return (index.h("div", { class: "zonos--tax-id-input" }, index.h("zonos-stripe-input", { inputLabel: localization.translate(taxIdInputInfo.friendlyName), inputPlaceholder: taxIdInputInfo.placeholder, inputValue: cart.stripeStore.taxId || '', isError: !!this.taxIdErrorMessage, onInputChange: (event) => {
267
+ cart.stripeStore.taxId = event.detail;
268
+ this.taxIdChanged.emit(event.detail);
269
+ } }), this.taxIdErrorMessage && (index.h("zonos-text", { textColor: 'red-600', type: "caption" }, this.taxIdErrorMessage))));
270
+ }
271
+ renderCompanyNameInput() {
272
+ // No need to render company name for billing address (only allow for Collect and Invoice)
273
+ if (this.type === 'billing' &&
274
+ !window.Zonos.isCollect &&
275
+ !window.Zonos.isInvoice) {
276
+ return null;
277
+ }
278
+ // only render the company input if the setting is enabled or the cart is collect
279
+ const isCompanyNameEnabled = zonosStore.zonosStore.checkoutSettings.companyFieldsStatus === 'ENABLED' ||
280
+ !!window.Zonos.isCollect ||
281
+ !!window.Zonos.isInvoice;
282
+ // No need to render company name for billing address (only allow for Collect)
283
+ if (!isCompanyNameEnabled) {
284
+ return null;
285
+ }
286
+ return (index.h("zonos-stripe-input", { class: "zonos--company-name-input", inputLabel: localization.translate('Company name (optional)'), inputValue: cart.stripeStore.companyName, onInputChange: (event) => {
287
+ cart.stripeStore.companyName = event.detail;
288
+ } }));
289
+ }
290
+ disconnectedCallback() {
291
+ // destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
292
+ const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
293
+ stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
294
+ // unsubscribe from store subscriptions
295
+ try {
296
+ this.storeUnsubscribeList.forEach(subscription => subscription());
297
+ }
298
+ catch (_a) { }
299
+ }
300
+ componentDidLoad() {
301
+ const stripeAddressEventData = this.getStripeAddressInstance().stripeAddressEventData;
302
+ this.isDirtyAddress =
303
+ !!stripeAddressEventData &&
304
+ stripeAddressEventData.value.address.line1.length > 0;
305
+ // @Watch doesn't get trigger on initial load
306
+ void this.watchInitStripe();
307
+ this.checkoutSessionId = localization.storageStore.checkoutSessionId;
308
+ this.storeUnsubscribeList = [
309
+ localization.storageStoreOnChange('checkoutSessionId', () => {
310
+ this.checkoutSessionId = localization.storageStore.checkoutSessionId;
311
+ }),
312
+ cart.stripeStoreOnChange('stripeElements', () => {
313
+ if (this.type === 'shipping') {
314
+ void this.watchInitStripe();
315
+ }
316
+ }),
317
+ cart.stripeStoreOnChange('stripeElementsForBillingAddress', () => {
318
+ if (this.type === 'billing') {
319
+ void this.watchInitStripe();
320
+ }
321
+ }),
322
+ ];
323
+ }
324
+ render() {
325
+ var _a;
326
+ this.checkoutSessionId = localization.storageStore.checkoutSessionId;
327
+ if ((_a = cart.stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
328
+ this.isAddressFilled = true;
329
+ }
330
+ // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
331
+ return (index.h(index.Host, { key: '7762b1dbeeff9d45721bf7a2efbe4bf4c2c29551', class: classes.classes([
332
+ 'zonos--address',
333
+ 'zonos--elements',
334
+ `zonos--${this.type}-address`,
335
+ ]) }, this.titleText && (index.h("zonos-text", { key: '5f266b4562eb78eb8f5b1374f195501abc44c9f7', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), index.h("slot", { key: 'bfcee78353455a66c6dec12432bfeff69dc9a10b', name: "below-title" }), this.renderCompanyNameInput(), this.renderTaxIdInput(), index.h("div", { key: 'd005a517dc93439d13f38750df8e09f884ad898c', class: "zonos--address-component" })));
336
+ }
337
+ get el() { return index.getElement(this); }
338
+ static get watchers() { return {
339
+ "checkoutSessionId": ["isAddressFilledChanged"],
340
+ "isAddressFilled": ["isAddressFilledChanged"],
341
+ "stripe": ["watchInitStripe"],
342
+ "defaultAddress": ["defaultAddressChanged"]
343
+ }; }
344
+ };
345
+ ZonosAddress.style = ZonosAddressStyle0;
346
+
347
+ const ExclamationMarkDuotoneIcon = `<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
348
+ <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>
349
+ <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
350
+ </svg>`;
351
+
352
+ const HelpDuotoneIcon = `<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
353
+ <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>
354
+ <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>
355
+ </svg>`;
356
+
357
+ const WarningDuotoneIcon = `<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
358
+ <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>
359
+ <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
360
+ </svg>`;
361
+
362
+ const zonosConfirmDialogCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";
363
+ const ZonosConfirmDialogStyle0 = zonosConfirmDialogCss;
364
+
365
+ const ZonosConfirmDialog = class {
366
+ constructor(hostRef) {
367
+ index.registerInstance(this, hostRef);
368
+ this.confirmClicked = index.createEvent(this, "confirmClicked", 7);
369
+ this.cancelClicked = index.createEvent(this, "cancelClicked", 7);
370
+ /**
371
+ * Dialog title text
372
+ * @default "Are you sure?"
373
+ */
374
+ this.dialogTitle = localization.translate('Are you sure?');
375
+ /**
376
+ * Dialog intent (for icon and button color)
377
+ * @default "info"
378
+ */
379
+ this.dialogIntent = 'info';
380
+ /**
381
+ * Dialog subtitle text
382
+ * @default null No subtitle
383
+ */
384
+ this.dialogSubtitle = null;
385
+ /**
386
+ * Dialog width
387
+ * @default 350 px
388
+ */
389
+ this.dialogWidth = 350;
390
+ /**
391
+ * Type of dialog
392
+ * - "alert" - Only confirm button
393
+ * - "confirm" - Both Confirm and cancel buttons
394
+ * @default "confirm"
395
+ */
396
+ this.dialogType = 'confirm';
397
+ /**
398
+ * Whether or not the dialog is open
399
+ */
400
+ this.isMobile = false;
401
+ /**
402
+ * Whether or not to close the dialog when clicking outside of it
403
+ * @default false
404
+ */
405
+ this.noClickOutside = false;
406
+ this.clickOutsideDialogHandler = (event) => {
407
+ if (event.target === event.currentTarget && !this.noClickOutside) {
408
+ this.closeDialogHandler();
409
+ }
410
+ };
411
+ }
412
+ handleKeyDown(ev) {
413
+ if (ev.key === 'Escape') {
414
+ this.closeDialogHandler();
415
+ }
416
+ }
417
+ focusDialog() {
418
+ if (this.dialogOpen) {
419
+ setTimeout(() => {
420
+ var _a, _b;
421
+ // Focus on a non tabable element (tabIndex=-1), so we will be able to tab to other tabable elements
422
+ (_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--backdrop')) === null || _b === void 0 ? void 0 : _b.focus();
423
+ }, 100);
424
+ }
425
+ }
426
+ confirmDialogHandler() {
427
+ // Only do the action if the dialog is open
428
+ if (!this.dialogOpen) {
429
+ return;
430
+ }
431
+ // Emit confirm event
432
+ this.confirmClicked.emit();
433
+ }
434
+ closeDialogHandler() {
435
+ // Only do the action if the dialog is open
436
+ if (!this.dialogOpen) {
437
+ return;
438
+ }
439
+ // Emit cancel event
440
+ this.cancelClicked.emit();
441
+ }
442
+ renderIcon() {
443
+ switch (this.dialogIntent) {
444
+ case 'info':
445
+ return (index.h("zonos-icon", { content: HelpDuotoneIcon, iconColor: 'blue-800' }));
446
+ case 'danger':
447
+ return (index.h("zonos-icon", { content: ExclamationMarkDuotoneIcon, iconColor: 'red-800' }));
448
+ case 'warn':
449
+ return (index.h("zonos-icon", { content: WarningDuotoneIcon, iconColor: 'orange-800' }));
450
+ }
451
+ }
452
+ getButtonConfirmVariant() {
453
+ switch (this.dialogIntent) {
454
+ case 'warn':
455
+ return 'warning';
456
+ case 'danger':
457
+ return 'danger';
458
+ default:
459
+ return 'primary';
460
+ }
461
+ }
462
+ render() {
463
+ this.focusDialog();
464
+ const borderStyle = getBorderRadius.getBorderRadius();
465
+ // Get theme for the update dialog, inherit from the theme, no from this component theme
466
+ const theme = zonosStore.getZonosStoreTheme(zonosStore.zonosStore.appearance.theme);
467
+ return (index.h(index.Host, { key: 'db0bfe0b8a125e806a97c9382faa938078000349', class: classes.classes([this.dialogOpen && 'open', 'zonos--elements']), "data-dialog-type": this.dialogType, "data-theme": theme, style: {
468
+ '--zonos--border-radius': borderStyle,
469
+ '--zonos--dialog-width': `${this.dialogWidth}px`,
470
+ '--zonos--font-family': zonosStore.zonosStoreFontFamily(),
471
+ } }, index.h("div", { key: '1676defad54705df4e9282bda6b5734592d0fb60', class: "zonos--backdrop", tabIndex: -1 }), index.h("div", { key: '2a6ec6b5df7ea30304cfed5276e55618b40add93', class: classes.classes(['zonos--confirm-layout', this.dialogIntent]), onClick: e => this.clickOutsideDialogHandler(e) }, index.h("div", { key: 'd1c8358c3fd98c27a469fe7443d1983c1c134a7c', class: "zonos--confirm-dialog", onBlur: () => {
472
+ this.focusDialog();
473
+ } }, index.h("div", { key: '137e9659aa7aec2e4604acf80809b35bce69ca79', class: "wrapper" }, index.h("div", { key: '9c1057857ea095e7e88c8950469add2bc4c1318e', class: "icon-wrapper" }, this.renderIcon()), index.h("div", { key: '48f0e0cd9ce62b425bae831d1387261bbd4162a1', class: "content" }, index.h("div", { key: '0d3e681f350e5db547181beadf5c6bcf49a8bbd2', class: "title" }, index.h("zonos-text", { key: 'f16a43d2b3c9504911b1e36ba573873f80093c47', type: "subheader" }, this.dialogTitle)), this.dialogSubtitle && (index.h("div", { key: 'fd570f98bc736a68c16fedee72b1417dc6906fa6', class: "subtitle" }, index.h("zonos-text", { key: '6785aa19dd44cf7f6fae7317e3924be6c6ee8af3', textColor: "gray-800" }, this.dialogSubtitle)))), index.h("div", { key: '4206cad3dcff0055fc5f3ea8e7c217ae33c63263', class: "footer" }, this.dialogType === 'confirm' && (index.h("zonos-button", { key: '72d1a216641d482bdbeae384963dcdff1cfc3f45', backgroundColor: "gray-0", class: "cancel-button", onClick: () => this.closeDialogHandler(), size: "lg", withBoxShadow: true }, this.dialogCancelBtnText || localization.translate('Cancel'))), index.h("zonos-button", { key: 'a6a206eff11d1f42c33ef9113cc393d727c60f89', class: "confirm-button", onClick: () => this.confirmDialogHandler(), size: "lg", variant: this.getButtonConfirmVariant() }, this.dialogConfirmBtnText)))))));
474
+ }
475
+ static get assetsDirs() { return ["assets"]; }
476
+ get el() { return index.getElement(this); }
477
+ };
478
+ ZonosConfirmDialog.style = ZonosConfirmDialogStyle0;
479
+
480
+ const validateEmailValue = (value) => {
481
+ const emailRegex = /^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/;
482
+ return emailRegex.test(value);
483
+ };
484
+
485
+ const zonosLinkAuthenticationCss = ".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";
486
+ const ZonosLinkAuthenticationStyle0 = zonosLinkAuthenticationCss;
487
+
488
+ const MAX_RETRIES_INITIALIZE_LINK = 51;
489
+ const ZonosLinkAuthentication = class {
490
+ constructor(hostRef) {
491
+ index.registerInstance(this, hostRef);
492
+ this.linkAuthenticationChange = index.createEvent(this, "linkAuthenticationChange", 7);
493
+ this.storeUnsubscribeList = [];
494
+ /**
495
+ * Default email for stripe
496
+ */
497
+ this.defaultEmail = null;
498
+ /**
499
+ * Email error text to dispaly
500
+ */
501
+ this.isEmailError = false;
502
+ this.stripe = cart.stripeStore.stripe;
503
+ this.isStagingMode = cart.cartStore.isStagingMode;
504
+ this.clientSecret = cart.stripeStore.clientSecret;
505
+ this.retriesInitializeLink = 0;
506
+ this.setCustomEmailInputToLinkEvent = (emailValue) => {
507
+ // check if the email is valid
508
+ const isValid = validateEmailValue(emailValue);
509
+ const simulateLinkEvent = {
510
+ complete: !!isValid,
511
+ elementType: 'linkAuthentication',
512
+ empty: !emailValue,
513
+ value: {
514
+ email: emailValue,
515
+ },
516
+ };
517
+ cart.stripeStore.stripeLinkEventData = simulateLinkEvent;
518
+ };
519
+ this.handleNormalEmailInput = (event) => {
520
+ var _a;
521
+ const inputValue = event.detail;
522
+ this.setCustomEmailInputToLinkEvent(inputValue);
523
+ (_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
524
+ };
525
+ }
526
+ watchIsStagingMode() {
527
+ // Wait for the DOM to be ready before re-initializing Link element
528
+ setTimeout(() => {
529
+ void this.watchInitStripe();
530
+ }, 0);
531
+ }
532
+ async watchInitStripe() {
533
+ if (!this.stripe || !cart.stripeStore.stripeElements) {
534
+ return;
535
+ }
536
+ // No need to initialize link if this is staging mode since we will render the email input field
537
+ if (cart.cartStore.isStagingMode || !this.clientSecret) {
538
+ return;
539
+ }
540
+ const defaultValues = this.defaultEmail
541
+ ? {
542
+ email: this.defaultEmail,
543
+ }
544
+ : undefined;
545
+ try {
546
+ // Create and mount the Authentication Element in ${type} mode
547
+ const linkAuthenticationElement = cart.stripeStore.stripeLinkElement ||
548
+ cart.stripeStore.stripeElements.create('linkAuthentication', {
549
+ defaultValues: defaultValues,
550
+ });
551
+ const linkAuthenticationElementContainer = this.el.querySelector('.zonos--link-authentication-component');
552
+ if (!linkAuthenticationElementContainer) {
553
+ handleFetch.logError('Cannot find container element for linkAuthenticationElement');
554
+ return;
555
+ }
556
+ linkAuthenticationElement.mount(linkAuthenticationElementContainer);
557
+ linkAuthenticationElement.on('change', event => {
558
+ var _a;
559
+ cart.stripeStore.stripeLinkEventData = event;
560
+ (_a = this.linkAuthenticationChange) === null || _a === void 0 ? void 0 : _a.emit();
561
+ });
562
+ cart.stripeStore.stripeLinkElement = linkAuthenticationElement;
563
+ this.retriesInitializeLink = 0;
564
+ // 10 seconds
565
+ if (this.retriesInitializeLink > 11) {
566
+ VarianceTest.log('Stripe link element initialized', 'info', {
567
+ retriesInitializeLink: this.retriesInitializeLink,
568
+ stripe: this.stripe,
569
+ });
570
+ void handleFetch.sendErrorLog({
571
+ endpoint: 'stripe-link-authentication-init-long-running',
572
+ errors: [
573
+ 'Stripe link element initialized after 20 retries - 10 seconds',
574
+ ],
575
+ metadata: {
576
+ retriesInitializeLink: this.retriesInitializeLink,
577
+ },
578
+ });
579
+ }
580
+ }
581
+ catch (error) {
582
+ if (error instanceof Error) {
583
+ // Wait for the stripe elements to be ready with the new client secret
584
+ this.retriesInitializeLink++;
585
+ if (this.retriesInitializeLink < MAX_RETRIES_INITIALIZE_LINK) {
586
+ await new Promise(resolve => setTimeout(resolve, 500));
587
+ void this.watchInitStripe();
588
+ }
589
+ if (this.retriesInitializeLink === MAX_RETRIES_INITIALIZE_LINK) {
590
+ void handleFetch.sendErrorLog({
591
+ endpoint: 'stripe-link-authentication-init-error',
592
+ errors: [error.message],
593
+ metadata: {
594
+ retriesInitializeLink: this.retriesInitializeLink,
595
+ },
596
+ });
597
+ }
598
+ }
599
+ }
600
+ }
601
+ watchDefaultEmail(newDefaultEmail, oldDefaultEmail) {
602
+ var _a, _b;
603
+ VarianceTest.log('Default email is changed', 'info', {
604
+ newDefaultEmail,
605
+ oldDefaultEmail,
606
+ });
607
+ if (oldDefaultEmail === newDefaultEmail) {
608
+ return;
609
+ }
610
+ if (!newDefaultEmail) {
611
+ cart.stripeStore.stripeLinkEventData = null;
612
+ }
613
+ // Only set value for Stripe input input to stripeLinkEventData when checkout is in staging mode
614
+ if (cart.cartStore.isStagingMode) {
615
+ this.setCustomEmailInputToLinkEvent(newDefaultEmail || '');
616
+ return;
617
+ }
618
+ (_a = cart.stripeStore.stripeLinkElement) === null || _a === void 0 ? void 0 : _a.clear();
619
+ (_b = cart.stripeStore.stripeLinkElement) === null || _b === void 0 ? void 0 : _b.destroy();
620
+ cart.stripeStore.stripeLinkElement = null;
621
+ cart.stripeStore.stripeLinkEventData = null;
622
+ VarianceTest.log('Reset stripe link element when default email is changed', 'info', {
623
+ defaultEmail: newDefaultEmail,
624
+ });
625
+ void this.watchInitStripe();
626
+ }
627
+ disconnectedCallback() {
628
+ // unsubscribe from store subscriptions
629
+ try {
630
+ this.storeUnsubscribeList.forEach(subscription => subscription());
631
+ }
632
+ catch (_a) { }
633
+ }
634
+ componentDidLoad() {
635
+ this.storeUnsubscribeList = [
636
+ cart.stripeStoreOnChange('stripeElements', async () => {
637
+ void this.watchInitStripe();
638
+ }),
639
+ cart.stripeStoreOnChange('clientSecret', async () => {
640
+ this.clientSecret = cart.stripeStore.clientSecret;
641
+ }),
642
+ cart.stripeStoreOnChange('stripe', async () => {
643
+ this.stripe = cart.stripeStore.stripe;
644
+ }),
645
+ ];
646
+ // @Watch doesn't get trigger on initial load
647
+ void this.watchInitStripe();
648
+ if (!this.defaultEmail) {
649
+ return;
650
+ }
651
+ // set default email value to stripeLinkEventData if default email is provided
652
+ this.setCustomEmailInputToLinkEvent(this.defaultEmail);
653
+ }
654
+ render() {
655
+ this.isStagingMode = cart.cartStore.isStagingMode;
656
+ this.clientSecret = cart.stripeStore.clientSecret;
657
+ const renderEmailAddress = () => {
658
+ var _a;
659
+ if (cart.cartStore.isStagingMode) {
660
+ return (index.h("zonos-stripe-input", { inputLabel: localization.translate('Email'), inputValue: this.defaultEmail ||
661
+ ((_a = cart.stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) ||
662
+ '', isError: this.isEmailError, onBlur: () => {
663
+ var _a;
664
+ const emailValue = ((_a = cart.stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.value.email) || '';
665
+ if (!emailValue) {
666
+ return;
667
+ }
668
+ // check if the email is valid
669
+ const isValid = validateEmailValue(emailValue);
670
+ this.isEmailError = !isValid;
671
+ }, onInputChange: this.handleNormalEmailInput }));
672
+ }
673
+ return (index.h("div", { class: `zonos--link-authentication-component ${this.isEmailError && 'zonos--input-invalid'}` }));
674
+ };
675
+ // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
676
+ return (index.h(index.Host, { class: "zonos--link-authentication zonos--elements", style: {
677
+ '--zonos--border-radius': getBorderRadius.getBorderRadius(),
678
+ } }, this.titleText && (index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), renderEmailAddress(), this.isEmailError && (index.h("zonos-text", { textColor: "red-600" }, localization.translate('Please enter a valid email address.')))));
679
+ }
680
+ get el() { return index.getElement(this); }
681
+ static get watchers() { return {
682
+ "isStagingMode": ["watchIsStagingMode"],
683
+ "stripe": ["watchInitStripe"],
684
+ "clientSecret": ["watchInitStripe"],
685
+ "defaultEmail": ["watchDefaultEmail"]
686
+ }; }
687
+ };
688
+ ZonosLinkAuthentication.style = ZonosLinkAuthenticationStyle0;
689
+
690
+ const zonosLoadingOverlayCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";
691
+ const ZonosLoadingOverlayStyle0 = zonosLoadingOverlayCss;
692
+
693
+ const ZonosLoadingOverlay = class {
694
+ constructor(hostRef) {
695
+ index.registerInstance(this, hostRef);
696
+ /**
697
+ * Whether or not the overlay is open
698
+ * @default false
699
+ */
700
+ this.open = false;
701
+ /**
702
+ * Spinner size (optional, default 40)
703
+ */
704
+ this.size = 40;
705
+ }
706
+ render() {
707
+ return (index.h(index.Host, { key: 'eee6eb4eb40c18ccdd24d57d98be8b90eadccf23', class: classes.classes(['zonos--elements', this.open && 'zonos--open']) }, index.h("div", { key: '4bca110e058cb5cbf4c86351aa56d251792ab325', class: "zonos--loading-overlay" }, index.h("zonos-spinner", { key: '513b8d669ab13896442c0b1048609a3f3e0ed6f5', size: this.size, spinnerColor: this.spinnerColor }))));
708
+ }
709
+ };
710
+ ZonosLoadingOverlay.style = ZonosLoadingOverlayStyle0;
711
+
712
+ exports.zonos_address = ZonosAddress;
713
+ exports.zonos_confirm_dialog = ZonosConfirmDialog;
714
+ exports.zonos_link_authentication = ZonosLinkAuthentication;
715
+ exports.zonos_loading_overlay = ZonosLoadingOverlay;