@zonos/elements 1.3.207 → 1.3.209

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 (239) hide show
  1. package/dist/cjs/{CheckoutConfig-4afc683b.js → CheckoutConfig-27c82f94.js} +19 -0
  2. package/dist/cjs/{cart-3d961c6e.js → cart-2ec8cac2.js} +285 -64
  3. package/dist/cjs/{debounce-0b9c0f8a.js → debounce-465a4328.js} +1 -1
  4. package/dist/cjs/{getBorderRadius-c424eb05.js → getBorderRadius-1b5e33cf.js} +1 -1
  5. package/dist/cjs/{handleFetch-969d05d8.js → handleFetch-05227713.js} +2 -6
  6. package/dist/cjs/index.cjs.js +29 -9
  7. package/dist/cjs/{isDarkColor-35e8daec.js → isDarkColor-428965f4.js} +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{localization-ff33875b.js → localization-9b43376c.js} +3 -2
  10. package/dist/cjs/{paypal-dee5c109.js → paypal-6449314e.js} +5 -5
  11. package/dist/cjs/updateCheckoutSessionAttributes-a31bb681.js +50 -0
  12. package/dist/cjs/zonos-address_11.cjs.entry.js +104 -84
  13. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  16. package/dist/cjs/zonos-card.cjs.entry.js +2 -2
  17. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +98 -49
  18. package/dist/cjs/zonos-checkout.cjs.entry.js +87 -31
  19. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  21. package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -3
  22. package/dist/cjs/zonos-country-select_4.cjs.entry.js +13 -9
  23. package/dist/cjs/zonos-elements.cjs.js +1 -1
  24. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +7 -7
  25. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  26. package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
  27. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  28. package/dist/cjs/zonos-language-select_2.cjs.entry.js +3 -3
  29. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  30. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  31. package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
  32. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  33. package/dist/cjs/zonos-toggle.cjs.entry.js +1 -1
  34. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  35. package/dist/cjs/{zonosStore-7c1e1bc1.js → zonosStore-f8ee56aa.js} +1 -0
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +79 -24
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +71 -36
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +33 -11
  39. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +2 -2
  40. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +9 -5
  41. package/dist/collection/components/store/checkout/cart.js +9 -2
  42. package/dist/collection/components/store/checkout/stripe.js +266 -55
  43. package/dist/collection/components/store/hello/localization.js +1 -0
  44. package/dist/collection/components/stripe/zonos-address/zonos-address.css +2 -1
  45. package/dist/collection/components/stripe/zonos-address/zonos-address.js +24 -3
  46. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +2 -1
  47. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +7 -5
  48. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +3 -2
  49. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +2 -2
  50. package/dist/collection/components/utils/api/updateCheckoutSessionAttributes.js +46 -0
  51. package/dist/collection/components/utils/checkout/getAbandonedCartRenewTokenValue.js +17 -0
  52. package/dist/collection/components/utils/handleFetch.js +2 -1
  53. package/dist/collection/components/utils/logging/log.js +0 -5
  54. package/dist/collection/scripts/_getCartInfoById.js +3 -0
  55. package/dist/collection/types/checkout/api/CheckoutSession.js +14 -1
  56. package/dist/collection/types/checkout/api/CreateParty.js +1 -0
  57. package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
  58. package/dist/collection/types/generated/graphql.internal.types.js +15 -0
  59. package/dist/collection/types/index.js +1 -0
  60. package/dist/esm/{CheckoutConfig-eb7d6954.js → CheckoutConfig-724d7bae.js} +19 -1
  61. package/dist/esm/{cart-5835676d.js → cart-2f84f632.js} +284 -65
  62. package/dist/esm/{debounce-eaee3a94.js → debounce-0e42da22.js} +1 -1
  63. package/dist/esm/{getBorderRadius-b18c924f.js → getBorderRadius-71b3b8ab.js} +1 -1
  64. package/dist/esm/{handleFetch-621e45bc.js → handleFetch-7dd4622b.js} +2 -6
  65. package/dist/esm/index.js +28 -11
  66. package/dist/esm/{isDarkColor-d8bb8659.js → isDarkColor-3a9d6108.js} +1 -1
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/{localization-4c7f64e8.js → localization-e17c211b.js} +3 -2
  69. package/dist/esm/{paypal-b4f106be.js → paypal-1cf701aa.js} +6 -6
  70. package/dist/esm/updateCheckoutSessionAttributes-5097e715.js +48 -0
  71. package/dist/esm/zonos-address_11.entry.js +104 -84
  72. package/dist/esm/zonos-badge.entry.js +1 -1
  73. package/dist/esm/zonos-banner.entry.js +1 -1
  74. package/dist/esm/zonos-button_3.entry.js +3 -3
  75. package/dist/esm/zonos-card.entry.js +2 -2
  76. package/dist/esm/zonos-cart-items_14.entry.js +98 -49
  77. package/dist/esm/zonos-checkout.entry.js +87 -31
  78. package/dist/esm/zonos-collapse.entry.js +1 -1
  79. package/dist/esm/zonos-controller.entry.js +6 -6
  80. package/dist/esm/zonos-country-flag.entry.js +3 -3
  81. package/dist/esm/zonos-country-select_4.entry.js +13 -9
  82. package/dist/esm/zonos-elements.js +1 -1
  83. package/dist/esm/zonos-empty-state-payment_4.entry.js +7 -7
  84. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  85. package/dist/esm/zonos-hello.entry.js +4 -4
  86. package/dist/esm/zonos-input.entry.js +2 -2
  87. package/dist/esm/zonos-language-select_2.entry.js +3 -3
  88. package/dist/esm/zonos-logo.entry.js +1 -1
  89. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  90. package/dist/esm/zonos-stripe-input.entry.js +3 -3
  91. package/dist/esm/zonos-text.entry.js +1 -1
  92. package/dist/esm/zonos-toggle.entry.js +1 -1
  93. package/dist/esm/zonos-v-stack.entry.js +1 -1
  94. package/dist/esm/{zonosStore-1e015fa5.js → zonosStore-00975763.js} +1 -1
  95. package/dist/esm-es5/CheckoutConfig-724d7bae.js +1 -0
  96. package/dist/esm-es5/cart-2f84f632.js +1 -0
  97. package/dist/esm-es5/{debounce-eaee3a94.js → debounce-0e42da22.js} +1 -1
  98. package/dist/esm-es5/{getBorderRadius-b18c924f.js → getBorderRadius-71b3b8ab.js} +1 -1
  99. package/dist/esm-es5/handleFetch-7dd4622b.js +1 -0
  100. package/dist/esm-es5/index.js +1 -1
  101. package/dist/esm-es5/{isDarkColor-d8bb8659.js → isDarkColor-3a9d6108.js} +1 -1
  102. package/dist/esm-es5/loader.js +1 -1
  103. package/dist/esm-es5/{localization-4c7f64e8.js → localization-e17c211b.js} +1 -1
  104. package/dist/esm-es5/{paypal-b4f106be.js → paypal-1cf701aa.js} +2 -2
  105. package/dist/esm-es5/updateCheckoutSessionAttributes-5097e715.js +1 -0
  106. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  107. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  108. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  109. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  110. package/dist/esm-es5/zonos-card.entry.js +1 -1
  111. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  112. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  113. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  114. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  115. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  116. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  117. package/dist/esm-es5/zonos-elements.js +1 -1
  118. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  119. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  120. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  121. package/dist/esm-es5/zonos-input.entry.js +1 -1
  122. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  123. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  124. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  125. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  126. package/dist/esm-es5/zonos-text.entry.js +1 -1
  127. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  128. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  129. package/dist/esm-es5/{zonosStore-1e015fa5.js → zonosStore-00975763.js} +1 -1
  130. package/dist/scripts/index.d.ts +10 -0
  131. package/dist/scripts/index.js +1 -1
  132. package/dist/scripts/loadZonos.js +1 -1
  133. package/dist/scripts/zonos.js +1 -1
  134. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -0
  135. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +8 -4
  136. package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +3 -0
  137. package/dist/types/components/common/zonos-country-select/zonos-country-select.d.ts +1 -0
  138. package/dist/types/components/store/checkout/cart.d.ts +6 -2
  139. package/dist/types/components/store/checkout/stripe.d.ts +33 -6
  140. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +6 -0
  141. package/dist/types/components/utils/api/updateCheckoutSessionAttributes.d.ts +7 -0
  142. package/dist/types/components/utils/checkout/getAbandonedCartRenewTokenValue.d.ts +1 -0
  143. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +1 -0
  144. package/dist/types/types/checkout/api/CheckoutSession.d.ts +16 -0
  145. package/dist/types/types/checkout/api/CreateParty.d.ts +34 -0
  146. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -0
  147. package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
  148. package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
  149. package/dist/types/types/generated/graphql.internal.types.d.ts +61 -5
  150. package/dist/types/types/generated/graphql.internal.types.ts +105 -3
  151. package/dist/types/types/index.d.ts +1 -0
  152. package/dist/types/types/utils/ZonosSettings.d.ts +6 -0
  153. package/dist/zonos-elements/index.esm.js +1 -1
  154. package/dist/zonos-elements/{p-4e9c8f9e.system.js → p-0751b878.system.js} +1 -1
  155. package/dist/zonos-elements/{p-abe218ab.system.entry.js → p-08b29f73.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-74bcb5cc.entry.js → p-0ca1d6dd.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-12cd9d3a.entry.js → p-144b5006.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-9e9ac7a2.system.js → p-19182dc7.system.js} +1 -1
  159. package/dist/zonos-elements/{p-eca09508.system.entry.js → p-1dc78af3.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-e337fa88.js → p-207bd04a.js} +1 -1
  161. package/dist/zonos-elements/p-20839c46.js +1 -0
  162. package/dist/zonos-elements/{p-1aa24297.system.entry.js → p-2122d2cc.system.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-4fb88ebc.system.entry.js → p-239695e8.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-3196bf98.entry.js → p-23fe7661.entry.js} +1 -1
  165. package/dist/zonos-elements/p-2652198d.js +1 -0
  166. package/dist/zonos-elements/p-30a9f802.system.entry.js +1 -0
  167. package/dist/zonos-elements/{p-c666d557.system.js → p-3633a952.system.js} +1 -1
  168. package/dist/zonos-elements/{p-9b8a5372.entry.js → p-36b686b6.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-658936c9.js → p-371d91d1.js} +2 -2
  170. package/dist/zonos-elements/{p-019f8637.entry.js → p-3934b38a.entry.js} +1 -1
  171. package/dist/zonos-elements/p-3c752420.system.js +1 -0
  172. package/dist/zonos-elements/p-3ee44728.system.js +1 -1
  173. package/dist/zonos-elements/p-40a4c8a2.system.js +1 -0
  174. package/dist/zonos-elements/{p-91c996d3.system.js → p-44c0a584.system.js} +2 -2
  175. package/dist/zonos-elements/{p-eb2560b6.system.entry.js → p-45a2f9b1.system.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-1327b935.system.js → p-4a1b4a2d.system.js} +1 -1
  177. package/dist/zonos-elements/p-4c70fd75.entry.js +1 -0
  178. package/dist/zonos-elements/{p-bab19e2a.entry.js → p-4d62f3de.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-848e08e8.entry.js → p-4dbaa2c2.entry.js} +1 -1
  180. package/dist/zonos-elements/p-4ed73ff8.entry.js +1 -0
  181. package/dist/zonos-elements/{p-47e2cd31.entry.js → p-4f5513dc.entry.js} +1 -1
  182. package/dist/zonos-elements/p-542acc2c.js +1 -0
  183. package/dist/zonos-elements/p-5711e187.system.js +1 -0
  184. package/dist/zonos-elements/{p-41c1d7c4.entry.js → p-5956a9e0.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-5616b304.entry.js → p-5b7686f8.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-0c4c8d63.entry.js → p-63a4dac5.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-f4d741de.system.entry.js → p-695bf400.system.entry.js} +1 -1
  188. package/dist/zonos-elements/{p-9fa17353.js → p-6aa728f2.js} +1 -1
  189. package/dist/zonos-elements/{p-ed20f2f7.js → p-71c6bdc3.js} +1 -1
  190. package/dist/zonos-elements/p-738a49c0.system.js +1 -0
  191. package/dist/zonos-elements/{p-469ccc66.system.entry.js → p-74276b82.system.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-e0587eeb.entry.js → p-77e22be4.entry.js} +1 -1
  193. package/dist/zonos-elements/{p-3afc27ef.entry.js → p-78dd1c53.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-620deb03.system.entry.js → p-7f9bbbb3.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-896f2358.system.entry.js +1 -0
  196. package/dist/zonos-elements/{p-719e14a8.system.entry.js → p-8f41d864.system.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-4cb8b87f.system.entry.js → p-964e2587.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-93aeba62.system.entry.js → p-97831744.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-2866fd29.system.entry.js → p-9d95c896.system.entry.js} +1 -1
  200. package/dist/zonos-elements/{p-abc83d01.entry.js → p-a24870af.entry.js} +1 -1
  201. package/dist/zonos-elements/p-a411ce2a.system.js +1 -0
  202. package/dist/zonos-elements/{p-1bc09abe.system.entry.js → p-a4686344.system.entry.js} +1 -1
  203. package/dist/zonos-elements/{p-edcfb3a3.js → p-a6f77d44.js} +1 -1
  204. package/dist/zonos-elements/{p-b21b0330.entry.js → p-a8f421ac.entry.js} +1 -1
  205. package/dist/zonos-elements/{p-18149db1.entry.js → p-aa40d402.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-536f69eb.entry.js → p-ad1e1dbc.entry.js} +1 -1
  207. package/dist/zonos-elements/p-b1bfeec9.system.entry.js +1 -0
  208. package/dist/zonos-elements/p-b2d81c98.js +1 -0
  209. package/dist/zonos-elements/{p-7777d85f.system.entry.js → p-baa88176.system.entry.js} +1 -1
  210. package/dist/zonos-elements/{p-1ad099ec.system.entry.js → p-bf9cb85f.system.entry.js} +1 -1
  211. package/dist/zonos-elements/p-bfdb4e7a.entry.js +1 -0
  212. package/dist/zonos-elements/{p-858b7908.system.entry.js → p-c345b306.system.entry.js} +1 -1
  213. package/dist/zonos-elements/{p-22cb6880.system.entry.js → p-d1697144.system.entry.js} +1 -1
  214. package/dist/zonos-elements/p-d1c0bf92.entry.js +1 -0
  215. package/dist/zonos-elements/{p-16678764.js → p-d6a53ea6.js} +1 -1
  216. package/dist/zonos-elements/{p-265af369.system.entry.js → p-db424e02.system.entry.js} +1 -1
  217. package/dist/zonos-elements/p-eb77c0bf.system.js +1 -0
  218. package/dist/zonos-elements/{p-30778fde.system.entry.js → p-ef1ccec6.system.entry.js} +1 -1
  219. package/dist/zonos-elements/{p-42a9557f.entry.js → p-fdf5b8f4.entry.js} +1 -1
  220. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  221. package/package.json +1 -1
  222. package/dist/esm-es5/CheckoutConfig-eb7d6954.js +0 -1
  223. package/dist/esm-es5/cart-5835676d.js +0 -1
  224. package/dist/esm-es5/handleFetch-621e45bc.js +0 -1
  225. package/dist/zonos-elements/p-0de2c731.system.js +0 -1
  226. package/dist/zonos-elements/p-0fc02cde.js +0 -1
  227. package/dist/zonos-elements/p-1b75aa35.system.js +0 -1
  228. package/dist/zonos-elements/p-3a50124e.entry.js +0 -1
  229. package/dist/zonos-elements/p-3f1a2d31.js +0 -1
  230. package/dist/zonos-elements/p-5e1b2654.system.js +0 -1
  231. package/dist/zonos-elements/p-666164d9.system.js +0 -1
  232. package/dist/zonos-elements/p-9f78b79e.entry.js +0 -1
  233. package/dist/zonos-elements/p-a2b55d11.entry.js +0 -1
  234. package/dist/zonos-elements/p-aafcd40f.system.entry.js +0 -1
  235. package/dist/zonos-elements/p-b922c441.system.js +0 -1
  236. package/dist/zonos-elements/p-ba027b70.system.entry.js +0 -1
  237. package/dist/zonos-elements/p-c4e0f49a.system.entry.js +0 -1
  238. package/dist/zonos-elements/p-dbd23bea.entry.js +0 -1
  239. package/dist/zonos-elements/p-f9664811.js +0 -1
@@ -1,8 +1,8 @@
1
- import { z as zonosStore, c as createStore } from './zonosStore-1e015fa5.js';
2
- import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-4c7f64e8.js';
3
- import { l as log, f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, d as allLogs, b as logError, j as jsonParse } from './handleFetch-621e45bc.js';
4
- import { i as isDarkColor } from './isDarkColor-d8bb8659.js';
5
- import { g as getBorderRadius } from './getBorderRadius-b18c924f.js';
1
+ import { z as zonosStore, c as createStore } from './zonosStore-00975763.js';
2
+ import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-e17c211b.js';
3
+ import { l as log, f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, d as allLogs, b as logError, j as jsonParse } from './handleFetch-7dd4622b.js';
4
+ import { i as isDarkColor } from './isDarkColor-3a9d6108.js';
5
+ import { g as getBorderRadius } from './getBorderRadius-71b3b8ab.js';
6
6
 
7
7
  /**
8
8
  * Extract value from translated object
@@ -35,7 +35,7 @@ const prepCartCalculateLandedCost = (cartId) => {
35
35
  const stripeBillingAddressData = stripeStore.stripeShippingSameAsBilling
36
36
  ? stripeStore.stripeAddressEventData
37
37
  : stripeStore.stripeBillingAddressEventData;
38
- if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
38
+ if (!stripeAddressData || !stripeBillingAddressData) {
39
39
  throw new Error('Missing stripe address data');
40
40
  }
41
41
  // Attempt to get translated address if available
@@ -112,7 +112,7 @@ const prepCalculateLandedCost = () => {
112
112
  ? stripeStore.stripeAddressEventData
113
113
  : stripeStore.stripeBillingAddressEventData;
114
114
  log({ stripeAddressData, stripeBillingAddressData }, 'info');
115
- if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
115
+ if (!stripeAddressData || !stripeBillingAddressData) {
116
116
  throw new Error('Missing stripe address data');
117
117
  }
118
118
  // Attempt to get translated address if available
@@ -254,7 +254,7 @@ const calculateLandedCost = async (abortController) => {
254
254
  };
255
255
 
256
256
  const cartCalculateLandedCost = async ({ abortController, cartId, }) => {
257
- var _a;
257
+ var _a, _b;
258
258
  // request to get landed cost info
259
259
  const { errors, json } = await handleFetch('/api/zonos-elements/cart-calculate-landed-cost', {
260
260
  body: prepCartCalculateLandedCost(cartId),
@@ -262,7 +262,8 @@ const cartCalculateLandedCost = async ({ abortController, cartId, }) => {
262
262
  signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
263
263
  });
264
264
  if (errors.length || !json) {
265
- const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
265
+ const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.' ||
266
+ ((_b = errors[0]) === null || _b === void 0 ? void 0 : _b.message.includes('signal is aborted'));
266
267
  const errorMessage = isAbortedRequest
267
268
  ? 'The landed cost calculation request was aborted to initiate a new one.'
268
269
  : 'Failed to calculate landed cost';
@@ -597,6 +598,7 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = c
597
598
  checkoutSettlementCurrency: 'USD',
598
599
  clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
599
600
  companyName: '',
601
+ companyNameUsedWhenAsyncAddressUpdate: '',
600
602
  customAddressErrors: {
601
603
  city: '',
602
604
  firstName: '',
@@ -623,6 +625,8 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = c
623
625
  hasPaymentError: false,
624
626
  isFetchingLandedCost: false,
625
627
  isFetchingSession: false,
628
+ partyBillingId: null,
629
+ partyShippingId: null,
626
630
  shouldInventoryRefund: false,
627
631
  shouldRenderPayInUsdButton: false,
628
632
  /**
@@ -635,10 +639,12 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = c
635
639
  stripe: null,
636
640
  stripeAddressElement: null,
637
641
  stripeAddressEventData: null,
642
+ stripeAddressUsedWhenAsyncAddressUpdate: null,
638
643
  stripeAddressUsedWhenFetchingLC: null,
639
644
  stripeAddressUsedWhenValidatingAddress: null,
640
645
  stripeBillingAddressElement: null,
641
646
  stripeBillingAddressEventData: null,
647
+ stripeBillingAddressUsedWhenAsyncAddressUpdate: null,
642
648
  stripeBillingAddressUsedWhenFetchingLC: null,
643
649
  stripeBillingAddressUsedWhenValidatingAddress: null,
644
650
  stripeCustomerSessionClientSecret: null,
@@ -652,7 +658,7 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = c
652
658
  stripePaymentEventData: null,
653
659
  stripeShippingSameAsBilling: true,
654
660
  taxId: '',
655
- taxIdUsedWhenFetchingLC: '',
661
+ taxIdUsedWhenAsyncAddressUpdate: '',
656
662
  translatedAddress: {
657
663
  address: {},
658
664
  billingAddress: {},
@@ -757,15 +763,178 @@ const checkIsAddressOutdatedForValidation = () => {
757
763
  JSON.stringify((_d = stripeStore.stripeBillingAddressUsedWhenValidatingAddress) === null || _d === void 0 ? void 0 : _d.value);
758
764
  return isAddressDataDirty || isBillingAddressDataDirty;
759
765
  };
760
- const checkIsAddressOutdatedForLCPrefetch = () => {
766
+ const checkIsAddressOutdatedForAsyncAddressUpdate = () => {
761
767
  var _a, _b, _c, _d, _e, _f;
762
768
  const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
763
769
  JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
764
- const isAddressDataDirty = JSON.stringify((_c = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _c === void 0 ? void 0 : _c.value) !==
765
- JSON.stringify((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value);
770
+ const isAddressDataDirty = JSON.stringify((_c = stripeStore.stripeAddressUsedWhenAsyncAddressUpdate) === null || _c === void 0 ? void 0 : _c.value) !== JSON.stringify((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value);
766
771
  const isBillingAddressDataDirty = !stripeStore.stripeShippingSameAsBilling &&
767
- JSON.stringify((_e = stripeStore.stripeBillingAddressEventData) === null || _e === void 0 ? void 0 : _e.value) !==
768
- JSON.stringify((_f = stripeStore.stripeBillingAddressUsedWhenFetchingLC) === null || _f === void 0 ? void 0 : _f.value);
772
+ JSON.stringify((_e = stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate) === null || _e === void 0 ? void 0 : _e.value) !== JSON.stringify((_f = stripeStore.stripeBillingAddressEventData) === null || _f === void 0 ? void 0 : _f.value);
773
+ const isTaxIdDirty = stripeStore.taxIdUsedWhenAsyncAddressUpdate !== stripeStore.taxId;
774
+ const isCompanyNameDirty = stripeStore.companyNameUsedWhenAsyncAddressUpdate !==
775
+ stripeStore.companyName;
776
+ return (isLinkDataDirty ||
777
+ isAddressDataDirty ||
778
+ isBillingAddressDataDirty ||
779
+ isTaxIdDirty ||
780
+ isCompanyNameDirty);
781
+ };
782
+ const buildAddressForPartyCreate = ({ address, firstName, lastName, name, phone, }) => {
783
+ const _firstName = (name === null || name === void 0 ? void 0 : name.split(' ')[0]) || firstName || '';
784
+ const _lastName = (name === null || name === void 0 ? void 0 : name.split(' ')[1]) || lastName || '';
785
+ if (!_firstName || !_lastName) {
786
+ void sendErrorLog({
787
+ endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
788
+ errors: ['No name found'],
789
+ metadata: {
790
+ allLogs,
791
+ cartId: window.Zonos.cartId,
792
+ checkoutSessionId: storageStore.checkoutSessionId,
793
+ firstName,
794
+ lastName,
795
+ name,
796
+ },
797
+ });
798
+ }
799
+ if (!phone) {
800
+ void sendErrorLog({
801
+ endpoint: 'PARTY_CREATE_NO_PHONE_FOUND',
802
+ errors: ['No phone found'],
803
+ metadata: {
804
+ allLogs,
805
+ cartId: window.Zonos.cartId,
806
+ checkoutSessionId: storageStore.checkoutSessionId,
807
+ phone,
808
+ },
809
+ });
810
+ }
811
+ return {
812
+ city: address.city,
813
+ country: address.country,
814
+ firstName: _firstName,
815
+ lastName: _lastName,
816
+ line1: address.line1,
817
+ line2: address.line2,
818
+ phone: phone || '',
819
+ postal_code: address.postal_code,
820
+ state: address.state,
821
+ };
822
+ };
823
+ const stripeStoreAsyncAddressUpdate = async () => {
824
+ var _a, _b, _c, _d;
825
+ if (!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) ||
826
+ (!stripeStore.stripeShippingSameAsBilling &&
827
+ !((_b = stripeStore.stripeBillingAddressEventData) === null || _b === void 0 ? void 0 : _b.complete)) ||
828
+ !stripeStore.stripeBillingAddressEventData) {
829
+ return {
830
+ partiesCreated: false,
831
+ };
832
+ }
833
+ // If there is no landed cost data, no need to create parties
834
+ if (!cartStore.landedCostData) {
835
+ return {
836
+ partiesCreated: false,
837
+ };
838
+ }
839
+ const firstLandedCostRootId = (_c = cartStore.landedCostData.find(Boolean)) === null || _c === void 0 ? void 0 : _c.landedCost.rootId;
840
+ if (!firstLandedCostRootId) {
841
+ // do nothing if we don't have selected landed cost
842
+ void sendErrorLog({
843
+ endpoint: 'PF_NO_SELECTED_LANDED_COST',
844
+ errors: ['No selected landed cost'],
845
+ metadata: {
846
+ allLogs,
847
+ cartId: window.Zonos.cartId,
848
+ checkoutSessionId: storageStore.checkoutSessionId,
849
+ },
850
+ });
851
+ return {
852
+ partiesCreated: false,
853
+ };
854
+ }
855
+ const isAddressOutdated = checkIsAddressOutdatedForAsyncAddressUpdate();
856
+ if (!isAddressOutdated) {
857
+ return {
858
+ partiesCreated: false,
859
+ };
860
+ }
861
+ const address = buildAddressForPartyCreate({
862
+ address: stripeStore.stripeAddressEventData.value.address,
863
+ firstName: stripeStore.stripeAddressEventData.value.firstName,
864
+ lastName: stripeStore.stripeAddressEventData.value.lastName,
865
+ name: stripeStore.stripeAddressEventData.value.name,
866
+ phone: stripeStore.stripeAddressEventData.value.phone,
867
+ });
868
+ const billingAddress = stripeStore.stripeShippingSameAsBilling
869
+ ? address
870
+ : buildAddressForPartyCreate({
871
+ address: stripeStore.stripeBillingAddressEventData.value.address,
872
+ firstName: stripeStore.stripeBillingAddressEventData.value.firstName,
873
+ lastName: stripeStore.stripeBillingAddressEventData.value.lastName,
874
+ name: stripeStore.stripeBillingAddressEventData.value.name,
875
+ phone: stripeStore.stripeBillingAddressEventData.value.phone,
876
+ });
877
+ const isE2ETest = new URLSearchParams(window.location.search).get('zonosE2ETest') === '1';
878
+ const { errors, json } = await handleFetch('/api/zonos-elements/create-parties', {
879
+ body: {
880
+ address,
881
+ billingAddress,
882
+ companyName: stripeStore.companyName,
883
+ email: ((_d = stripeStore.stripeLinkEventData) === null || _d === void 0 ? void 0 : _d.value.email) || '',
884
+ isTest: isE2ETest,
885
+ rootId: firstLandedCostRootId,
886
+ taxId: stripeStore.taxId,
887
+ },
888
+ method: 'POST',
889
+ });
890
+ if (errors.length || !json) {
891
+ logError('Error occurs when creating parties', JSON.stringify(errors, null, 2));
892
+ void sendErrorLog({
893
+ endpoint: 'PF_PARTY_CREATE_FAILED',
894
+ errors: ['Failed to create parties'],
895
+ metadata: {
896
+ allLogs,
897
+ cartId: window.Zonos.cartId,
898
+ checkoutSessionId: storageStore.checkoutSessionId,
899
+ errors,
900
+ json,
901
+ },
902
+ });
903
+ return {
904
+ partiesCreated: false,
905
+ };
906
+ }
907
+ stripeStore.companyNameUsedWhenAsyncAddressUpdate = stripeStore.companyName;
908
+ stripeStore.stripeAddressUsedWhenAsyncAddressUpdate =
909
+ stripeStore.stripeAddressEventData;
910
+ stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate =
911
+ stripeStore.stripeBillingAddressEventData;
912
+ stripeStore.taxIdUsedWhenAsyncAddressUpdate = stripeStore.taxId;
913
+ stripeStore.partyBillingId = json.billToPartyId;
914
+ stripeStore.partyShippingId = json.shipToPartyId;
915
+ return {
916
+ partiesCreated: true,
917
+ };
918
+ };
919
+ /**
920
+ * Extract only the necessary address info for landed cost prefetch
921
+ */
922
+ const buildAddressForLCPrefetch = (address) => {
923
+ return {
924
+ countryCode: address.address.country,
925
+ postalCode: address.address.postal_code,
926
+ state: address.address.state,
927
+ };
928
+ };
929
+ const checkIsAddressOutdatedForLCPrefetch = () => {
930
+ var _a, _b;
931
+ const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
932
+ JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
933
+ const isAddressDataDirty = stripeStore.stripeAddressEventData &&
934
+ JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeAddressEventData.value)) !== JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC);
935
+ const isBillingAddressDataDirty = !stripeStore.stripeShippingSameAsBilling &&
936
+ stripeStore.stripeBillingAddressEventData &&
937
+ JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeBillingAddressEventData.value)) !== JSON.stringify(stripeStore.stripeBillingAddressUsedWhenFetchingLC);
769
938
  return isLinkDataDirty || isAddressDataDirty || isBillingAddressDataDirty;
770
939
  };
771
940
  /**
@@ -779,14 +948,64 @@ const isPrefetchInfoOutdated = () => {
779
948
  ((_a = cartStore.landedCostData.find(Boolean)) === null || _a === void 0 ? void 0 : _a.subtotals.items) !==
780
949
  cartStore.subtotal;
781
950
  const isAddressOutdated = checkIsAddressOutdatedForLCPrefetch();
782
- // Auto prefetch landed cost if tax id is updated
783
- const isTaxIdDirty = stripeStore.taxIdUsedWhenFetchingLC !== stripeStore.taxId;
951
+ log('isPrefetchInfoOutdated', 'info', {
952
+ isAddressOutdated,
953
+ });
784
954
  return (
785
955
  // if landed cost data is not available, we need to fetch it
786
- !cartStore.landedCostData ||
956
+ (!cartStore.landedCostData && !stripeStore.isFetchingLandedCost) ||
787
957
  isAddressOutdated ||
788
- isTotalAmountChanged ||
789
- isTaxIdDirty);
958
+ isTotalAmountChanged);
959
+ };
960
+ const getCountryField = (country) => {
961
+ var _a, _b;
962
+ const countryFieldLabels = (_a = zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.countryFields;
963
+ const stripeCountryFieldLabels = (_b = zonosStore.genericSettings) === null || _b === void 0 ? void 0 : _b.stripeCountryFieldLabels;
964
+ const stripeFoundCountryField = stripeCountryFieldLabels && country in stripeCountryFieldLabels
965
+ ? stripeCountryFieldLabels[country]
966
+ : null;
967
+ const zonosFoundCountryField = countryFieldLabels && country in countryFieldLabels
968
+ ? countryFieldLabels[country]
969
+ : null;
970
+ /**
971
+ * If the address form is using Stripe component, use Stripe country field label if there is one, if not just use one from our countryFieldLabel data
972
+ * stripeCountryFieldLabels is the list we collect from Stripe, and extract only country that state/zip is required and different from what we have in our countryFieldLabel data
973
+ **/
974
+ if (cartStore.addressFormRenderType === 'stripe') {
975
+ return stripeFoundCountryField || zonosFoundCountryField;
976
+ }
977
+ return zonosFoundCountryField;
978
+ };
979
+ const isAddressReadyToRequestLandedCost = () => {
980
+ var _a, _b, _c, _d;
981
+ const linkReady = !!((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.complete);
982
+ const shippingAddressReady = !!((_b = stripeStore.stripeAddressEventData) === null || _b === void 0 ? void 0 : _b.complete);
983
+ const billingAddressReady = stripeStore.stripeShippingSameAsBilling
984
+ ? shippingAddressReady
985
+ : !!((_c = stripeStore.stripeBillingAddressEventData) === null || _c === void 0 ? void 0 : _c.complete);
986
+ const shipToCountry = ((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value.address.country) || 'US';
987
+ const countryField = getCountryField(shipToCountry);
988
+ // Only send landed cost request if the address is complete when we can't get the country field
989
+ if (!countryField || !stripeStore.stripeAddressEventData) {
990
+ return shippingAddressReady && billingAddressReady && linkReady;
991
+ }
992
+ const isValidLine1 = stripeStore.stripeAddressEventData.value.address.line1.length > 0;
993
+ const isValidName = stripeStore.stripeAddressEventData.value.firstName &&
994
+ stripeStore.stripeAddressEventData.value.lastName;
995
+ const isStateValid = !countryField.stateRequired ||
996
+ (countryField.stateRequired &&
997
+ stripeStore.stripeAddressEventData.value.address.state.length > 0);
998
+ const isPostalCodeValid = !countryField.zipRequired ||
999
+ (countryField.zipRequired &&
1000
+ stripeStore.stripeAddressEventData.value.address.postal_code.length >= 3);
1001
+ const hasPhoneNumber = stripeStore.stripeAddressEventData.value.phone &&
1002
+ stripeStore.stripeAddressEventData.value.phone.length > 0;
1003
+ return (linkReady &&
1004
+ isValidName &&
1005
+ isValidLine1 &&
1006
+ isStateValid &&
1007
+ isPostalCodeValid &&
1008
+ hasPhoneNumber);
790
1009
  };
791
1010
  const stripeCalculateLandedCost = async () => {
792
1011
  var _a;
@@ -835,26 +1054,27 @@ const stripeCalculateLandedCost = async () => {
835
1054
  }
836
1055
  };
837
1056
  const stripeStorePrefetchLandedCost = async (params) => {
838
- var _a, _b, _c, _d, _e, _f, _g, _h;
1057
+ var _a, _b, _c, _d;
839
1058
  const retries = (params === null || params === void 0 ? void 0 : params.retries) || 0;
840
1059
  const applyingPromocode = !!(params === null || params === void 0 ? void 0 : params.applyingPromocode);
841
- const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
842
- const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
843
- const stripeBillingAddressReady = stripeStore.stripeShippingSameAsBilling
844
- ? !!((_c = stripeStore.stripeLinkEventData) === null || _c === void 0 ? void 0 : _c.complete)
845
- : !!((_d = stripeStore.stripeBillingAddressEventData) === null || _d === void 0 ? void 0 : _d.complete);
846
1060
  const shouldRefetch = isPrefetchInfoOutdated();
1061
+ const isRequestReadyToPrefetch = isAddressReadyToRequestLandedCost();
1062
+ // Should not do anything if the address is not ready to request landed cost
1063
+ if (!isRequestReadyToPrefetch) {
1064
+ return {
1065
+ isRequestNotReady: true,
1066
+ };
1067
+ }
847
1068
  if (shouldRefetch) {
848
1069
  // if the info used when fetching landed cost is different from the current info, abort the previous request
849
- (_e = stripeStore.fetchingLandedCostAbortController) === null || _e === void 0 ? void 0 : _e.abort();
1070
+ (_a = stripeStore.fetchingLandedCostAbortController) === null || _a === void 0 ? void 0 : _a.abort();
850
1071
  stripeStore.fetchingLandedCostAbortController = null;
851
1072
  }
852
1073
  // Do not fetch if we are not ready or data is not outdated
853
- if ((!shouldRefetch && !applyingPromocode) ||
854
- !stripeAddressReady ||
855
- !stripeLinkReady ||
856
- !stripeBillingAddressReady) {
857
- return;
1074
+ if (!shouldRefetch && !applyingPromocode) {
1075
+ return {
1076
+ isRequestNotReady: false,
1077
+ };
858
1078
  }
859
1079
  // If there is retries, stop loading for a moment and then showing the spinner again (this is just so customer can see that checkout is doing something and not stuck)
860
1080
  if (retries) {
@@ -867,24 +1087,31 @@ const stripeStorePrefetchLandedCost = async (params) => {
867
1087
  stripeStore.isFetchingLandedCost = true;
868
1088
  }
869
1089
  if (stripeStore.stripeAddressEventData) {
870
- stripeStore.stripeAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeAddressEventData);
1090
+ stripeStore.stripeAddressUsedWhenFetchingLC = {
1091
+ countryCode: stripeStore.stripeAddressEventData.value.address.country,
1092
+ postalCode: stripeStore.stripeAddressEventData.value.address.postal_code,
1093
+ state: stripeStore.stripeAddressEventData.value.address.state,
1094
+ };
871
1095
  }
872
1096
  if (stripeStore.stripeBillingAddressEventData) {
873
- stripeStore.stripeBillingAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeBillingAddressEventData);
1097
+ stripeStore.stripeBillingAddressUsedWhenFetchingLC = {
1098
+ countryCode: stripeStore.stripeBillingAddressEventData.value.address.country,
1099
+ postalCode: stripeStore.stripeBillingAddressEventData.value.address.postal_code,
1100
+ state: stripeStore.stripeBillingAddressEventData.value.address.state,
1101
+ };
874
1102
  }
875
1103
  if (stripeStore.stripeLinkEventData) {
876
1104
  stripeStore.stripeLinkUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeLinkEventData);
877
1105
  }
878
- stripeStore.taxIdUsedWhenFetchingLC = stripeStore.taxId;
879
1106
  try {
880
1107
  // Reset cart items to non-restricted state and restricted item list
881
1108
  cartStoreResetCartItems();
882
1109
  // fetch and apply landed cost
883
1110
  await stripeCalculateLandedCost();
884
1111
  // This is the cheapest service level since we already sorted them after fetching landed cost
885
- const cheapestServiceLevel = (_f = cartStore.shippingData) === null || _f === void 0 ? void 0 : _f.find(Boolean);
1112
+ const cheapestServiceLevel = (_b = cartStore.shippingData) === null || _b === void 0 ? void 0 : _b.find(Boolean);
886
1113
  // Landed cost that matches with service level
887
- const matchLandedCost = (_g = cartStore.landedCostData) === null || _g === void 0 ? void 0 : _g.find(x => x.landedCost.shipmentRating.id === (cheapestServiceLevel === null || cheapestServiceLevel === void 0 ? void 0 : cheapestServiceLevel.id));
1114
+ const matchLandedCost = (_c = cartStore.landedCostData) === null || _c === void 0 ? void 0 : _c.find(x => x.landedCost.shipmentRating.id === (cheapestServiceLevel === null || cheapestServiceLevel === void 0 ? void 0 : cheapestServiceLevel.id));
888
1115
  // apply new subtotal and total, this is mainly to show items in the presentment currency
889
1116
  const subtotals = !!matchLandedCost ? matchLandedCost.subtotals : null;
890
1117
  if (subtotals) {
@@ -908,9 +1135,11 @@ const stripeStorePrefetchLandedCost = async (params) => {
908
1135
  if (retries < 1) {
909
1136
  // retry fetching landed cost one more time
910
1137
  await stripeStorePrefetchLandedCost(Object.assign(Object.assign({}, params), { retries: (retries || 0) + 1 }));
911
- return;
1138
+ return {
1139
+ isRequestNotReady: false,
1140
+ };
912
1141
  }
913
- const shipToAddress = (_h = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _h === void 0 ? void 0 : _h.value;
1142
+ const shipToAddress = (_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value;
914
1143
  void sendErrorLog({
915
1144
  endpoint: `Failed to fetch landed cost (${retries} retries)`,
916
1145
  errors: [err.message],
@@ -923,6 +1152,9 @@ const stripeStorePrefetchLandedCost = async (params) => {
923
1152
  logError(err);
924
1153
  }
925
1154
  stripeStore.isFetchingLandedCost = false;
1155
+ return {
1156
+ isRequestNotReady: false,
1157
+ };
926
1158
  };
927
1159
  const stripeStoreApplyPromoCode = async () => {
928
1160
  var _a, _b;
@@ -933,6 +1165,8 @@ const stripeStoreApplyPromoCode = async () => {
933
1165
  if (cartStore.step === 'payment') {
934
1166
  cartStorePreviousStep();
935
1167
  }
1168
+ // async update address with new root id from the new quote
1169
+ await stripeStoreAsyncAddressUpdate();
936
1170
  // This is the cheapest service level since we already sorted them after fetching landed cost
937
1171
  const cheapestServiceLevel = (_a = cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.find(Boolean);
938
1172
  // Landed cost that matches with service level
@@ -1175,18 +1409,6 @@ const getCheckoutSessionBody = () => {
1175
1409
  key: 'language',
1176
1410
  value: localizationStore.selectedLocale,
1177
1411
  },
1178
- {
1179
- key: 'appVersion',
1180
- value: window.Zonos.version,
1181
- },
1182
- {
1183
- key: 'appVersionNpmIntegration',
1184
- value: window.Zonos.isNpm ? '1' : '0',
1185
- },
1186
- {
1187
- key: 'legacyCheckoutFacade',
1188
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
1189
- },
1190
1412
  ],
1191
1413
  presentmentCountryCode: localizationStore.selectedCountryCode,
1192
1414
  skipPaymentIntent: stripeStore.skipPaymentIntent,
@@ -1323,6 +1545,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1323
1545
  const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session', {
1324
1546
  body: {
1325
1547
  adjustmentsAmount,
1548
+ billToPartyId: stripeStore.partyBillingId,
1326
1549
  cartId,
1327
1550
  currency,
1328
1551
  customerAuthenticationToken: cartStore.customerAuthenticationToken || undefined,
@@ -1334,20 +1557,9 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1334
1557
  key: 'language',
1335
1558
  value: localizationStore.selectedLocale,
1336
1559
  },
1337
- {
1338
- key: 'appVersion',
1339
- value: window.Zonos.version,
1340
- },
1341
- {
1342
- key: 'appVersionNpmIntegration',
1343
- value: window.Zonos.isNpm ? '1' : '0',
1344
- },
1345
- {
1346
- key: 'legacyCheckoutFacade',
1347
- value: window.Zonos.isLegacyCheckout ? '1' : '0',
1348
- },
1349
1560
  ],
1350
1561
  presentmentCountryCode,
1562
+ shipToPartyId: stripeStore.partyShippingId,
1351
1563
  skipPaymentIntent: stripeStore.skipPaymentIntent,
1352
1564
  varianceTestInput,
1353
1565
  },
@@ -1488,7 +1700,8 @@ stripeStoreOnChange('clientSecret', clientSecret => {
1488
1700
  }
1489
1701
  });
1490
1702
 
1491
- const { reset, state: cartStore } = createStore(() => ({
1703
+ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(() => ({
1704
+ addressFormRenderType: 'stripe',
1492
1705
  adjustmentTotal: 0,
1493
1706
  adjustments: [],
1494
1707
  checkoutSession: null,
@@ -1703,12 +1916,14 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
1703
1916
  }
1704
1917
  const { errors, json } = await stripeStoreUpdateCheckoutSession({
1705
1918
  adjustmentsAmount,
1919
+ billToPartyId: stripeStore.partyBillingId,
1706
1920
  cartId,
1707
1921
  currency,
1708
1922
  id: storageStore.checkoutSessionId,
1709
1923
  itemsAmount,
1710
1924
  landedCostId,
1711
1925
  presentmentCountryCode: localizationStore.selectedCountryCode,
1926
+ shipToPartyId: stripeStore.partyShippingId,
1712
1927
  varianceTestInput: storageStore.enabledVariantTestKeys || [],
1713
1928
  });
1714
1929
  if (errors.length > 0 || !json) {
@@ -1792,9 +2007,11 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
1792
2007
  // update session with selected landed cost
1793
2008
  const updateCalculateStatus = await cartStoreReCalculateTotal({
1794
2009
  adjustmentsAmount: cartStore.adjustmentTotal,
2010
+ billToPartyId: stripeStore.partyBillingId,
1795
2011
  cartId: window.Zonos.cartId,
1796
2012
  dutiesTaxesFeesEstimate: dutiesTaxesFeesEstimate,
1797
2013
  landedCostId: (_f = selectedLandedCost.landedCost) === null || _f === void 0 ? void 0 : _f.id,
2014
+ shipToPartyId: stripeStore.partyShippingId,
1798
2015
  varianceTestInput: storageStore.enabledVariantTestKeys || [],
1799
2016
  });
1800
2017
  // update conditionally render pay in USD button
@@ -1857,10 +2074,12 @@ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
1857
2074
  stripeStore.isFetchingSession = true;
1858
2075
  await cartStoreReCalculateTotal({
1859
2076
  adjustmentsAmount: adjustmentTotal,
2077
+ billToPartyId: stripeStore.partyBillingId,
1860
2078
  cartId: window.Zonos.cartId,
1861
2079
  currency: currency,
1862
2080
  dutiesTaxesFeesEstimate: 0,
1863
2081
  itemsAmount: total,
2082
+ shipToPartyId: stripeStore.partyShippingId,
1864
2083
  // attempt to init session on failure to update checkout session
1865
2084
  shouldInitSessionOnFailure: true,
1866
2085
  varianceTestInput: storageStore.enabledVariantTestKeys || [],
@@ -1916,4 +2135,4 @@ const cartStoreResetTabItems = () => {
1916
2135
  cartStoreResetSelectedShippingOption();
1917
2136
  };
1918
2137
 
1919
- export { cartStoreHasOneEligibleItem as A, stripeStoreApplyPromoCode as B, stripeStoreRemovePromoCode as C, stripeStoreResetPromoCode as D, stripeStoreMessageBasedOnStatus as E, stripeStoreTranslateAddressToLatin as F, cartStoreUpdateSelectedShippingOption as G, cartStoreGetShippingTransitInfo as H, sortServiceLevelOptionsByAmount as I, cartStoreGetMethod as J, stripeStoreCleanupDomesticShippingSession as a, stripeStoreSaveDomesticShippingSession as b, stripeStore as c, stripeStoreRetrievePayment as d, cartStore as e, cartStoreUpdateItems as f, cartStoreReset as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStoreInitCheckoutSession as k, stripeStoreGetPaymentIntent as l, cartStoreStartCheckoutInterval as m, getCheckoutSessionBody as n, cartStoreUpdateToErrorState as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreUpdateCheckoutSessionBaseCurrency as u, stripeStoreHandleInventoryCheck as v, stripeStoreConfirmPayment as w, stripeStoreHandleInventoryRefund as x, stripeStoreReset as y, validateCheckoutSession as z };
2138
+ export { cartStoreHasOneEligibleItem as A, stripeStoreApplyPromoCode as B, stripeStoreRemovePromoCode as C, stripeStoreResetPromoCode as D, stripeStoreMessageBasedOnStatus as E, stripeStoreTranslateAddressToLatin as F, cartStoreOnChange as G, stripeStoreAsyncAddressUpdate as H, cartStoreUpdateSelectedShippingOption as I, cartStoreGetShippingTransitInfo as J, sortServiceLevelOptionsByAmount as K, cartStoreGetMethod as L, stripeStoreCleanupDomesticShippingSession as a, stripeStoreSaveDomesticShippingSession as b, stripeStore as c, stripeStoreRetrievePayment as d, cartStore as e, cartStoreUpdateItems as f, cartStoreReset as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStoreInitCheckoutSession as k, stripeStoreGetPaymentIntent as l, cartStoreStartCheckoutInterval as m, getCheckoutSessionBody as n, cartStoreUpdateToErrorState as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreUpdateCheckoutSessionBaseCurrency as u, stripeStoreHandleInventoryCheck as v, stripeStoreConfirmPayment as w, stripeStoreHandleInventoryRefund as x, stripeStoreReset as y, validateCheckoutSession as z };
@@ -1,4 +1,4 @@
1
- import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1 } from './zonosStore-1e015fa5.js';
1
+ import { _ as _root, b as _baseGetTag, i as isObjectLike_1, d as isObject_1 } from './zonosStore-00975763.js';
2
2
 
3
3
  var root = _root;
4
4
 
@@ -1,4 +1,4 @@
1
- import { z as zonosStore } from './zonosStore-1e015fa5.js';
1
+ import { z as zonosStore } from './zonosStore-00975763.js';
2
2
 
3
3
  /**
4
4
  * Get the border radius for the elements based on the style
@@ -35,11 +35,6 @@ const log = (message, type, ..._additionalInfo) => {
35
35
  !!window.location.search.match(/\?.*(&*)zonosDebug=1/);
36
36
  // if debug is false, do not log
37
37
  if (!isDebug) {
38
- // log errors to the console if the type is error
39
- if (type === 'error') {
40
- // eslint-disable-next-line no-console
41
- console.error(message, ...additionalInfo);
42
- }
43
38
  return;
44
39
  }
45
40
  let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
@@ -432,12 +427,13 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
432
427
  }
433
428
  const nextFallbackApiType = getNextFallbackApiType(basePathType);
434
429
  const unknownError = errors.find(({ type }) => type === 'unknown');
430
+ const isAbortError = errors.find(({ message }) => message.includes('signal is aborted'));
435
431
  const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
436
432
  const shouldCallFallback =
437
433
  // If next fallback is available, and the error is unknown (Failed to fetch) or 404
438
434
  nextFallbackApiType && isUnknownError;
439
435
  // Should log the error if it's unknown error
440
- if (isUnknownError) {
436
+ if (isUnknownError || isAbortError) {
441
437
  void sendErrorLog({
442
438
  endpoint: fallbackApiList[basePathType] + path,
443
439
  errors: errors.map(({ message }) => `API: ${message}`),