@zonos/elements 1.3.200 → 1.3.202

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-637ba3d0.js +1943 -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-add8fe50.js → localization-2f17c95f.js} +74 -1926
  9. package/dist/cjs/{paypal-afc19dec.js → paypal-0eceff03.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} +99 -80
  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 +2 -1
  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 +15 -16
  59. package/dist/collection/components/store/checkout/paypal.js +2 -1
  60. package/dist/collection/components/store/checkout/stripe.js +33 -13
  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 +12 -0
  85. package/dist/collection/types/index.js +1 -0
  86. package/dist/esm/VarianceTest-fef2d958.js +10 -0
  87. package/dist/esm/cart-b7c15b61.js +1907 -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-e03d615e.js → localization-bf7224aa.js} +70 -1892
  94. package/dist/esm/{paypal-23dd5023.js → paypal-932fd3dd.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} +48 -30
  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-b7c15b61.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-23dd5023.js → paypal-932fd3dd.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 +839 -765
  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 +0 -1
  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 +163 -0
  186. package/dist/types/types/generated/graphql.internal.types.ts +199 -0
  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-0f77d087.system.entry.js +1 -0
  194. package/dist/zonos-elements/{p-329efa8c.system.entry.js → p-1dcdb65f.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-26a634a5.system.entry.js +1 -0
  196. package/dist/zonos-elements/p-27987298.system.entry.js +1 -0
  197. package/dist/zonos-elements/p-2af2eb6f.system.entry.js +1 -0
  198. package/dist/zonos-elements/p-2b8f787a.entry.js +1 -0
  199. package/dist/zonos-elements/p-30cfa524.entry.js +1 -0
  200. package/dist/zonos-elements/p-32320d9a.system.js +1 -0
  201. package/dist/zonos-elements/p-3284f459.system.entry.js +1 -0
  202. package/dist/zonos-elements/{p-13796f98.js → p-3d82a352.js} +1 -1
  203. package/dist/zonos-elements/p-452070af.system.entry.js +1 -0
  204. package/dist/zonos-elements/p-45ebc788.entry.js +1 -0
  205. package/dist/zonos-elements/p-4c81112f.entry.js +1 -0
  206. package/dist/zonos-elements/p-4efa8187.js +1 -0
  207. package/dist/zonos-elements/p-5170bc41.entry.js +1 -0
  208. package/dist/zonos-elements/p-5a2dd041.system.js +1 -0
  209. package/dist/zonos-elements/p-5c74e5c9.system.entry.js +1 -0
  210. package/dist/zonos-elements/p-5d0f7364.system.js +1 -0
  211. package/dist/zonos-elements/p-6a52a2bc.system.entry.js +1 -0
  212. package/dist/zonos-elements/p-715d0f59.system.entry.js +1 -0
  213. package/dist/zonos-elements/{p-b8d87932.js → p-72f37935.js} +1 -1
  214. package/dist/zonos-elements/p-7ae5cd60.entry.js +1 -0
  215. package/dist/zonos-elements/p-80bbd9c0.system.entry.js +1 -0
  216. package/dist/zonos-elements/p-851c642e.system.entry.js +1 -0
  217. package/dist/zonos-elements/{p-623a30aa.entry.js → p-8d870d4c.entry.js} +1 -1
  218. package/dist/zonos-elements/p-98b65387.entry.js +1 -0
  219. package/dist/zonos-elements/p-9af5e93a.entry.js +1 -0
  220. package/dist/zonos-elements/p-aa1193bc.entry.js +1 -0
  221. package/dist/zonos-elements/{p-8fc08673.js → p-aae60057.js} +2 -2
  222. package/dist/zonos-elements/p-ab176281.system.entry.js +1 -0
  223. package/dist/zonos-elements/p-b52aba52.entry.js +1 -0
  224. package/dist/zonos-elements/p-bc220d35.system.js +1 -0
  225. package/dist/zonos-elements/p-bc8bda92.entry.js +1 -0
  226. package/dist/zonos-elements/p-be5afc91.system.entry.js +1 -0
  227. package/dist/zonos-elements/p-bec2a3ce.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-c58acd4c.system.entry.js +1 -0
  232. package/dist/zonos-elements/p-c5fcbc92.system.entry.js +1 -0
  233. package/dist/zonos-elements/p-c767242b.entry.js +1 -0
  234. package/dist/zonos-elements/p-c9aa902e.system.entry.js +1 -0
  235. package/dist/zonos-elements/p-cb823c4d.system.js +1 -0
  236. package/dist/zonos-elements/{p-24554580.system.js → p-d2466fbd.system.js} +2 -2
  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-d60ca44b.system.entry.js +1 -0
  240. package/dist/zonos-elements/{p-b2241919.entry.js → p-d6a10007.entry.js} +1 -1
  241. package/dist/zonos-elements/p-db025dfc.system.entry.js +1 -0
  242. package/dist/zonos-elements/p-db3968a2.js +1 -0
  243. package/dist/zonos-elements/p-dcd6acd4.system.entry.js +1 -0
  244. package/dist/zonos-elements/p-dd1cfa74.entry.js +1 -0
  245. package/dist/zonos-elements/p-df4c46a6.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-e03d615e.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-06ed3582.system.js +0 -1
  262. package/dist/zonos-elements/p-0a2101d4.system.js +0 -1
  263. package/dist/zonos-elements/p-0aa20875.system.entry.js +0 -1
  264. package/dist/zonos-elements/p-0bfd23da.entry.js +0 -1
  265. package/dist/zonos-elements/p-0f3568a7.entry.js +0 -1
  266. package/dist/zonos-elements/p-147ca395.entry.js +0 -1
  267. package/dist/zonos-elements/p-190398dd.entry.js +0 -1
  268. package/dist/zonos-elements/p-1eddec23.entry.js +0 -1
  269. package/dist/zonos-elements/p-1f2c3f5c.system.entry.js +0 -1
  270. package/dist/zonos-elements/p-24a2e899.system.entry.js +0 -1
  271. package/dist/zonos-elements/p-2882b9f4.entry.js +0 -1
  272. package/dist/zonos-elements/p-28ba5a6b.system.entry.js +0 -1
  273. package/dist/zonos-elements/p-33488109.system.entry.js +0 -1
  274. package/dist/zonos-elements/p-337fab4e.js +0 -1
  275. package/dist/zonos-elements/p-35573f66.entry.js +0 -1
  276. package/dist/zonos-elements/p-394d468f.system.js +0 -1
  277. package/dist/zonos-elements/p-3ddecaa4.system.entry.js +0 -1
  278. package/dist/zonos-elements/p-48f70043.system.entry.js +0 -1
  279. package/dist/zonos-elements/p-55711b80.system.entry.js +0 -1
  280. package/dist/zonos-elements/p-578bf5d7.entry.js +0 -1
  281. package/dist/zonos-elements/p-5b8e5d1a.entry.js +0 -1
  282. package/dist/zonos-elements/p-5c061a35.entry.js +0 -1
  283. package/dist/zonos-elements/p-6096c1c5.entry.js +0 -1
  284. package/dist/zonos-elements/p-6adc6e27.entry.js +0 -1
  285. package/dist/zonos-elements/p-7bb9c330.entry.js +0 -1
  286. package/dist/zonos-elements/p-7c6b8d3f.entry.js +0 -1
  287. package/dist/zonos-elements/p-85270076.system.entry.js +0 -1
  288. package/dist/zonos-elements/p-8a9d4605.system.entry.js +0 -1
  289. package/dist/zonos-elements/p-94e3e50d.system.entry.js +0 -1
  290. package/dist/zonos-elements/p-9f272e8e.system.entry.js +0 -1
  291. package/dist/zonos-elements/p-9f6dd86a.entry.js +0 -1
  292. package/dist/zonos-elements/p-a64ab131.system.entry.js +0 -1
  293. package/dist/zonos-elements/p-aac95779.system.entry.js +0 -1
  294. package/dist/zonos-elements/p-ad3c5358.entry.js +0 -1
  295. package/dist/zonos-elements/p-ad8a0584.entry.js +0 -1
  296. package/dist/zonos-elements/p-aeaba33e.system.entry.js +0 -1
  297. package/dist/zonos-elements/p-af6af82e.system.js +0 -1
  298. package/dist/zonos-elements/p-b2e76636.system.entry.js +0 -1
  299. package/dist/zonos-elements/p-b6afcf3f.system.entry.js +0 -1
  300. package/dist/zonos-elements/p-b8d91f99.entry.js +0 -1
  301. package/dist/zonos-elements/p-be8fa9a5.system.entry.js +0 -1
  302. package/dist/zonos-elements/p-c770044a.system.entry.js +0 -1
  303. package/dist/zonos-elements/p-d4842d10.system.entry.js +0 -1
  304. package/dist/zonos-elements/p-e390725f.js +0 -1
  305. package/dist/zonos-elements/p-eb85f0b6.system.entry.js +0 -1
  306. package/dist/zonos-elements/p-ef3d0394.entry.js +0 -1
  307. package/dist/zonos-elements/p-f6e587bb.entry.js +0 -1
  308. package/dist/zonos-elements/p-ff23980c.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { createStore } from "@stencil/store";
2
- import { cartStore } from "../checkout/cart";
2
+ import { storageStore } from "../storageStore";
3
3
  import { translationStoreUpdateLanguage } from "../translationStore";
4
4
  import { zonosStore } from "../zonosStore";
5
5
  import { getCountries } from "../../utils/api/getCountries";
@@ -15,7 +15,7 @@ import { getCurrencyCode } from "../../utils/hello/currencyConversion/getCurrenc
15
15
  import { setZCountryUrlParam } from "../../utils/hello/setZCountryUrlParam";
16
16
  import { log } from "../../utils/logging/log";
17
17
  import { logError } from "../../utils/logging/logError";
18
- const { dispose: localizationDispose, onChange: localizationStoreOnUpdate, state: localizationStore, } = createStore({
18
+ const { dispose: localizationDispose, onChange: localizationStoreOnChange, state: localizationStore, } = createStore({
19
19
  countryLandedCost: null,
20
20
  customMessages: [],
21
21
  exchangeRate: null,
@@ -196,12 +196,12 @@ const initHelloCountryList = (allCountries) => {
196
196
  }, {});
197
197
  };
198
198
  const updateCheckoutSessionLanguage = async () => {
199
- if (!cartStore.checkoutSessionId) {
199
+ if (!storageStore.checkoutSessionId) {
200
200
  return null;
201
201
  }
202
202
  const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session-metadata', {
203
203
  body: {
204
- id: cartStore.checkoutSessionId,
204
+ id: storageStore.checkoutSessionId,
205
205
  metadata: [
206
206
  {
207
207
  key: 'language',
@@ -257,4 +257,4 @@ const initLocalizationStore = async () => {
257
257
  }
258
258
  localizationStore.localizationLoaded = true;
259
259
  };
260
- export { initLocalizationStore, localizationDispose, localizationStore, localizationStoreOnUpdate, localizationStoreUpdateSelectedCountryCode, localizationStoreUpdateSelectedLocale, };
260
+ export { initLocalizationStore, localizationDispose, localizationStore, localizationStoreOnChange, localizationStoreUpdateSelectedCountryCode, localizationStoreUpdateSelectedLocale, };
@@ -0,0 +1,32 @@
1
+ import { createStore } from "@stencil/store";
2
+ import { jsonParse } from "../utils/jsonParse";
3
+ import { filterValidTests } from "../utils/varianceTest/filterValidTests";
4
+ /**
5
+ * Expiration time for variant test keys in milliseconds
6
+ * @default 1 day
7
+ */
8
+ export const VARIANT_TEST_KEY_EXPIRATION = 60 * 60 * 24 * 1000;
9
+ const { onChange: storageStoreOnChange, state: storageStore } = createStore({
10
+ checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id'),
11
+ enabledVariantTestKeys: jsonParse(localStorage.getItem('zonos--enabled-variant-test-keys')),
12
+ });
13
+ storageStoreOnChange('enabledVariantTestKeys', () => {
14
+ var _a;
15
+ // This should be set in localStorage so we don't have multiple tests for the same user in short period of time
16
+ if (!((_a = storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.length)) {
17
+ localStorage.removeItem('zonos--enabled-variant-test-keys');
18
+ return;
19
+ }
20
+ localStorage.setItem('zonos--enabled-variant-test-keys', JSON.stringify(storageStore.enabledVariantTestKeys));
21
+ });
22
+ storageStoreOnChange('checkoutSessionId', () => {
23
+ if (!storageStore.checkoutSessionId) {
24
+ sessionStorage.removeItem('zonos--checkout-session-id');
25
+ return;
26
+ }
27
+ sessionStorage.setItem('zonos--checkout-session-id', storageStore.checkoutSessionId);
28
+ });
29
+ const storageStoreSetEnabledVariantTestKeys = (testKeys) => {
30
+ storageStore.enabledVariantTestKeys = filterValidTests(testKeys);
31
+ };
32
+ export { storageStore, storageStoreOnChange, storageStoreSetEnabledVariantTestKeys, };
@@ -1,6 +1,7 @@
1
1
  import { createStore } from "@stencil/store";
2
2
  import { mergeConfig } from "../utils/mergeConfig";
3
- const { dispose: zonosStoreDispose, reset, state: zonosStore, } = createStore(() => ({
3
+ import { isInAvailableTestKey } from "../utils/varianceTest/isInAvailableTestKey";
4
+ const { dispose: zonosStoreDispose, onChange: zonosStoreOnChange, reset, state: zonosStore, } = createStore(() => ({
4
5
  appearance: {
5
6
  colorPrimary: 'white',
6
7
  fontFamily: 'Inter',
@@ -51,6 +52,7 @@ const { dispose: zonosStoreDispose, reset, state: zonosStore, } = createStore(()
51
52
  },
52
53
  currentHelloPage: '',
53
54
  disabledCountries: [],
55
+ enabledVariantTestKeys: [],
54
56
  helloSettings: {
55
57
  anchorElementSelector: '',
56
58
  cartUrlPattern: '',
@@ -111,7 +113,7 @@ const getZonosStoreTheme = (theme) => {
111
113
  * Init setting from zonos setting
112
114
  */
113
115
  const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
114
- var _a, _b, _c, _d, _e;
116
+ var _a, _b, _c, _d, _e, _f, _g;
115
117
  reset();
116
118
  if (zonosSettings) {
117
119
  // save zonos settings to be used later
@@ -138,9 +140,13 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
138
140
  null);
139
141
  // set flag to true to indicate that config is ready
140
142
  zonosStore.loadedConfig = true;
141
- zonosStore.organizationId = ((_b = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _b === void 0 ? void 0 : _b.id) || '';
142
- zonosStore.organizationName = ((_c = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _c === void 0 ? void 0 : _c.name) || '';
143
- zonosStore.storeId = ((_e = (_d = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _d === void 0 ? void 0 : _d.references) === null || _e === void 0 ? void 0 : _e.storeId) || null;
143
+ // initialize variant test keys
144
+ zonosStore.enabledVariantTestKeys =
145
+ // Only map and filter the test keys that the current code supports
146
+ ((_c = (_b = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.checkoutSettings) === null || _b === void 0 ? void 0 : _b.varianceTestRegistrations) === null || _c === void 0 ? void 0 : _c.flatMap(({ testKey }) => (isInAvailableTestKey(testKey) ? testKey : []))) || [];
147
+ zonosStore.organizationId = ((_d = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _d === void 0 ? void 0 : _d.id) || '';
148
+ zonosStore.organizationName = ((_e = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _e === void 0 ? void 0 : _e.name) || '';
149
+ zonosStore.storeId = ((_g = (_f = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _f === void 0 ? void 0 : _f.references) === null || _g === void 0 ? void 0 : _g.storeId) || null;
144
150
  zonosStore.currencyConverter = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.currencyConverter;
145
151
  zonosStore.onCountryChange = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.onCountryChange;
146
152
  zonosStore.overrideCurrencyFormat = overrideSettings === null || overrideSettings === void 0 ? void 0 : overrideSettings.overrideCurrencyFormat;
@@ -152,4 +158,4 @@ const zonosStoreFontFamily = () => {
152
158
  const fontFamily = zonosStore.appearance.fontFamily || 'Inter';
153
159
  return fontFamily;
154
160
  };
155
- export { getZonosStoreTheme, zonosStore, zonosStoreDispose, zonosStoreFontFamily, zonosStoreInitSetting, };
161
+ export { getZonosStoreTheme, zonosStore, zonosStoreDispose, zonosStoreFontFamily, zonosStoreInitSetting, zonosStoreOnChange, };
@@ -1,7 +1,7 @@
1
1
  import { h, Host, } from "@stencil/core";
2
- import { cartStore } from "../../store/checkout/cart";
3
2
  import { stripeStore } from "../../store/checkout/stripe";
4
3
  import { getFallbackDefaultCountryCode, localizationStore, } from "../../store/hello/localization";
4
+ import { storageStore, storageStoreOnChange, } from "../../store/storageStore";
5
5
  import { translate } from "../../store/translationStore";
6
6
  import { zonosStore } from "../../store/zonosStore";
7
7
  import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
@@ -15,6 +15,7 @@ import { countryRequireTaxId, shipToTaxIdLabels, } from "../../../types/checkout
15
15
  */
16
16
  export class ZonosAddress {
17
17
  constructor() {
18
+ this.onStoreCheckoutSessionIdChangedSubscription = () => { };
18
19
  /**
19
20
  * Google autocomplete overlay is conflict with our button, this is to adjust z index of the autocomplete
20
21
  */
@@ -23,6 +24,14 @@ export class ZonosAddress {
23
24
  * Check if the tracking event is sent
24
25
  */
25
26
  this.trackingSent = false;
27
+ this.onStoreCheckoutSessionIdChanged = () => {
28
+ const onCheckoutSessionIdChange = () => {
29
+ this.checkoutSessionId = storageStore.checkoutSessionId;
30
+ };
31
+ // Trigger it once on init because onChange doesn't get triggered on initial load
32
+ onCheckoutSessionIdChange();
33
+ this.onStoreCheckoutSessionIdChangedSubscription = storageStoreOnChange('checkoutSessionId', onCheckoutSessionIdChange);
34
+ };
26
35
  this.type = undefined;
27
36
  this.titleText = undefined;
28
37
  this.defaultAddress = [];
@@ -30,7 +39,7 @@ export class ZonosAddress {
30
39
  this.stripe = window.Zonos.stripe;
31
40
  this.isDirtyAddress = false;
32
41
  this.isAddressFilled = false;
33
- this.checkoutSessionId = cartStore.checkoutSessionId;
42
+ this.checkoutSessionId = storageStore.checkoutSessionId;
34
43
  }
35
44
  getStripeAddressInstance() {
36
45
  if (this.type === 'billing') {
@@ -59,7 +68,7 @@ export class ZonosAddress {
59
68
  }
60
69
  isAddressFilledChanged() {
61
70
  // 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
62
- if (!cartStore.checkoutSessionId) {
71
+ if (!storageStore.checkoutSessionId) {
63
72
  return;
64
73
  }
65
74
  // Only need to track the event if the shipping address is filled
@@ -67,7 +76,7 @@ export class ZonosAddress {
67
76
  !this.trackingSent &&
68
77
  this.type === 'shipping') {
69
78
  this.trackingSent = true;
70
- const checkoutSessionId = cartStore.checkoutSessionId;
79
+ const checkoutSessionId = storageStore.checkoutSessionId;
71
80
  void trackConversionEvent({
72
81
  checkoutSessionId,
73
82
  eventName: 'checkout_customerInfoFilled',
@@ -239,6 +248,8 @@ export class ZonosAddress {
239
248
  // destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
240
249
  const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
241
250
  stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
251
+ // cleanup checkout session id subscription
252
+ this.onStoreCheckoutSessionIdChangedSubscription();
242
253
  }
243
254
  componentDidLoad() {
244
255
  const stripeAddressEventData = this.getStripeAddressInstance().stripeAddressEventData;
@@ -247,15 +258,16 @@ export class ZonosAddress {
247
258
  stripeAddressEventData.value.address.line1.length > 0;
248
259
  // @Watch doesn't get trigger on initial load
249
260
  void this.watchInitStripe();
261
+ this.onStoreCheckoutSessionIdChanged();
250
262
  }
251
263
  render() {
252
264
  var _a;
253
- this.checkoutSessionId = cartStore.checkoutSessionId;
265
+ this.checkoutSessionId = storageStore.checkoutSessionId;
254
266
  if ((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
255
267
  this.isAddressFilled = true;
256
268
  }
257
269
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
258
- return (h(Host, { key: 'ebd6b34dfcb486e1746fbc306e2e413d03290d50', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '68e7f0fa37ca7efd4d833b32d4c27cda29521871', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '5e6d4b3798c91def3f3a6ae5ac12f1a2ccca272b', class: "zonos--address-component" })));
270
+ return (h(Host, { key: '6cb58defa44e55a88bdb8ad3b1b2e96033337fec', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '2708affaeb700f6c256b38285696d3eaffa1d1ea', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '290de47b8579a70f997ead2ab3ada123dfa4d204', class: "zonos--address-component" })));
259
271
  }
260
272
  static get is() { return "zonos-address"; }
261
273
  static get encapsulation() { return "scoped"; }
@@ -70,9 +70,9 @@ export class ZonosAddressSuggestions {
70
70
  return segments;
71
71
  }
72
72
  render() {
73
- return (h(Host, { key: '88eff73526172a10854d2ae18b5b54afd3fd4b28', class: "zonos--address-suggestions", role: "group", style: {
73
+ return (h(Host, { key: 'eeb520d24c5cebca1f425c9648a2bdf0269f74c9', class: "zonos--address-suggestions", role: "group", style: {
74
74
  '--zonos--border-radius': getBorderRadius(),
75
- } }, h("ul", { key: 'f55c95ab39906d2bcb6edc6d5379ec6c70f5277a', "aria-label": "Suggestions", class: "wrapper", role: "listbox" }, !!this.localSuggestions.length && (h("li", { key: 'b7ca181e48f18ac7c0d2c8cfc1b05fec6df5827f', "aria-selected": false, class: "powered-by option", role: "option" }, h("div", { key: '07577044166b2cbfbec0cf96786266d74dd1c098', class: "powered-by-container" }, h("zonos-text", { key: '3780f4763666ac08cfe7083749b5f781b74e4e66', type: "caption" }, "Suggestions powered by"), h("zonos-text", { key: '73c5d1db8a235cae3ebc2af0eba89d91ade8a6a1', type: "semiBoldLabel" }, "Google")), h("zonos-button", { key: '6d6058329ced6bae0f04ce4e80da07506f706847', "aria-label": "Clear suggestions", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => {
75
+ } }, h("ul", { key: 'f7ac29ef14417f8c86dbafcf840204f4c964b3ad', "aria-label": "Suggestions", class: "wrapper", role: "listbox" }, !!this.localSuggestions.length && (h("li", { key: '13d34e64d8bd7711268a1f5641d0c868a89b949c', "aria-selected": false, class: "powered-by option", role: "option" }, h("div", { key: '00f20bd5568762ee581462826410031273e808da', class: "powered-by-container" }, h("zonos-text", { key: 'fc61a8ec973fc2cdf1e137563617cfed0badbb12', type: "caption" }, "Suggestions powered by"), h("zonos-text", { key: '96343fe696ec0d3990ffebaf450306ca91624d04', type: "semiBoldLabel" }, "Google")), h("zonos-button", { key: 'e7c6a9e64c8976a3c3a521b0794d2e82c1919ce2', "aria-label": "Clear suggestions", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => {
76
76
  this.localSuggestions = [];
77
77
  } }))), this.localSuggestions.map(suggestion => (
78
78
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events
@@ -12,9 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  import { h, Host, } from "@stencil/core";
14
14
  import throttle from "lodash/throttle";
15
- import { cartStore } from "../../store/checkout/cart";
16
15
  import { stripeStore } from "../../store/checkout/stripe";
17
16
  import { localizationStore } from "../../store/hello/localization";
17
+ import { storageStore, storageStoreOnChange, } from "../../store/storageStore";
18
18
  import { translate } from "../../store/translationStore";
19
19
  import { zonosStore } from "../../store/zonosStore";
20
20
  import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
@@ -30,6 +30,7 @@ import { countryRequireTaxId, shipToTaxIdLabels, } from "../../../types/checkout
30
30
  */
31
31
  export class ZonosAddress {
32
32
  constructor() {
33
+ this.onStoreCheckoutSessionIdChangedSubscription = () => { };
33
34
  /**
34
35
  * Whether the suggestion is clicked
35
36
  */
@@ -184,6 +185,14 @@ export class ZonosAddress {
184
185
  stripeStore.customBillingAddressErrors = customErrors;
185
186
  }
186
187
  };
188
+ this.onStoreCheckoutSessionIdChanged = () => {
189
+ const onCheckoutSessionIdChange = () => {
190
+ this.checkoutSessionId = storageStore.checkoutSessionId;
191
+ };
192
+ // Trigger it once on init because onChange doesn't get triggered on initial load
193
+ onCheckoutSessionIdChange();
194
+ this.onStoreCheckoutSessionIdChangedSubscription = storageStoreOnChange('checkoutSessionId', onCheckoutSessionIdChange);
195
+ };
187
196
  this.type = undefined;
188
197
  this.titleText = undefined;
189
198
  this.defaultAddress = [];
@@ -214,7 +223,7 @@ export class ZonosAddress {
214
223
  this.lastNameError = '';
215
224
  this.isFirstInitialization = true;
216
225
  this.addressService = null;
217
- this.checkoutSessionId = cartStore.checkoutSessionId;
226
+ this.checkoutSessionId = storageStore.checkoutSessionId;
218
227
  }
219
228
  getStripeAddressInstance() {
220
229
  if (this.type === 'billing') {
@@ -243,7 +252,7 @@ export class ZonosAddress {
243
252
  }
244
253
  isAddressFilledChanged() {
245
254
  // 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
246
- if (!cartStore.checkoutSessionId) {
255
+ if (!storageStore.checkoutSessionId) {
247
256
  return;
248
257
  }
249
258
  // Only need to track the event if the shipping address is filled
@@ -251,7 +260,7 @@ export class ZonosAddress {
251
260
  !this.trackingSent &&
252
261
  this.type === 'shipping') {
253
262
  this.trackingSent = true;
254
- const checkoutSessionId = cartStore.checkoutSessionId;
263
+ const checkoutSessionId = storageStore.checkoutSessionId;
255
264
  void trackConversionEvent({
256
265
  checkoutSessionId,
257
266
  eventName: 'checkout_customerInfoFilled',
@@ -773,6 +782,8 @@ export class ZonosAddress {
773
782
  // unsubscribe from address suggestions when this component is removed from the DOM
774
783
  (_a = this.onAddressSuggestionsUnsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
775
784
  (_b = this.onAddressSelectedUnsubscribe) === null || _b === void 0 ? void 0 : _b.call(this);
785
+ // cleanup checkout session id subscription
786
+ this.onStoreCheckoutSessionIdChangedSubscription();
776
787
  }
777
788
  componentWillLoad() {
778
789
  if (zonosStore.checkoutAddressService) {
@@ -795,12 +806,13 @@ export class ZonosAddress {
795
806
  // @Watch doesn't get trigger on initial load
796
807
  this.initAddressSuggestions();
797
808
  this.isFirstInitialization = false;
809
+ // subscribe to checkout session id changes from storage store
810
+ this.onStoreCheckoutSessionIdChanged();
798
811
  }
799
812
  render() {
800
813
  var _a;
801
814
  this.shippingZones = localizationStore.shippingZoneCountries;
802
815
  this.addressService = zonosStore.checkoutAddressService;
803
- this.checkoutSessionId = cartStore.checkoutSessionId;
804
816
  if ((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) {
805
817
  this.isAddressFilled = true;
806
818
  }
@@ -809,10 +821,10 @@ export class ZonosAddress {
809
821
  this.country = localizationStore.selectedCountryCode;
810
822
  }
811
823
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
812
- return (h(Host, { key: 'bb1f01c899ecdc1ed52eb8be7a680fdbb2ce9a7b', class: classes([
824
+ return (h(Host, { key: '7a766af62acc47886e716ac3c52c1457eae04545', class: classes([
813
825
  'zonos--address zonos--elements',
814
826
  `zonos--${this.type}-address`,
815
- ]) }, h("zonos-text", { key: 'f6ad6d23ec141fe192908b639802f69ad565958e', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
827
+ ]) }, h("zonos-text", { key: '224a78f8d1e02e2b0d7c95eafe9a1d4354fb5f73', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
816
828
  }
817
829
  static get is() { return "zonos-custom-address"; }
818
830
  static get encapsulation() { return "scoped"; }
@@ -1,6 +1,6 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { cartStore } from "../../store/checkout/cart";
3
2
  import { stripeStore } from "../../store/checkout/stripe";
3
+ import { storageStore } from "../../store/storageStore";
4
4
  import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
5
5
  import { logError } from "../../utils/logging/logError";
6
6
  /**
@@ -18,7 +18,7 @@ export class ZonosPayment {
18
18
  var _a;
19
19
  // Only send event once when payment info is filled
20
20
  if (this.isPaymentInfoFilled && !this.trackingSent) {
21
- const checkoutSessionId = cartStore.checkoutSessionId;
21
+ const checkoutSessionId = storageStore.checkoutSessionId;
22
22
  void trackConversionEvent({
23
23
  checkoutSessionId,
24
24
  eventName: 'checkout_paymentInfoFilled',
@@ -58,7 +58,7 @@ export class ZonosPayment {
58
58
  }
59
59
  render() {
60
60
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
61
- return (h(Host, { key: 'c97f9b800febc678b67643b2020289dc4d382767', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: 'fe8ca21af5fc997831fa5839e26e4de7adb04766', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '863719d3e20a4b63ae2f7dbfe54482c57f3fa393', class: "zonos--payment-component" }), h("div", { key: 'd7c5edc24348ac4c3da4e3b437bd47aaabf45287', class: "zonos--payment-paypal-container" })));
61
+ return (h(Host, { key: '7210a20afba18d167a6e7d875ba23daa0db774e4', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '4f043b3149cca48d2f4463a826541ebe35d0b6ca', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '15721e208e90b969c075877680a02dca5bb81689', class: "zonos--payment-component" }), h("div", { key: '36d5767821464db479feff18e6368e862550c777', class: "zonos--payment-paypal-container" })));
62
62
  }
63
63
  static get is() { return "zonos-payment"; }
64
64
  static get encapsulation() { return "scoped"; }
@@ -1,14 +1,14 @@
1
- import { cartStore } from "../../store/checkout/cart";
1
+ import { storageStore } from "../../store/storageStore";
2
2
  import { handleFetch } from "../handleFetch";
3
3
  export const getCheckoutSession = async () => {
4
- if (!cartStore.checkoutSessionId) {
4
+ if (!storageStore.checkoutSessionId) {
5
5
  return {
6
6
  errors: [{ message: 'No checkout session id found' }],
7
7
  json: null,
8
8
  };
9
9
  }
10
10
  const searchParams = new URLSearchParams();
11
- searchParams.set('checkoutSessionId', cartStore.checkoutSessionId);
11
+ searchParams.set('checkoutSessionId', storageStore.checkoutSessionId);
12
12
  const { errors, json } = await handleFetch(`/api/zonos-elements/get-checkout-session?${searchParams.toString()}`);
13
13
  return { errors, json };
14
14
  };
@@ -1,11 +1,12 @@
1
1
  import { cartStore } from "../../store/checkout/cart";
2
+ import { storageStore } from "../../store/storageStore";
2
3
  import { handleFetch } from "../handleFetch";
3
4
  import { logError } from "../logging/logError";
4
5
  export const placeTestOrder = async () => {
5
6
  var _a, _b;
6
7
  const shipToPartyId = (_a = cartStore.partiesData.find(party => party.type === 'DESTINATION')) === null || _a === void 0 ? void 0 : _a.id;
7
8
  const billToPartyId = (_b = cartStore.partiesData.find(party => party.type === 'PAYOR')) === null || _b === void 0 ? void 0 : _b.id;
8
- const checkoutSessionId = cartStore.checkoutSessionId;
9
+ const checkoutSessionId = storageStore.checkoutSessionId;
9
10
  if (!checkoutSessionId || !billToPartyId || !shipToPartyId) {
10
11
  logError('Missing required data', {
11
12
  billToPartyId,
@@ -1,5 +1,6 @@
1
1
  import { cartStore } from "../../store/checkout/cart";
2
2
  import { stripeStore } from "../../store/checkout/stripe";
3
+ import { storageStore } from "../../store/storageStore";
3
4
  import { log } from "../logging/log";
4
5
  /**
5
6
  * Extract value from translated object
@@ -67,7 +68,7 @@ export const prepCartCalculateLandedCost = (cartId) => {
67
68
  // Use the first item's currency code
68
69
  cartCurrencyCode: (_a = cartStore.items[0]) === null || _a === void 0 ? void 0 : _a.currencyCode,
69
70
  cartId,
70
- checkoutSessionId: cartStore.checkoutSessionId || '',
71
+ checkoutSessionId: storageStore.checkoutSessionId || '',
71
72
  contact: {
72
73
  companyName: stripeStore.companyName,
73
74
  email: stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email,
@@ -160,7 +161,7 @@ export const prepCalculateLandedCost = () => {
160
161
  lastName: billingLastName,
161
162
  phone: translatedBillingAddress.phone,
162
163
  },
163
- checkoutSessionId: cartStore.checkoutSessionId || '',
164
+ checkoutSessionId: storageStore.checkoutSessionId || '',
164
165
  contact: {
165
166
  companyName: stripeStore.companyName,
166
167
  email: stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email,
@@ -0,0 +1,20 @@
1
+ import { handleFetch } from "../handleFetch";
2
+ import { filterValidTests } from "../varianceTest/filterValidTests";
3
+ export const selectVarianceTest = async ({ testKeys }) => {
4
+ // Do nothing if no test keys are provided
5
+ if (testKeys.length === 0) {
6
+ return null;
7
+ }
8
+ const { errors, json } = await handleFetch('/api/zonos-elements/select-variance-test', {
9
+ body: {
10
+ testKeys,
11
+ },
12
+ method: 'POST',
13
+ });
14
+ if (errors.length || !json) {
15
+ return null;
16
+ }
17
+ const filteredAvailableTestKeys = filterValidTests(json);
18
+ // Filter the response to only include test keys that we support
19
+ return filteredAvailableTestKeys;
20
+ };
@@ -0,0 +1,44 @@
1
+ export const buildCartUrl = ({ cartId, checkoutSessionId, customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerFirstName, customerLastName, customerPhone, customerState, customerZip, hostedCheckoutUrl, isTestMode, isVariantTest, }) => {
2
+ const urlParams = new URLSearchParams();
3
+ urlParams.set('tempCartUUID', cartId);
4
+ if (customerFirstName) {
5
+ urlParams.set('customerFirstName', customerFirstName);
6
+ }
7
+ if (customerLastName) {
8
+ urlParams.set('customerLastName', customerLastName);
9
+ }
10
+ if (customerEmail) {
11
+ urlParams.set('customerEmail', customerEmail);
12
+ }
13
+ if (customerPhone) {
14
+ urlParams.set('customerPhone', customerPhone);
15
+ }
16
+ if (customerZip) {
17
+ urlParams.set('customerZip', customerZip);
18
+ }
19
+ if (customerCity) {
20
+ urlParams.set('customerCity', customerCity);
21
+ }
22
+ if (customerState) {
23
+ urlParams.set('customerState', customerState);
24
+ }
25
+ if (customerCountry) {
26
+ urlParams.set('zCountry', customerCountry);
27
+ }
28
+ if (customerAddress1) {
29
+ urlParams.set('customerAddress1', customerAddress1);
30
+ }
31
+ if (customerAddress2) {
32
+ urlParams.set('customerAddress2', customerAddress2);
33
+ }
34
+ if (isTestMode) {
35
+ urlParams.set('zonosTestMode', '1');
36
+ }
37
+ if (checkoutSessionId) {
38
+ urlParams.set('zonosCheckoutSessionId', checkoutSessionId);
39
+ }
40
+ if (isVariantTest) {
41
+ urlParams.set('zonosVariantTest', '1');
42
+ }
43
+ return `${hostedCheckoutUrl}?${urlParams.toString()}`;
44
+ };
@@ -0,0 +1,42 @@
1
+ import { localizationStore } from "../store/hello/localization";
2
+ import { getZCountryUrlParam } from "./hello/getZCountryUrlParam";
3
+ import { log } from "./logging/log";
4
+ export const getLegacyQueryParams = () => {
5
+ const urlParams = new URLSearchParams(window.location.search);
6
+ log('legacy urlParams', 'info', Object.fromEntries(urlParams.entries()));
7
+ const getParam = (param) => {
8
+ const value = urlParams.get(param);
9
+ if (!value || value === 'undefined') {
10
+ return '';
11
+ }
12
+ return value;
13
+ };
14
+ const customerCountry =
15
+ // fallback to selected country code if country is not provided
16
+ getZCountryUrlParam(urlParams) ||
17
+ localizationStore.selectedCountryCode ||
18
+ 'US';
19
+ const customerCity = getParam('customerCity');
20
+ const customerEmail = getParam('customerEmail');
21
+ const customerAddress1 = getParam('customerAddress1');
22
+ const customerAddress2 = getParam('customerAddress2');
23
+ const customerName = getParam('customerName');
24
+ const customerPhone = getParam('customerPhone');
25
+ const customerZip = getParam('customerZip');
26
+ const customerState = getParam('customerState');
27
+ const customerFirstName = getParam('customerFirstName');
28
+ const customerLastName = getParam('customerLastName');
29
+ return {
30
+ customerAddress1,
31
+ customerAddress2,
32
+ customerCity,
33
+ customerCountry,
34
+ customerEmail,
35
+ customerFirstName,
36
+ customerLastName,
37
+ customerName,
38
+ customerPhone,
39
+ customerState,
40
+ customerZip,
41
+ };
42
+ };
@@ -0,0 +1,6 @@
1
+ export const filterExpiredTests = (testKeys) => (testKeys === null || testKeys === void 0 ? void 0 : testKeys.filter(v => {
2
+ if ((v.expiresAt && v.expiresAt < Date.now()) || !v.expiresAt) {
3
+ return false;
4
+ }
5
+ return true;
6
+ })) || [];
@@ -0,0 +1,23 @@
1
+ import { VARIANT_TEST_KEY_EXPIRATION } from "../../store/storageStore";
2
+ import { hasAtLeastOneAvailableTestKey } from "./hasAtLeastOneAvailableTestKey";
3
+ import { availableTestKeys } from "../../../types/index";
4
+ /**
5
+ * Filter the response to only include test keys and variants key that we support
6
+ */
7
+ export const filterValidTests = (testKeys) => {
8
+ // Type guard the response to ensure it matches the expected structure
9
+ if (!hasAtLeastOneAvailableTestKey(testKeys)) {
10
+ return [];
11
+ }
12
+ // Filter the response to only include test keys that we support
13
+ return testKeys
14
+ .filter(item => {
15
+ var _a;
16
+ const isTestKeyValidButNoSelectedVariantKey = availableTestKeys[item.testKey] && !item.selectedVariantKey;
17
+ const validTestKeyWithSelectedVariantKey = item.selectedVariantKey &&
18
+ !!((_a = availableTestKeys[item.testKey]) === null || _a === void 0 ? void 0 : _a['availableVariants'].includes(item.selectedVariantKey));
19
+ return (isTestKeyValidButNoSelectedVariantKey ||
20
+ validTestKeyWithSelectedVariantKey);
21
+ })
22
+ .map(item => (Object.assign(Object.assign({}, item), { expiresAt: item.expiresAt || Date.now() + VARIANT_TEST_KEY_EXPIRATION, selectedVariantKey: item.selectedVariantKey || null })));
23
+ };
@@ -0,0 +1,6 @@
1
+ import { storageStore } from "../../store/storageStore";
2
+ export const getSelectedTestVariant = (testKey) => {
3
+ var _a;
4
+ const currentTest = (_a = storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.find(v => v.testKey === testKey);
5
+ return (currentTest === null || currentTest === void 0 ? void 0 : currentTest.selectedVariantKey) || null;
6
+ };
@@ -0,0 +1,14 @@
1
+ import { log } from "../logging/log";
2
+ import { availableTestKeys } from "../../../types/index";
3
+ /**
4
+ * Check if the response contains at least one available test key that we support
5
+ */
6
+ export const hasAtLeastOneAvailableTestKey = (rawResponse) => {
7
+ const hasAvailableTestKey = !!rawResponse.find(item => item.testKey in availableTestKeys);
8
+ if (!hasAvailableTestKey) {
9
+ log('No available test key found in response', 'info', {
10
+ response: rawResponse,
11
+ });
12
+ }
13
+ return !!rawResponse.find(item => item.testKey in availableTestKeys);
14
+ };
@@ -0,0 +1,4 @@
1
+ import { availableTestKeys } from "../../../types/index";
2
+ export const isInAvailableTestKey = (testKey) => {
3
+ return testKey in availableTestKeys;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { zonosStore } from "../../store/zonosStore";
2
+ export const isTestEnabled = (testKey) => {
3
+ return zonosStore.enabledVariantTestKeys.includes(testKey);
4
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Typeguard to check if all variant test keys are selected.
3
+ */
4
+ export const isTestKeysAllVariantSelected = (variantTestKeys) => {
5
+ return variantTestKeys.every(v => !!v.selectedVariantKey);
6
+ };
@@ -0,0 +1,13 @@
1
+ import { VARIANT_TEST_KEY_EXPIRATION } from "../../store/storageStore";
2
+ export const mergeTest = ({ baseTestObj, mergeTestObj, }) => {
3
+ return baseTestObj.map(({ testKey }) => {
4
+ // We will attempt to get the enabled selection from localStorage first and only re-fetch if the testKeys are changed
5
+ const existingSelection = mergeTestObj.find(({ testKey: key }) => key === testKey);
6
+ return {
7
+ expiresAt: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.expiresAt) ||
8
+ Date.now() + VARIANT_TEST_KEY_EXPIRATION,
9
+ selectedVariantKey: (existingSelection === null || existingSelection === void 0 ? void 0 : existingSelection.selectedVariantKey) || null,
10
+ testKey,
11
+ };
12
+ });
13
+ };
@@ -24,7 +24,7 @@ export const getZonosQaUrl = () => {
24
24
  }
25
25
  // when local demo app is running, it needs to use the local dev script unless the qaUrl is set
26
26
  if (!qaUrl &&
27
- ['dev.demo.elements.zonos.com'].includes(window.location.hostname)) {
27
+ ['dev.demo.elements.zonos.com', 'dev.checkout.elements.zonos.com'].includes(window.location.hostname)) {
28
28
  return 'https://dev.elements.zonos.com';
29
29
  }
30
30
  if (!qaUrl) {
@@ -70,7 +70,7 @@ export const getZonosQaUrlApi = () => {
70
70
  const qaUrl = _qaUrlApi || _qaUrl;
71
71
  // when local demo app is running, it needs to use the local dev script unless the qaUrl is set
72
72
  if (!qaUrl &&
73
- ['dev.demo.elements.zonos.com'].includes(window.location.hostname)) {
73
+ ['dev.demo.elements.zonos.com', 'dev.checkout.elements.zonos.com'].includes(window.location.hostname)) {
74
74
  return 'https://dev.demo.elements.zonos.com';
75
75
  }
76
76
  if (!qaUrl) {
@@ -0,0 +1,8 @@
1
+ export const availableTestKeys = {
2
+ hosted_vs_native: {
3
+ availableVariants: ['hosted', 'native'],
4
+ },
5
+ test_A_B: {
6
+ availableVariants: ['A', 'B'],
7
+ },
8
+ };