@zonos/elements 1.3.201 → 1.3.203

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 (308) hide show
  1. package/dist/cjs/VarianceTest-0cb1e118.js +12 -0
  2. package/dist/cjs/cart-0d91ad0b.js +1955 -0
  3. package/dist/cjs/{debounce-d393fafe.js → debounce-94e1b7ff.js} +1 -1
  4. package/dist/cjs/{getBorderRadius-3d0a563e.js → getBorderRadius-8d3b1049.js} +1 -1
  5. package/dist/cjs/index.cjs.js +10 -8
  6. package/dist/cjs/{isDarkColor-92a10a85.js → isDarkColor-bcf49625.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{cart-e73cde62.js → localization-2f17c95f.js} +74 -1941
  9. package/dist/cjs/{paypal-39bbbd1a.js → paypal-9953115b.js} +10 -9
  10. package/dist/cjs/zonos-address_11.cjs.entry.js +98 -72
  11. package/dist/cjs/zonos-badge.cjs.entry.js +2 -1
  12. package/dist/cjs/zonos-banner.cjs.entry.js +2 -1
  13. package/dist/cjs/zonos-button_3.cjs.entry.js +4 -3
  14. package/dist/cjs/zonos-card.cjs.entry.js +3 -2
  15. package/dist/cjs/{zonos-cart-items_13.cjs.entry.js → zonos-cart-items_14.cjs.entry.js} +105 -82
  16. package/dist/cjs/zonos-checkout.cjs.entry.js +395 -50
  17. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -1
  18. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-controller.cjs.entry.js +13 -11
  20. package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -5
  21. package/dist/cjs/zonos-country-select_4.cjs.entry.js +13 -13
  22. package/dist/cjs/zonos-elements.cjs.js +1 -1
  23. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +10 -8
  24. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +41 -42
  25. package/dist/cjs/zonos-hello.cjs.entry.js +30 -31
  26. package/dist/cjs/zonos-input.cjs.entry.js +3 -2
  27. package/dist/cjs/zonos-language-select_2.cjs.entry.js +8 -9
  28. package/dist/cjs/zonos-logo.cjs.entry.js +4 -3
  29. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -2
  30. package/dist/cjs/zonos-stripe-input.cjs.entry.js +8 -7
  31. package/dist/cjs/zonos-text.cjs.entry.js +2 -1
  32. package/dist/cjs/zonos-toggle.cjs.entry.js +4 -3
  33. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  34. package/dist/cjs/zonos-v-stack.cjs.entry.js +4 -3
  35. package/dist/cjs/{zonosStore-c466b127.js → zonosStore-9264749e.js} +15 -5
  36. package/dist/collection/collection-manifest.json +1 -0
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +18 -17
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +235 -15
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +3 -3
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +9 -4
  41. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.css +62 -0
  42. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +90 -0
  43. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  44. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  45. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  46. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +4 -4
  47. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  48. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  49. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  50. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  51. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  52. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  53. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  54. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  55. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  56. package/dist/collection/components/main/zonos-controller.js +3 -3
  57. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  58. package/dist/collection/components/store/checkout/cart.js +28 -18
  59. package/dist/collection/components/store/checkout/paypal.js +2 -1
  60. package/dist/collection/components/store/checkout/stripe.js +16 -11
  61. package/dist/collection/components/store/hello/localization.js +5 -5
  62. package/dist/collection/components/store/storageStore.js +32 -0
  63. package/dist/collection/components/store/zonosStore.js +12 -6
  64. package/dist/collection/components/stripe/zonos-address/zonos-address.js +18 -6
  65. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  66. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +19 -7
  67. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +3 -3
  68. package/dist/collection/components/utils/api/getCheckoutSession.js +3 -3
  69. package/dist/collection/components/utils/api/placeTestOrder.js +2 -1
  70. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +3 -2
  71. package/dist/collection/components/utils/api/selectVarianceTest.js +20 -0
  72. package/dist/collection/components/utils/buildCartUrl.js +44 -0
  73. package/dist/collection/components/utils/getLegacyQueryParams.js +42 -0
  74. package/dist/collection/components/utils/varianceTest/filterExpiredTests.js +6 -0
  75. package/dist/collection/components/utils/varianceTest/filterValidTests.js +23 -0
  76. package/dist/collection/components/utils/varianceTest/getSelectedTestVariant.js +6 -0
  77. package/dist/collection/components/utils/varianceTest/hasAtLeastOneAvailableTestKey.js +14 -0
  78. package/dist/collection/components/utils/varianceTest/isInAvailableTestKey.js +4 -0
  79. package/dist/collection/components/utils/varianceTest/isTestEnabled.js +4 -0
  80. package/dist/collection/components/utils/varianceTest/isTestKeysAllVariantSelected.js +6 -0
  81. package/dist/collection/components/utils/varianceTest/mergeTest.js +13 -0
  82. package/dist/collection/scripts/_getZonosQaUrl.js +2 -2
  83. package/dist/collection/types/checkout/api/VarianceTest.js +8 -0
  84. package/dist/collection/types/generated/graphql.internal.types.js +26 -7
  85. package/dist/collection/types/index.js +1 -0
  86. package/dist/esm/VarianceTest-fef2d958.js +10 -0
  87. package/dist/esm/cart-db61eb95.js +1918 -0
  88. package/dist/esm/{debounce-a2121722.js → debounce-3a9f27a0.js} +1 -1
  89. package/dist/esm/{getBorderRadius-413e97eb.js → getBorderRadius-78b28b4d.js} +1 -1
  90. package/dist/esm/index.js +9 -8
  91. package/dist/esm/{isDarkColor-4c7b2ffc.js → isDarkColor-31dd7dff.js} +1 -1
  92. package/dist/esm/loader.js +1 -1
  93. package/dist/esm/{cart-f79c8021.js → localization-bf7224aa.js} +70 -1907
  94. package/dist/esm/{paypal-6d4667d1.js → paypal-2e0ffb07.js} +5 -4
  95. package/dist/esm/zonos-address_11.entry.js +54 -28
  96. package/dist/esm/zonos-badge.entry.js +2 -1
  97. package/dist/esm/zonos-banner.entry.js +2 -1
  98. package/dist/esm/zonos-button_3.entry.js +4 -3
  99. package/dist/esm/zonos-card.entry.js +3 -2
  100. package/dist/esm/{zonos-cart-items_13.entry.js → zonos-cart-items_14.entry.js} +54 -32
  101. package/dist/esm/zonos-checkout.entry.js +363 -18
  102. package/dist/esm/zonos-collapse.entry.js +2 -1
  103. package/dist/esm/zonos-component.entry.js +1 -1
  104. package/dist/esm/zonos-controller.entry.js +8 -6
  105. package/dist/esm/zonos-country-flag.entry.js +3 -4
  106. package/dist/esm/zonos-country-select_4.entry.js +8 -8
  107. package/dist/esm/zonos-elements.js +1 -1
  108. package/dist/esm/zonos-empty-state-payment_4.entry.js +10 -8
  109. package/dist/esm/zonos-hello-dialog.entry.js +7 -8
  110. package/dist/esm/zonos-hello.entry.js +4 -5
  111. package/dist/esm/zonos-input.entry.js +3 -2
  112. package/dist/esm/zonos-language-select_2.entry.js +5 -6
  113. package/dist/esm/zonos-logo.entry.js +4 -3
  114. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -2
  115. package/dist/esm/zonos-stripe-input.entry.js +8 -7
  116. package/dist/esm/zonos-text.entry.js +2 -1
  117. package/dist/esm/zonos-toggle.entry.js +4 -3
  118. package/dist/esm/zonos-tooltip.entry.js +2 -2
  119. package/dist/esm/zonos-v-stack.entry.js +4 -3
  120. package/dist/esm/{zonosStore-cdabc848.js → zonosStore-d10a829f.js} +15 -5
  121. package/dist/esm-es5/VarianceTest-fef2d958.js +1 -0
  122. package/dist/esm-es5/cart-db61eb95.js +1 -0
  123. package/dist/esm-es5/{debounce-a2121722.js → debounce-3a9f27a0.js} +1 -1
  124. package/dist/esm-es5/{getBorderRadius-413e97eb.js → getBorderRadius-78b28b4d.js} +1 -1
  125. package/dist/esm-es5/index.js +1 -1
  126. package/dist/esm-es5/{isDarkColor-4c7b2ffc.js → isDarkColor-31dd7dff.js} +1 -1
  127. package/dist/esm-es5/loader.js +1 -1
  128. package/dist/esm-es5/localization-bf7224aa.js +1 -0
  129. package/dist/esm-es5/{paypal-6d4667d1.js → paypal-2e0ffb07.js} +2 -2
  130. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  131. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  132. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  133. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  134. package/dist/esm-es5/zonos-card.entry.js +1 -1
  135. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -0
  136. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  137. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  138. package/dist/esm-es5/zonos-component.entry.js +1 -1
  139. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  140. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  141. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  142. package/dist/esm-es5/zonos-elements.js +1 -1
  143. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  144. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  145. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  146. package/dist/esm-es5/zonos-input.entry.js +1 -1
  147. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  148. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  149. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  150. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  151. package/dist/esm-es5/zonos-text.entry.js +1 -1
  152. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  153. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  154. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  155. package/dist/esm-es5/zonosStore-d10a829f.js +1 -0
  156. package/dist/scripts/index.d.ts +844 -766
  157. package/dist/scripts/index.js +1 -1
  158. package/dist/scripts/loadZonos.js +1 -1
  159. package/dist/scripts/zonos.js +1 -1
  160. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +16 -0
  161. package/dist/types/components/common/zonos-loading-overlay/zonos-loading-overlay.d.ts +16 -0
  162. package/dist/types/components/store/checkout/cart.d.ts +5 -2
  163. package/dist/types/components/store/checkout/stripe.d.ts +2 -2
  164. package/dist/types/components/store/hello/localization.d.ts +2 -2
  165. package/dist/types/components/store/storageStore.d.ts +13 -0
  166. package/dist/types/components/store/zonosStore.d.ts +7 -2
  167. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -0
  168. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +2 -0
  169. package/dist/types/components/utils/api/selectVarianceTest.d.ts +6 -0
  170. package/dist/types/components/utils/buildCartUrl.d.ts +10 -0
  171. package/dist/types/components/utils/getLegacyQueryParams.d.ts +2 -0
  172. package/dist/types/components/utils/varianceTest/filterExpiredTests.d.ts +2 -0
  173. package/dist/types/components/utils/varianceTest/filterValidTests.d.ts +9 -0
  174. package/dist/types/components/utils/varianceTest/getSelectedTestVariant.d.ts +2 -0
  175. package/dist/types/components/utils/varianceTest/hasAtLeastOneAvailableTestKey.d.ts +8 -0
  176. package/dist/types/components/utils/varianceTest/isInAvailableTestKey.d.ts +2 -0
  177. package/dist/types/components/utils/varianceTest/isTestEnabled.d.ts +2 -0
  178. package/dist/types/components/utils/varianceTest/isTestKeysAllVariantSelected.d.ts +9 -0
  179. package/dist/types/components/utils/varianceTest/mergeTest.d.ts +5 -0
  180. package/dist/types/components.d.ts +51 -0
  181. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +7 -0
  182. package/dist/types/types/checkout/CheckoutConfig.d.ts +13 -1
  183. package/dist/types/types/checkout/api/CheckoutSession.d.ts +7 -0
  184. package/dist/types/types/checkout/api/VarianceTest.d.ts +30 -0
  185. package/dist/types/types/generated/graphql.internal.types.d.ts +206 -22
  186. package/dist/types/types/generated/graphql.internal.types.ts +235 -19
  187. package/dist/types/types/index.d.ts +1 -0
  188. package/dist/types/types/utils/ZonosSettings.d.ts +7 -6
  189. package/dist/zonos-elements/index.esm.js +1 -1
  190. package/dist/zonos-elements/{p-609c32a3.system.entry.js → p-01987cb2.system.entry.js} +1 -1
  191. package/dist/zonos-elements/p-04a01cb1.js +1 -0
  192. package/dist/zonos-elements/p-04b43dd5.entry.js +1 -0
  193. package/dist/zonos-elements/{p-7d5d89f2.system.js → p-0693422b.system.js} +2 -2
  194. package/dist/zonos-elements/p-06f25f75.entry.js +1 -0
  195. package/dist/zonos-elements/p-0c62cfb3.entry.js +1 -0
  196. package/dist/zonos-elements/{p-7831b52c.system.entry.js → p-1dcdb65f.system.entry.js} +1 -1
  197. package/dist/zonos-elements/p-25970cb8.system.entry.js +1 -0
  198. package/dist/zonos-elements/p-26a634a5.system.entry.js +1 -0
  199. package/dist/zonos-elements/p-27987298.system.entry.js +1 -0
  200. package/dist/zonos-elements/p-2bb8ca7d.system.entry.js +1 -0
  201. package/dist/zonos-elements/p-2f70d0eb.entry.js +1 -0
  202. package/dist/zonos-elements/p-3284f459.system.entry.js +1 -0
  203. package/dist/zonos-elements/{p-13796f98.js → p-3d82a352.js} +1 -1
  204. package/dist/zonos-elements/p-411b8e10.entry.js +1 -0
  205. package/dist/zonos-elements/p-452070af.system.entry.js +1 -0
  206. package/dist/zonos-elements/p-45ebc788.entry.js +1 -0
  207. package/dist/zonos-elements/p-4c81112f.entry.js +1 -0
  208. package/dist/zonos-elements/p-4efa8187.js +1 -0
  209. package/dist/zonos-elements/p-5170bc41.entry.js +1 -0
  210. package/dist/zonos-elements/p-54cdc47f.system.entry.js +1 -0
  211. package/dist/zonos-elements/p-5a2dd041.system.js +1 -0
  212. package/dist/zonos-elements/p-5c74e5c9.system.entry.js +1 -0
  213. package/dist/zonos-elements/p-5d0f7364.system.js +1 -0
  214. package/dist/zonos-elements/p-6b6a9dd6.system.js +1 -0
  215. package/dist/zonos-elements/p-715d0f59.system.entry.js +1 -0
  216. package/dist/zonos-elements/{p-b8d87932.js → p-72f37935.js} +1 -1
  217. package/dist/zonos-elements/p-7ae5cd60.entry.js +1 -0
  218. package/dist/zonos-elements/p-7cd09f1f.system.js +1 -0
  219. package/dist/zonos-elements/p-80bbd9c0.system.entry.js +1 -0
  220. package/dist/zonos-elements/p-851c642e.system.entry.js +1 -0
  221. package/dist/zonos-elements/{p-4300d944.entry.js → p-8d870d4c.entry.js} +1 -1
  222. package/dist/zonos-elements/p-9af5e93a.entry.js +1 -0
  223. package/dist/zonos-elements/{p-5de59662.js → p-a9307caa.js} +2 -2
  224. package/dist/zonos-elements/p-aa1193bc.entry.js +1 -0
  225. package/dist/zonos-elements/p-ab176281.system.entry.js +1 -0
  226. package/dist/zonos-elements/p-bc8bda92.entry.js +1 -0
  227. package/dist/zonos-elements/p-be5afc91.system.entry.js +1 -0
  228. package/dist/zonos-elements/p-c291bac1.entry.js +1 -0
  229. package/dist/zonos-elements/p-c3d2422e.entry.js +1 -0
  230. package/dist/zonos-elements/{p-f28eb1dd.system.js → p-c50b3100.system.js} +1 -1
  231. package/dist/zonos-elements/p-c5fcbc92.system.entry.js +1 -0
  232. package/dist/zonos-elements/p-c767242b.entry.js +1 -0
  233. package/dist/zonos-elements/p-c9aa902e.system.entry.js +1 -0
  234. package/dist/zonos-elements/p-cb823c4d.system.js +1 -0
  235. package/dist/zonos-elements/p-cdd3087f.system.entry.js +1 -0
  236. package/dist/zonos-elements/p-d2165441.system.entry.js +1 -0
  237. package/dist/zonos-elements/{p-d422ad1d.system.js → p-d42dfd32.system.js} +1 -1
  238. package/dist/zonos-elements/p-d46349d3.system.entry.js +1 -0
  239. package/dist/zonos-elements/{p-b2241919.entry.js → p-d6a10007.entry.js} +1 -1
  240. package/dist/zonos-elements/p-d99d9e00.js +1 -0
  241. package/dist/zonos-elements/p-db025dfc.system.entry.js +1 -0
  242. package/dist/zonos-elements/p-dcd6acd4.system.entry.js +1 -0
  243. package/dist/zonos-elements/p-dd1cfa74.entry.js +1 -0
  244. package/dist/zonos-elements/p-df4c46a6.entry.js +1 -0
  245. package/dist/zonos-elements/p-dfd1ba1d.entry.js +1 -0
  246. package/dist/zonos-elements/{p-4593324c.js → p-e26c9e83.js} +1 -1
  247. package/dist/zonos-elements/p-e68d5219.entry.js +1 -0
  248. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
  249. package/dist/zonos-elements/p-ef3e05e5.system.js +1 -0
  250. package/dist/zonos-elements/p-f255e822.js +1 -0
  251. package/dist/zonos-elements/p-f655ec36.entry.js +1 -0
  252. package/dist/zonos-elements/{p-e91b244c.entry.js → p-f891d470.entry.js} +1 -1
  253. package/dist/zonos-elements/p-f8d0d488.system.entry.js +1 -0
  254. package/dist/zonos-elements/{p-240ee490.system.entry.js → p-fbe36bc8.system.entry.js} +1 -1
  255. package/dist/zonos-elements/p-fcc2e712.entry.js +1 -0
  256. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  257. package/package.json +1 -1
  258. package/dist/esm-es5/cart-f79c8021.js +0 -1
  259. package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
  260. package/dist/esm-es5/zonosStore-cdabc848.js +0 -1
  261. package/dist/zonos-elements/p-0302a254.entry.js +0 -1
  262. package/dist/zonos-elements/p-06ed3582.system.js +0 -1
  263. package/dist/zonos-elements/p-147ca395.entry.js +0 -1
  264. package/dist/zonos-elements/p-1998d8b3.entry.js +0 -1
  265. package/dist/zonos-elements/p-1eddec23.entry.js +0 -1
  266. package/dist/zonos-elements/p-20030bf5.system.js +0 -1
  267. package/dist/zonos-elements/p-24a2e899.system.entry.js +0 -1
  268. package/dist/zonos-elements/p-264f46a5.entry.js +0 -1
  269. package/dist/zonos-elements/p-2882b9f4.entry.js +0 -1
  270. package/dist/zonos-elements/p-2c915112.system.entry.js +0 -1
  271. package/dist/zonos-elements/p-327aebf5.entry.js +0 -1
  272. package/dist/zonos-elements/p-33488109.system.entry.js +0 -1
  273. package/dist/zonos-elements/p-337fab4e.js +0 -1
  274. package/dist/zonos-elements/p-3ddecaa4.system.entry.js +0 -1
  275. package/dist/zonos-elements/p-48f70043.system.entry.js +0 -1
  276. package/dist/zonos-elements/p-49a31b14.system.entry.js +0 -1
  277. package/dist/zonos-elements/p-4cd867d5.js +0 -1
  278. package/dist/zonos-elements/p-55711b80.system.entry.js +0 -1
  279. package/dist/zonos-elements/p-578bf5d7.entry.js +0 -1
  280. package/dist/zonos-elements/p-5c061a35.entry.js +0 -1
  281. package/dist/zonos-elements/p-6096c1c5.entry.js +0 -1
  282. package/dist/zonos-elements/p-65a8f19d.entry.js +0 -1
  283. package/dist/zonos-elements/p-6adc6e27.entry.js +0 -1
  284. package/dist/zonos-elements/p-6cd9b6a1.system.entry.js +0 -1
  285. package/dist/zonos-elements/p-79070ee6.entry.js +0 -1
  286. package/dist/zonos-elements/p-7bb9c330.entry.js +0 -1
  287. package/dist/zonos-elements/p-82aa4f9f.system.entry.js +0 -1
  288. package/dist/zonos-elements/p-8540f3e2.system.entry.js +0 -1
  289. package/dist/zonos-elements/p-8a9d4605.system.entry.js +0 -1
  290. package/dist/zonos-elements/p-932bed54.system.entry.js +0 -1
  291. package/dist/zonos-elements/p-94e3e50d.system.entry.js +0 -1
  292. package/dist/zonos-elements/p-9f6dd86a.entry.js +0 -1
  293. package/dist/zonos-elements/p-a64ab131.system.entry.js +0 -1
  294. package/dist/zonos-elements/p-aac95779.system.entry.js +0 -1
  295. package/dist/zonos-elements/p-ad3c5358.entry.js +0 -1
  296. package/dist/zonos-elements/p-af6af82e.system.js +0 -1
  297. package/dist/zonos-elements/p-b66b3306.system.entry.js +0 -1
  298. package/dist/zonos-elements/p-b6afcf3f.system.entry.js +0 -1
  299. package/dist/zonos-elements/p-b8d91f99.entry.js +0 -1
  300. package/dist/zonos-elements/p-c770044a.system.entry.js +0 -1
  301. package/dist/zonos-elements/p-d4842d10.system.entry.js +0 -1
  302. package/dist/zonos-elements/p-d6c3aec8.system.entry.js +0 -1
  303. package/dist/zonos-elements/p-daf73a4c.system.js +0 -1
  304. package/dist/zonos-elements/p-de388ea0.entry.js +0 -1
  305. package/dist/zonos-elements/p-e14d89de.entry.js +0 -1
  306. package/dist/zonos-elements/p-f6e587bb.entry.js +0 -1
  307. package/dist/zonos-elements/p-f818bdf5.entry.js +0 -1
  308. package/dist/zonos-elements/p-fce6bffe.system.entry.js +0 -1
@@ -3,17 +3,19 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-0993f42d.js');
6
- const cart = require('./cart-e73cde62.js');
7
- const paypal = require('./paypal-39bbbd1a.js');
8
- const zonosStore = require('./zonosStore-c466b127.js');
6
+ const cart = require('./cart-0d91ad0b.js');
7
+ const paypal = require('./paypal-9953115b.js');
8
+ const localization = require('./localization-2f17c95f.js');
9
+ const zonosStore = require('./zonosStore-9264749e.js');
9
10
  const handleFetch = require('./handleFetch-969d05d8.js');
10
11
  const classes = require('./classes-b7918f56.js');
11
12
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
12
- const getBorderRadius = require('./getBorderRadius-3d0a563e.js');
13
- const isDarkColor = require('./isDarkColor-92a10a85.js');
13
+ const getBorderRadius = require('./getBorderRadius-8d3b1049.js');
14
+ const isDarkColor = require('./isDarkColor-bcf49625.js');
14
15
  const styles = require('./styles-d1e64fb9.js');
15
16
  const CheckoutConfig = require('./CheckoutConfig-4afc683b.js');
16
17
  const RemoveIcon = require('./RemoveIcon-081ac073.js');
18
+ require('./VarianceTest-0cb1e118.js');
17
19
 
18
20
  /**
19
21
  * Map the items from tempCart like how we do it in dgs
@@ -51,11 +53,75 @@ const isStoreDiscountEnabled = async () => {
51
53
  return { enabled: true };
52
54
  };
53
55
 
56
+ const selectVarianceTest = async ({ testKeys }) => {
57
+ // Do nothing if no test keys are provided
58
+ if (testKeys.length === 0) {
59
+ return null;
60
+ }
61
+ const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/select-variance-test', {
62
+ body: {
63
+ testKeys,
64
+ },
65
+ method: 'POST',
66
+ });
67
+ if (errors.length || !json) {
68
+ return null;
69
+ }
70
+ const filteredAvailableTestKeys = localization.filterValidTests(json);
71
+ // Filter the response to only include test keys that we support
72
+ return filteredAvailableTestKeys;
73
+ };
74
+
75
+ const buildCartUrl = ({ cartId, checkoutSessionId, customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerFirstName, customerLastName, customerPhone, customerState, customerZip, hostedCheckoutUrl, isTestMode, isVariantTest, }) => {
76
+ const urlParams = new URLSearchParams();
77
+ urlParams.set('tempCartUUID', cartId);
78
+ if (customerFirstName) {
79
+ urlParams.set('customerFirstName', customerFirstName);
80
+ }
81
+ if (customerLastName) {
82
+ urlParams.set('customerLastName', customerLastName);
83
+ }
84
+ if (customerEmail) {
85
+ urlParams.set('customerEmail', customerEmail);
86
+ }
87
+ if (customerPhone) {
88
+ urlParams.set('customerPhone', customerPhone);
89
+ }
90
+ if (customerZip) {
91
+ urlParams.set('customerZip', customerZip);
92
+ }
93
+ if (customerCity) {
94
+ urlParams.set('customerCity', customerCity);
95
+ }
96
+ if (customerState) {
97
+ urlParams.set('customerState', customerState);
98
+ }
99
+ if (customerCountry) {
100
+ urlParams.set('zCountry', customerCountry);
101
+ }
102
+ if (customerAddress1) {
103
+ urlParams.set('customerAddress1', customerAddress1);
104
+ }
105
+ if (customerAddress2) {
106
+ urlParams.set('customerAddress2', customerAddress2);
107
+ }
108
+ if (isTestMode) {
109
+ urlParams.set('zonosTestMode', '1');
110
+ }
111
+ if (checkoutSessionId) {
112
+ urlParams.set('zonosCheckoutSessionId', checkoutSessionId);
113
+ }
114
+ if (isVariantTest) {
115
+ urlParams.set('zonosVariantTest', '1');
116
+ }
117
+ return `${hostedCheckoutUrl}?${urlParams.toString()}`;
118
+ };
119
+
54
120
  const isDisabledCountry = (showLog = true) => {
55
- if (!cart.localizationStore.localizationLoaded) {
121
+ if (!localization.localizationStore.localizationLoaded) {
56
122
  return true;
57
123
  }
58
- if (cart.localizationStore.isDisabledCountry) {
124
+ if (localization.localizationStore.isDisabledCountry) {
59
125
  if (showLog) {
60
126
  handleFetch.log(`Checkout: disabled country`);
61
127
  }
@@ -65,11 +131,11 @@ const isDisabledCountry = (showLog = true) => {
65
131
  };
66
132
 
67
133
  const isShippableCountry = (showLog = true) => {
68
- if (!cart.localizationStore.localizationLoaded) {
134
+ if (!localization.localizationStore.localizationLoaded) {
69
135
  return false;
70
136
  }
71
137
  // if localization is loaded and the localization is not a shippable country, keep the original click event
72
- if (!cart.localizationStore.isShippableCountry) {
138
+ if (!localization.localizationStore.isShippableCountry) {
73
139
  if (showLog) {
74
140
  handleFetch.log(`Checkout: not shippable country`);
75
141
  }
@@ -118,7 +184,7 @@ const watchBigcommerceDomesticCheckout = ({ domesticRedirectedBtnSelector, onShi
118
184
  return;
119
185
  }
120
186
  // update the country code in localization store and check if it's shippable
121
- cart.localizationStoreUpdateSelectedCountryCode(shippingCountry);
187
+ localization.localizationStoreUpdateSelectedCountryCode(shippingCountry);
122
188
  // do nothing if the country is still domestic
123
189
  if (!isShippableCountry(false)) {
124
190
  // cleanup the domestic shipping session if it's domestic because we will open the intl checkout after redirecting
@@ -183,6 +249,46 @@ const watchBigcommerceDomesticCheckout = ({ domesticRedirectedBtnSelector, onShi
183
249
  });
184
250
  };
185
251
 
252
+ const getLegacyQueryParams = () => {
253
+ const urlParams = new URLSearchParams(window.location.search);
254
+ handleFetch.log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
255
+ const getParam = (param) => {
256
+ const value = urlParams.get(param);
257
+ if (!value || value === 'undefined') {
258
+ return '';
259
+ }
260
+ return value;
261
+ };
262
+ const customerCountry =
263
+ // fallback to selected country code if country is not provided
264
+ localization.getZCountryUrlParam(urlParams) ||
265
+ localization.localizationStore.selectedCountryCode ||
266
+ 'US';
267
+ const customerCity = getParam('customerCity');
268
+ const customerEmail = getParam('customerEmail');
269
+ const customerAddress1 = getParam('customerAddress1');
270
+ const customerAddress2 = getParam('customerAddress2');
271
+ const customerName = getParam('customerName');
272
+ const customerPhone = getParam('customerPhone');
273
+ const customerZip = getParam('customerZip');
274
+ const customerState = getParam('customerState');
275
+ const customerFirstName = getParam('customerFirstName');
276
+ const customerLastName = getParam('customerLastName');
277
+ return {
278
+ customerAddress1,
279
+ customerAddress2,
280
+ customerCity,
281
+ customerCountry,
282
+ customerEmail,
283
+ customerFirstName,
284
+ customerLastName,
285
+ customerName,
286
+ customerPhone,
287
+ customerState,
288
+ customerZip,
289
+ };
290
+ };
291
+
186
292
  let numberOfFailures = 0;
187
293
  const sendBulkLoadTimeApiLog = async () => {
188
294
  // Don't send the log if there are no API calls to send
@@ -250,6 +356,36 @@ const sendLoadNativeCheckoutLog = async ({ loadTime, }) => {
250
356
  });
251
357
  };
252
358
 
359
+ const filterExpiredTests = (testKeys) => (testKeys === null || testKeys === void 0 ? void 0 : testKeys.filter(v => {
360
+ if ((v.expiresAt && v.expiresAt < Date.now()) || !v.expiresAt) {
361
+ return false;
362
+ }
363
+ return true;
364
+ })) || [];
365
+
366
+ const getSelectedTestVariant = (testKey) => {
367
+ var _a;
368
+ const currentTest = (_a = localization.storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.find(v => v.testKey === testKey);
369
+ return (currentTest === null || currentTest === void 0 ? void 0 : currentTest.selectedVariantKey) || null;
370
+ };
371
+
372
+ const isTestEnabled = (testKey) => {
373
+ return zonosStore.zonosStore.enabledVariantTestKeys.includes(testKey);
374
+ };
375
+
376
+ const mergeTest = ({ baseTestObj, mergeTestObj, }) => {
377
+ return baseTestObj.map(({ testKey }) => {
378
+ // We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
379
+ const existingSelection = mergeTestObj.find(({ testKey: key }) => key === testKey);
380
+ return {
381
+ expiresAt: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.expiresAt) ||
382
+ Date.now() + localization.VARIANT_TEST_KEY_EXPIRATION,
383
+ selectedVariantKey: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.selectedVariantKey) || null,
384
+ testKey,
385
+ };
386
+ });
387
+ };
388
+
253
389
  const getTempCartById = async ({ cartId, retries, }) => {
254
390
  const isTestMode = handleFetch.getIsTestMode();
255
391
  const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-temp-cart', {
@@ -369,7 +505,7 @@ const ZonosCheckout = class {
369
505
  handleFetch.log('Payment intent failed, show status from error');
370
506
  }
371
507
  this.open = true;
372
- cart.cartStore.checkoutSessionId = zonosCheckoutSessionId;
508
+ localization.storageStore.checkoutSessionId = zonosCheckoutSessionId;
373
509
  cart.stripeStore.clientSecret = stripeClientSecret;
374
510
  void this.setToFinishStep(status);
375
511
  return { shouldAllowOrder: false };
@@ -381,6 +517,121 @@ const ZonosCheckout = class {
381
517
  handleFetch.log('Payment intent is not succeeded, proceed to order');
382
518
  return { shouldAllowOrder: true };
383
519
  };
520
+ this.initializeTestKeys = () => {
521
+ // cleanup expired test keys
522
+ localization.storageStore.enabledVariantTestKeys = filterExpiredTests(localization.storageStore.enabledVariantTestKeys || []);
523
+ // map existingSelection to the enabled variant test keys from database
524
+ const existingSelectionMap = zonosStore.zonosStore.enabledVariantTestKeys.map(testKey => {
525
+ var _a;
526
+ // We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
527
+ const existingSelection = (_a = localization.storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.find(({ testKey: key }) => key === testKey);
528
+ return {
529
+ expiresAt: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.expiresAt) ||
530
+ Date.now() + localization.VARIANT_TEST_KEY_EXPIRATION,
531
+ selectedVariantKey: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.selectedVariantKey) || null,
532
+ testKey,
533
+ };
534
+ });
535
+ localization.storageStoreSetEnabledVariantTestKeys(existingSelectionMap);
536
+ return {
537
+ allSelected: false,
538
+ };
539
+ };
540
+ this.shouldAllowHostedVsNativeTest = () => {
541
+ // This test is only applicable to checkout that's using createCartid callback
542
+ if (typeof zonosStore.zonosStore.checkoutSettings.createCartId !== 'function') {
543
+ return false;
544
+ }
545
+ const hostedVsNativeTest = zonosStore.zonosStore.enabledVariantTestKeys.includes('hosted_vs_native');
546
+ // Should not do anything if the test is not enabled
547
+ if (!hostedVsNativeTest) {
548
+ return false;
549
+ }
550
+ return true;
551
+ };
552
+ // Register test hosted vs native if needed to get the variant selection for this test
553
+ this.registerTestHostedVsNative = async () => {
554
+ // This test is only applicable to checkout that's using createCartid callback
555
+ const isAllowedHostedVsNativeTest = this.shouldAllowHostedVsNativeTest();
556
+ if (!isAllowedHostedVsNativeTest) {
557
+ return;
558
+ }
559
+ handleFetch.log(`[TEST] - Registering hosted vs native test`);
560
+ const selectedVariantKey = getSelectedTestVariant('hosted_vs_native');
561
+ // No need to request variant test for this test if the test already has variant selected
562
+ if (selectedVariantKey) {
563
+ handleFetch.log(`[TEST] - Hosted vs native test already has variant selected: ${selectedVariantKey}`);
564
+ return;
565
+ }
566
+ // Get variance test selection from the testKey not yet selected
567
+ const response = await selectVarianceTest({
568
+ testKeys: ['hosted_vs_native'],
569
+ });
570
+ // Do not prevent user from proceeding if the test is not enabled or failed to get selection
571
+ if (!response) {
572
+ handleFetch.log(`[TEST] - Failed to get selection for hosted vs native test`);
573
+ return;
574
+ }
575
+ // At this point, all test keys should already have variant selected. Update and map the selected variant to the existing test keys
576
+ const mappedEnabledVariantTestKeys = mergeTest({
577
+ baseTestObj: localization.storageStore.enabledVariantTestKeys || [],
578
+ mergeTestObj: response,
579
+ });
580
+ // Set the selected variant to the storage store
581
+ localization.storageStoreSetEnabledVariantTestKeys(mappedEnabledVariantTestKeys);
582
+ };
583
+ // Handle hosted vs native test
584
+ this.handleHostedVsNative = async () => {
585
+ var _a;
586
+ // This test is only applicable to checkout that's using createCartid callback
587
+ const isAllowedHostedVsNativeTest = this.shouldAllowHostedVsNativeTest();
588
+ if (!isAllowedHostedVsNativeTest) {
589
+ return {
590
+ redirected: false,
591
+ };
592
+ }
593
+ const selectedVariantTest = getSelectedTestVariant('hosted_vs_native');
594
+ handleFetch.log(`[TEST] - hosted_vs_native: ${selectedVariantTest}`);
595
+ // This test is only applicable to checkout that's using createCartid callback
596
+ if (typeof zonosStore.zonosStore.checkoutSettings.createCartId !== 'function') {
597
+ handleFetch.log(`[TEST] - createCartId is not provided, skipping hosted vs native test`);
598
+ return {
599
+ redirected: false,
600
+ };
601
+ }
602
+ // No need to do anything if the test is enabled for native
603
+ if (selectedVariantTest !== 'hosted') {
604
+ handleFetch.log(`[TEST] - Hosted vs native test is enabled for native, skipping`);
605
+ return {
606
+ redirected: false,
607
+ };
608
+ }
609
+ if (!((_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.hostedCheckoutUrl)) {
610
+ handleFetch.log('[TEST] - Hosted checkout URL is not provided');
611
+ return {
612
+ redirected: false,
613
+ };
614
+ }
615
+ handleFetch.log('"createCartId" is provided, start building cart');
616
+ const cartIdResult = await zonosStore.zonosStore.checkoutSettings.createCartId();
617
+ let cartId;
618
+ let shippingData = null;
619
+ if (typeof cartIdResult === 'object') {
620
+ cartId = cartIdResult.cartId;
621
+ shippingData = cartIdResult.shippingData || null;
622
+ }
623
+ else {
624
+ cartId = cartIdResult;
625
+ }
626
+ const legacyQueryParams = getLegacyQueryParams();
627
+ const cartUrl = buildCartUrl(Object.assign(Object.assign({ cartId, checkoutSessionId: localization.storageStore.checkoutSessionId || undefined, hostedCheckoutUrl: zonosStore.zonosStore.genericSettings.hostedCheckoutUrl, isTestMode: handleFetch.getIsTestMode(), isVariantTest: true }, legacyQueryParams), shippingData));
628
+ handleFetch.log(`[TEST] - Redirecting to: ${cartUrl}`);
629
+ // Open new page with the cart URL
630
+ window.open(cartUrl, '_blank');
631
+ return {
632
+ redirected: true,
633
+ };
634
+ };
384
635
  this.formatDate = (timestamp) => {
385
636
  if (!timestamp) {
386
637
  return '';
@@ -441,6 +692,72 @@ const ZonosCheckout = class {
441
692
  }
442
693
  return this.defaultAddressParams;
443
694
  };
695
+ /**
696
+ * Message listener from the hosted checkout tab just openned from the hosted vs native variant test
697
+ */
698
+ this.handleHostedOpenWindowCallback = (e) => {
699
+ var _a;
700
+ // check if it's from origin of hosted checkout url
701
+ const hostedCheckoutUrl = (_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.hostedCheckoutUrl;
702
+ // Do nothing if hosted checkout url is not set
703
+ if (!origin) {
704
+ return;
705
+ }
706
+ // Do nothing if it's not from the origin of hosted checkout url
707
+ const isDev = ['dev.checkout.elements.zonos.com'].some(dev => e.origin.includes(dev));
708
+ // Do not allow to receive message if not from origin we expected when it's not dev environment
709
+ if (e.origin !== hostedCheckoutUrl && !isDev) {
710
+ return;
711
+ }
712
+ switch (e.data.type) {
713
+ case 'zonos-checkout-session-update':
714
+ // Update and set checkout session id to storage so that if user come back to merchant site, it will persist the test variance selection
715
+ localization.storageStore.checkoutSessionId = e.data.checkoutSessionId;
716
+ break;
717
+ }
718
+ };
719
+ /**
720
+ * Capture params from the url and set to the store when it's redirected from hosted checkout url for variant test
721
+ */
722
+ this.captureParamsRedirectedForVariantTest = () => {
723
+ const url = new URL(window.location.href);
724
+ const zonosVariantTest = url.searchParams.get('zonosVariantTest') === '1';
725
+ // Do nothing if the url is not loaded from hosted vs native variant test
726
+ if (!zonosVariantTest) {
727
+ return;
728
+ }
729
+ const checkoutSessionId = url.searchParams.get('zonosCheckoutSessionId');
730
+ if (checkoutSessionId) {
731
+ localization.storageStore.checkoutSessionId = checkoutSessionId;
732
+ }
733
+ // merge variant test input from url to storageStore.enabledVariantTestKeys
734
+ const enabledVariantTestKeys = localization.storageStore.enabledVariantTestKeys || [];
735
+ // override the selected variant key if it's not "hosted" since we are in hosted checkout tab
736
+ if (window.Zonos.isLegacyCheckout) {
737
+ const selectedVariantKey = getSelectedTestVariant('hosted_vs_native');
738
+ // Set selected variant key "hosted" to enabledVariantTestKeys if it's not in enabledVariantTestKeys already
739
+ if (!selectedVariantKey) {
740
+ enabledVariantTestKeys.push({
741
+ expiresAt: Date.now() + localization.VARIANT_TEST_KEY_EXPIRATION,
742
+ selectedVariantKey: 'hosted',
743
+ testKey: 'hosted_vs_native',
744
+ });
745
+ localization.storageStoreSetEnabledVariantTestKeys(enabledVariantTestKeys);
746
+ }
747
+ else {
748
+ localization.storageStoreSetEnabledVariantTestKeys(enabledVariantTestKeys.map((x) => {
749
+ if (x.testKey === 'hosted_vs_native') {
750
+ return Object.assign(Object.assign({}, x), { selectedVariantKey: 'hosted' });
751
+ }
752
+ return x;
753
+ }));
754
+ }
755
+ }
756
+ // Remove query params from the url
757
+ url.searchParams.delete('zonosCheckoutSessionId');
758
+ url.searchParams.delete('zonosVariantTest');
759
+ window.history.replaceState({}, '', url.toString());
760
+ };
444
761
  this.appearanceSettingsOverride = undefined;
445
762
  this.preview = false;
446
763
  this.hiddenMode = false;
@@ -452,6 +769,7 @@ const ZonosCheckout = class {
452
769
  this.defaultCustomerProfileAddress = [];
453
770
  this.customerProfile = null;
454
771
  this.open = this.forceDialogOpen;
772
+ this.isOverlayLoading = false;
455
773
  this.stripe = window.Zonos.stripe;
456
774
  this.submitLoading = false;
457
775
  this.collapseReviewMobile = true;
@@ -552,11 +870,11 @@ const ZonosCheckout = class {
552
870
  await cart.cartStoreUpdateItems({ adjustments, cartItems });
553
871
  }
554
872
  else if (zonosStore.zonosStore.checkoutSettings.buildCartDetail &&
555
- cart.localizationStore.selectedCountryCode) {
873
+ localization.localizationStore.selectedCountryCode) {
556
874
  handleFetch.log('build cart detail');
557
875
  const cartItems = await zonosStore.zonosStore.checkoutSettings.buildCartDetail({
558
- countryCode: cart.localizationStore.selectedCountryCode,
559
- currencyCode: cart.localizationStore.targetCurrency,
876
+ countryCode: localization.localizationStore.selectedCountryCode,
877
+ currencyCode: localization.localizationStore.targetCurrency,
560
878
  });
561
879
  // Remove negative line items and move them to adjustments here, this is only for the deprecated `buildCartDetail` where negative line items are just treated as global discount amounts. It is up to the caller to create the right discount line items.
562
880
  const cartItemsFiltered = cartItems.filter(item => item.amount >= 0);
@@ -572,7 +890,7 @@ const ZonosCheckout = class {
572
890
  await cart.cartStoreUpdateItems({ adjustments, cartItems: cartItemsFiltered });
573
891
  }
574
892
  // if checkoutSessionId is not available, request a new one.
575
- if (!cart.cartStore.checkoutSessionId) {
893
+ if (!localization.storageStore.checkoutSessionId) {
576
894
  const success = await cart.stripeStoreInitCheckoutSession();
577
895
  handleFetch.log(`stripeStoreInitCheckoutSession: ${success}`);
578
896
  if (!success) {
@@ -618,13 +936,13 @@ const ZonosCheckout = class {
618
936
  confirmProceedWithOrderDuplication() {
619
937
  // Reset the placed order info
620
938
  this.placedOrderInfo = null;
621
- if (!cart.cartStore.checkoutSessionId) {
939
+ if (!localization.storageStore.checkoutSessionId) {
622
940
  return;
623
941
  }
624
942
  // Record the order duplication consent so we know user did see the notification and proceed with the order duplication
625
943
  void handleFetch.handleFetch('/api/zonos-elements/update-checkout-session-metadata', {
626
944
  body: {
627
- id: cart.cartStore.checkoutSessionId,
945
+ id: localization.storageStore.checkoutSessionId,
628
946
  metadata: [
629
947
  {
630
948
  key: 'orderDuplicationConsent',
@@ -689,7 +1007,7 @@ const ZonosCheckout = class {
689
1007
  button,
690
1008
  });
691
1009
  button.addEventListener('click', async (e) => {
692
- var _a;
1010
+ var _a, _b;
693
1011
  // Start tracking load time
694
1012
  const startTime = performance.now();
695
1013
  const isAlwaysTriggerInternationalCheckout = alwaysTriggerInternationalCheckoutSelector &&
@@ -732,6 +1050,17 @@ const ZonosCheckout = class {
732
1050
  void sendBulkLoadTimeApiLog();
733
1051
  }, 2000);
734
1052
  }
1053
+ // Send request to get what kind of variant we are applying
1054
+ if (isTestEnabled('hosted_vs_native')) {
1055
+ this.isOverlayLoading = true;
1056
+ await this.registerTestHostedVsNative();
1057
+ const { redirected } = await this.handleHostedVsNative();
1058
+ this.isOverlayLoading = false;
1059
+ // Stop the process if the user is being redirected to the hosted checkout page
1060
+ if (redirected) {
1061
+ return;
1062
+ }
1063
+ }
735
1064
  // start loading
736
1065
  cart.stripeStore.isFetchingSession = true;
737
1066
  this.open = true;
@@ -741,13 +1070,17 @@ const ZonosCheckout = class {
741
1070
  if (!result) {
742
1071
  throw new Error('Error building cart');
743
1072
  }
1073
+ (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage({
1074
+ checkoutSessionId: localization.storageStore.checkoutSessionId,
1075
+ type: 'zonos-checkout-session-update',
1076
+ }, '*');
744
1077
  // start the timer to validate the price
745
1078
  cart.cartStoreStartCheckoutInterval({
746
1079
  isPreview: this.preview,
747
1080
  sessionTimeout: CHECKOUT_SESSION_TIMEOUT,
748
1081
  });
749
1082
  paypal.submitGtag('zonos-checkout-start');
750
- const checkoutSessionId = cart.cartStore.checkoutSessionId;
1083
+ const checkoutSessionId = localization.storageStore.checkoutSessionId;
751
1084
  void cart.trackConversionEvent({
752
1085
  checkoutSessionId,
753
1086
  eventName: 'checkout_open',
@@ -770,13 +1103,13 @@ const ZonosCheckout = class {
770
1103
  const message = err.message;
771
1104
  if (message === 'Cart is expired.') {
772
1105
  this.isCartExpired = true;
773
- return;
774
1106
  }
775
1107
  }
776
1108
  // stop loading
777
1109
  cart.stripeStore.isFetchingSession = false;
778
1110
  handleFetch.logError(err);
779
1111
  if (this.isCartExpired) {
1112
+ cart.stripeStore.isFetchingSession = true;
780
1113
  return;
781
1114
  }
782
1115
  // We want to log the error anytime we fail to create a checkout session
@@ -788,15 +1121,15 @@ const ZonosCheckout = class {
788
1121
  cartId: window.Zonos.cartId,
789
1122
  checkoutSessionBody: cart.getCheckoutSessionBody(),
790
1123
  href: window.location.href,
791
- storeBaseUrl: ((_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl) ||
1124
+ storeBaseUrl: ((_b = window.Zonos.cartData) === null || _b === void 0 ? void 0 : _b.storeBaseUrl) ||
792
1125
  zonosStore.zonosStore.onlineStoreSettings.url,
793
1126
  },
794
1127
  });
795
1128
  cart.cartStoreUpdateToErrorState({
796
1129
  messages: [
797
- cart.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
1130
+ localization.translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists"),
798
1131
  ],
799
- title: cart.translate('Error creating Checkout'),
1132
+ title: localization.translate('Error creating Checkout'),
800
1133
  });
801
1134
  }
802
1135
  }, {
@@ -837,18 +1170,20 @@ const ZonosCheckout = class {
837
1170
  return;
838
1171
  }
839
1172
  handleFetch.log('shipping data from createCartId result', 'info', Object.entries(prefillAddress));
840
- const { customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, } = prefillAddress;
1173
+ const { customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerFirstName, customerLastName, customerName, customerPhone, customerState, customerZip, } = prefillAddress;
841
1174
  const urlParams = new URLSearchParams(window.location.search);
842
1175
  const country = // fallback to selected country code if country is not provided
843
1176
  customerCountry ||
844
- cart.getZCountryUrlParam(urlParams) ||
845
- cart.localizationStore.selectedCountryCode;
1177
+ localization.getZCountryUrlParam(urlParams) ||
1178
+ localization.localizationStore.selectedCountryCode;
846
1179
  this.applyPrefillAddress({
847
1180
  customerAddress1,
848
1181
  customerAddress2,
849
1182
  customerCity,
850
1183
  customerCountry: country,
851
1184
  customerEmail,
1185
+ customerFirstName,
1186
+ customerLastName,
852
1187
  customerName,
853
1188
  customerPhone,
854
1189
  customerState,
@@ -870,7 +1205,7 @@ const ZonosCheckout = class {
870
1205
  };
871
1206
  const customerCountry =
872
1207
  // fallback to selected country code if country is not provided
873
- cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode;
1208
+ localization.getZCountryUrlParam(urlParams) || localization.localizationStore.selectedCountryCode;
874
1209
  const customerCity = getParam('customerCity');
875
1210
  const customerEmail = getParam('customerEmail');
876
1211
  const customerAddress1 = getParam('customerAddress1');
@@ -897,7 +1232,9 @@ const ZonosCheckout = class {
897
1232
  const line2 = address.customerAddress2 || '';
898
1233
  const city = address.customerCity || '';
899
1234
  const email = address.customerEmail || '';
900
- const name = address.customerName || '';
1235
+ const name = address.customerFirstName && address.customerLastName
1236
+ ? `${address.customerFirstName} ${address.customerLastName}`
1237
+ : address.customerName || '';
901
1238
  const phone = address.customerPhone || '';
902
1239
  const postal_code = address.customerZip || '';
903
1240
  const state = address.customerState || '';
@@ -917,8 +1254,8 @@ const ZonosCheckout = class {
917
1254
  return;
918
1255
  }
919
1256
  if (country &&
920
- cart.localizationStore.shippingZoneCountries &&
921
- !(country in cart.localizationStore.shippingZoneCountries)) {
1257
+ localization.localizationStore.shippingZoneCountries &&
1258
+ !(country in localization.localizationStore.shippingZoneCountries)) {
922
1259
  handleFetch.log(`Country "${country}" is not in the shipping zone, so it can not be prefilled`, 'warn');
923
1260
  return;
924
1261
  }
@@ -1048,7 +1385,7 @@ const ZonosCheckout = class {
1048
1385
  async handleCustomerInfoContinue() {
1049
1386
  // submit google tag when the form is complete
1050
1387
  paypal.submitGtag('zonos-checkout-customer-info');
1051
- const checkoutSessionId = cart.cartStore.checkoutSessionId;
1388
+ const checkoutSessionId = localization.storageStore.checkoutSessionId;
1052
1389
  void cart.trackConversionEvent({
1053
1390
  checkoutSessionId,
1054
1391
  eventName: 'checkout_customerInfoCompleted',
@@ -1134,7 +1471,7 @@ const ZonosCheckout = class {
1134
1471
  // Should not proceed to confirm payment if base currency update failed
1135
1472
  if (!baseCurrencyUpdateSuccess) {
1136
1473
  cart.stripeStore.hasPaymentError = true;
1137
- cart.stripeStore.customErrorMessage = cart.translate('Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.', {
1474
+ cart.stripeStore.customErrorMessage = localization.translate('Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.', {
1138
1475
  currency: cart.stripeStore.checkoutSettlementCurrency,
1139
1476
  });
1140
1477
  this.submitLoading = false;
@@ -1147,7 +1484,7 @@ const ZonosCheckout = class {
1147
1484
  }
1148
1485
  catch (_a) {
1149
1486
  // If user provide callback and it throw an exception, default to this message and stop the payment.
1150
- cart.cartStore.inventoryCheckErrorMessage = cart.translate('Unable to check inventory. Please try again.');
1487
+ cart.cartStore.inventoryCheckErrorMessage = localization.translate('Unable to check inventory. Please try again.');
1151
1488
  }
1152
1489
  // Don't proceed to payment if there's an error message
1153
1490
  if (cart.cartStore.inventoryCheckErrorMessage) {
@@ -1318,13 +1655,20 @@ const ZonosCheckout = class {
1318
1655
  this.isMobile = handleFetch.isCheckoutMobile(this.mobile);
1319
1656
  this.isIframed = window.self !== window.top;
1320
1657
  handleFetch.log(`iframed: ${this.isIframed}`);
1658
+ // Set checkout session if redirect
1659
+ if (window.Zonos.isLegacyCheckout) {
1660
+ this.captureParamsRedirectedForVariantTest();
1661
+ }
1321
1662
  // update theme to browser preference theme if appearance theme is system
1322
1663
  this.handleAppearanceSettingsOverrideChange();
1323
1664
  // listen to selected locale code change
1324
- this.onChangeLocaleListener = cart.localizationStoreOnUpdate('selectedLocale', () => {
1665
+ this.onChangeLocaleListener = localization.localizationStoreOnChange('selectedLocale', () => {
1325
1666
  // Update stripe locale when selected country code is changed
1326
1667
  void this.applyStripeTheme();
1327
1668
  });
1669
+ // Initialize test keys
1670
+ this.initializeTestKeys();
1671
+ window.addEventListener('message', this.handleHostedOpenWindowCallback);
1328
1672
  handleFetch.log(`mobile: ${this.isMobile}`);
1329
1673
  }
1330
1674
  // do clean up when component is unmounted
@@ -1335,6 +1679,7 @@ const ZonosCheckout = class {
1335
1679
  cart.cartStoreReset();
1336
1680
  // cleanup onChange listener
1337
1681
  this.onChangeLocaleListener();
1682
+ window.removeEventListener('message', this.handleHostedOpenWindowCallback);
1338
1683
  }
1339
1684
  render() {
1340
1685
  var _a, _b, _c, _d;
@@ -1363,7 +1708,7 @@ const ZonosCheckout = class {
1363
1708
  : themePrimaryColorBased;
1364
1709
  // only use submit button color if it's on desktop
1365
1710
  const submitButtonColor = !this.isMobile ? colorSecondary : undefined;
1366
- const { customMessages } = cart.localizationStore;
1711
+ const { customMessages } = localization.localizationStore;
1367
1712
  const defaultMessage = (_a = customMessages.find(x => x.pageName === 'checkout_default')) === null || _a === void 0 ? void 0 : _a.message;
1368
1713
  const localePageEnum = this.getCurrentLocalePageEnum();
1369
1714
  const filteredMessages = customMessages.filter(x => x.pageName === localePageEnum);
@@ -1383,13 +1728,13 @@ const ZonosCheckout = class {
1383
1728
  const zonosDebug = urlParams.get('zonosDebug');
1384
1729
  const zonosE2ETest = urlParams.get('zonosE2ETest');
1385
1730
  const zonosStagingMode = this.overrideStagingMode || handleFetch.getIsStagingMode();
1386
- return (index.h("zonos-v-stack", null, index.h("div", { class: "zonos--logo-wrapper" }, renderLogo(), isTestMode && (index.h("zonos-badge", { badgeColor: "orange", size: "small" }, cart.translate('Test mode'))), zonosStagingMode && (index.h("zonos-badge", { badgeColor: "red", size: "small" }, cart.translate('Staging mode'))), zonosDebug === '1' && (index.h("zonos-badge", { badgeColor: "cyan", size: "small" }, "debug")), zonosQaUrl && (index.h("zonos-badge", { badgeColor: "purple", size: "small" }, zonosQaUrl)), zonosE2ETest && (index.h("zonos-badge", { badgeColor: "gray", size: "small" }, "E2E Test"))), index.h("zonos-checkout-progress-tabs", { backgroundColor:
1731
+ return (index.h("zonos-v-stack", null, index.h("div", { class: "zonos--logo-wrapper" }, renderLogo(), isTestMode && (index.h("zonos-badge", { badgeColor: "orange", size: "small" }, localization.translate('Test mode'))), zonosStagingMode && (index.h("zonos-badge", { badgeColor: "red", size: "small" }, localization.translate('Staging mode'))), zonosDebug === '1' && (index.h("zonos-badge", { badgeColor: "cyan", size: "small" }, "debug")), zonosQaUrl && (index.h("zonos-badge", { badgeColor: "purple", size: "small" }, zonosQaUrl)), zonosE2ETest && (index.h("zonos-badge", { badgeColor: "gray", size: "small" }, "E2E Test"))), index.h("zonos-checkout-progress-tabs", { backgroundColor:
1387
1732
  // only use different contrast color when the secondary color is too off with the background in mobile
1388
1733
  this.isMobile ? '--zonos-elements-gray-0' : null }), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))));
1389
1734
  };
1390
1735
  const renderContent = () => {
1391
1736
  if (cart.cartStore.checkoutSessionTimeoutShow) {
1392
- return (index.h("zonos-rest-state", { class: "zonos--session-timeout", restStateSubtitle: cart.translate('Your checkout session has expired. Please reload the page to continue.'), restStateTitle: cart.translate('Session timed out'), restStateType: 'Warning' }, index.h("zonos-button", { onClick: () => this.reloadCheckoutSession(), variant: "primary" }, cart.translate('Reload'))));
1737
+ return (index.h("zonos-rest-state", { class: "zonos--session-timeout", restStateSubtitle: localization.translate('Your checkout session has expired. Please reload the page to continue.'), restStateTitle: localization.translate('Session timed out'), restStateType: 'Warning' }, index.h("zonos-button", { onClick: () => this.reloadCheckoutSession(), variant: "primary" }, localization.translate('Reload'))));
1393
1738
  }
1394
1739
  return (index.h("div", { class: 'zonos--content', style: {
1395
1740
  '--zonos--border-radius': getBorderRadius.getBorderRadius({
@@ -1426,52 +1771,52 @@ const ZonosCheckout = class {
1426
1771
  this.isMobile && 'mobile',
1427
1772
  this.isIframed && 'iframed',
1428
1773
  this.hiddenMode && 'hidden-mode',
1429
- ]) }, this.preview ? (renderContent()) : (index.h("zonos-dialog", { borderStyle: style, "data-theme": rightSideTheme, height: "980px", isLoading: dialogLoading, mobile: this.isMobile, noBodyPadding: true, noBorder: true, noClickOutside: true, noCloseButton: true, onCloseDialog: () => this.closeDialogHandler(), open: this.open, width: "1200px" }, renderContent())), index.h("zonos-confirm-dialog", { class: "zonos--close-confirm-dialog", dialogCancelBtnText: cart.translate("Don't close"), dialogConfirmBtnText: cart.translate('Close'), dialogIntent: "warn", dialogOpen: this.confirmDialogOpen, dialogSubtitle: cart.translate('Would you like to close checkout and return to the site?'), dialogTitle: cart.translate('Are you sure?'), onCancelClicked: () => {
1774
+ ]) }, this.preview ? (renderContent()) : (index.h("zonos-dialog", { borderStyle: style, "data-theme": rightSideTheme, height: "980px", isLoading: dialogLoading, mobile: this.isMobile, noBodyPadding: true, noBorder: true, noClickOutside: true, noCloseButton: true, onCloseDialog: () => this.closeDialogHandler(), open: this.open, width: "1200px" }, renderContent())), index.h("zonos-confirm-dialog", { class: "zonos--close-confirm-dialog", dialogCancelBtnText: localization.translate("Don't close"), dialogConfirmBtnText: localization.translate('Close'), dialogIntent: "warn", dialogOpen: this.confirmDialogOpen, dialogSubtitle: localization.translate('Would you like to close checkout and return to the site?'), dialogTitle: localization.translate('Are you sure?'), onCancelClicked: () => {
1430
1775
  this.confirmDialogOpen = false;
1431
1776
  },
1432
1777
  // Mark user selected confirm to close the dialog
1433
- onConfirmClicked: () => this.closeDialogHandler({ confirmed: true }) }), index.h("zonos-confirm-dialog", { class: "zonos--order-duplication-dialog", dialogCancelBtnText: cart.translate('Return to merchant site'), dialogConfirmBtnText: cart.translate('Proceed with order'), dialogIntent: "warn", dialogOpen: !!this.placedOrderInfo, dialogSubtitle:
1778
+ onConfirmClicked: () => this.closeDialogHandler({ confirmed: true }) }), index.h("zonos-confirm-dialog", { class: "zonos--order-duplication-dialog", dialogCancelBtnText: localization.translate('Return to merchant site'), dialogConfirmBtnText: localization.translate('Proceed with order'), dialogIntent: "warn", dialogOpen: !!this.placedOrderInfo, dialogSubtitle:
1434
1779
  /**
1435
1780
  * Show order number if it's available, otherwise just show the time
1436
1781
  */
1437
1782
  ((_b = this.placedOrderInfo) === null || _b === void 0 ? void 0 : _b.zonosOrderNumber)
1438
- ? cart.translate('It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?', {
1783
+ ? localization.translate('It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?', {
1439
1784
  date: this.formatDate(this.placedOrderInfo.time),
1440
1785
  orderNumber: this.placedOrderInfo.zonosOrderNumber,
1441
1786
  time: this.formatTime(this.placedOrderInfo.time),
1442
1787
  })
1443
- : cart.translate('It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?', {
1788
+ : localization.translate('It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?', {
1444
1789
  date: this.formatDate(((_c = this.placedOrderInfo) === null || _c === void 0 ? void 0 : _c.time) || null),
1445
1790
  time: this.formatTime(((_d = this.placedOrderInfo) === null || _d === void 0 ? void 0 : _d.time) || null),
1446
- }), dialogTitle: cart.translate('Are you sure?'), dialogWidth: 530, onCancelClicked: () => {
1791
+ }), dialogTitle: localization.translate('Are you sure?'), dialogWidth: 530, onCancelClicked: () => {
1447
1792
  this.handleCancelOrderDuplication();
1448
1793
  },
1449
1794
  // Mark user selected confirm to close the dialog
1450
1795
  onConfirmClicked: () => {
1451
1796
  // Reset the placed order info and close the dialog
1452
1797
  this.confirmProceedWithOrderDuplication();
1453
- } }), index.h("zonos-confirm-dialog", { class: "zonos--inventory-check-failure-dialog", dialogConfirmBtnText: cart.translate('Return to cart'), dialogIntent: "danger",
1798
+ } }), index.h("zonos-confirm-dialog", { class: "zonos--inventory-check-failure-dialog", dialogConfirmBtnText: localization.translate('Return to cart'), dialogIntent: "danger",
1454
1799
  // Show dialog if inventory check error message is not null
1455
1800
  dialogOpen: !!cart.cartStore.inventoryCheckErrorMessage,
1456
1801
  // If dialog is in open state, the message should not be null
1457
- dialogSubtitle: cart.cartStore.inventoryCheckErrorMessage, dialogTitle: cart.translate("Couldn't place order"), dialogType: "alert",
1802
+ dialogSubtitle: cart.cartStore.inventoryCheckErrorMessage, dialogTitle: localization.translate("Couldn't place order"), dialogType: "alert",
1458
1803
  // Mark user selected confirm to close the dialog
1459
- onConfirmClicked: () => this.handleInventoryCheckDialogConfirm() }), baseCurrencySettlementInfo && (index.h("zonos-confirm-dialog", { class: "zonos--pay-in-usd-dialog", dialogCancelBtnText: cart.translate('Cancel'), dialogConfirmBtnText: cart.translate('Pay [orderTotal]', {
1460
- orderTotal: cart.currencyFormat({
1804
+ onConfirmClicked: () => this.handleInventoryCheckDialogConfirm() }), baseCurrencySettlementInfo && (index.h("zonos-confirm-dialog", { class: "zonos--pay-in-usd-dialog", dialogCancelBtnText: localization.translate('Cancel'), dialogConfirmBtnText: localization.translate('Pay [orderTotal]', {
1805
+ orderTotal: localization.currencyFormat({
1461
1806
  amount: baseCurrencySettlementInfo.settlementAmount,
1462
1807
  currency: 'USD',
1463
1808
  }),
1464
- }), dialogIntent: "warn", dialogOpen: this.payInUsdConfirmDialogOpen, dialogSubtitle: cart.translate('By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level.'), dialogTitle: cart.translate('Pay in USD (United States Dollar)?'), dialogType: "confirm", dialogWidth: 480, onCancelClicked: () => {
1809
+ }), dialogIntent: "warn", dialogOpen: this.payInUsdConfirmDialogOpen, dialogSubtitle: localization.translate('By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level.'), dialogTitle: localization.translate('Pay in USD (United States Dollar)?'), dialogType: "confirm", dialogWidth: 480, onCancelClicked: () => {
1465
1810
  this.payInUsdConfirmDialogOpen = false;
1466
1811
  },
1467
1812
  // Mark user selected confirm to continue with payment
1468
- onConfirmClicked: () => this.handleStripePaymentContinue() })), index.h("zonos-confirm-dialog", { class: "zonos--shopping-cart-expired-dialog", dialogConfirmBtnText: cart.translate('OK'), dialogIntent: "danger",
1813
+ onConfirmClicked: () => this.handleStripePaymentContinue() })), index.h("zonos-confirm-dialog", { class: "zonos--shopping-cart-expired-dialog", dialogConfirmBtnText: localization.translate('OK'), dialogIntent: "danger",
1469
1814
  // Show dialog if inventory check error message is not null
1470
1815
  dialogOpen: this.isCartExpired,
1471
1816
  // If dialog is in open state, the message should not be null
1472
- dialogSubtitle: cart.translate('You are being sent back to the shop to re-add items to your cart.'), dialogTitle: cart.translate('Shopping cart expired'), dialogType: "alert",
1817
+ dialogSubtitle: localization.translate('You are being sent back to the shop to re-add items to your cart.'), dialogTitle: localization.translate('Shopping cart expired'), dialogType: "alert",
1473
1818
  // Mark user selected confirm to close the dialog
1474
- onConfirmClicked: () => this.handleCartExpiredDialogConfirm() })));
1819
+ onConfirmClicked: () => this.handleCartExpiredDialogConfirm() }), index.h("zonos-loading-overlay", { open: this.isOverlayLoading })));
1475
1820
  }
1476
1821
  static get assetsDirs() { return ["assets"]; }
1477
1822
  static get watchers() { return {