@zonos/elements 1.3.208 → 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 (215) hide show
  1. package/dist/cjs/{cart-47c17ebf.js → cart-2ec8cac2.js} +285 -40
  2. package/dist/cjs/{debounce-0b9c0f8a.js → debounce-465a4328.js} +1 -1
  3. package/dist/cjs/{getBorderRadius-c424eb05.js → getBorderRadius-1b5e33cf.js} +1 -1
  4. package/dist/cjs/{handleFetch-969d05d8.js → handleFetch-05227713.js} +2 -6
  5. package/dist/cjs/index.cjs.js +8 -8
  6. package/dist/cjs/{isDarkColor-35e8daec.js → isDarkColor-428965f4.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{localization-e9089be5.js → localization-9b43376c.js} +2 -2
  9. package/dist/cjs/{paypal-3a803d21.js → paypal-6449314e.js} +5 -5
  10. package/dist/cjs/{updateCheckoutSessionAttributes-d0332530.js → updateCheckoutSessionAttributes-a31bb681.js} +2 -2
  11. package/dist/cjs/zonos-address_11.cjs.entry.js +104 -84
  12. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  15. package/dist/cjs/zonos-card.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +91 -41
  17. package/dist/cjs/zonos-checkout.cjs.entry.js +45 -21
  18. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  20. package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -3
  21. package/dist/cjs/zonos-country-select_4.cjs.entry.js +13 -9
  22. package/dist/cjs/zonos-elements.cjs.js +1 -1
  23. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +7 -7
  24. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  25. package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  27. package/dist/cjs/zonos-language-select_2.cjs.entry.js +3 -3
  28. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  29. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  30. package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
  31. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  32. package/dist/cjs/zonos-toggle.cjs.entry.js +1 -1
  33. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  34. package/dist/cjs/{zonosStore-7c1e1bc1.js → zonosStore-f8ee56aa.js} +1 -0
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +36 -12
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +63 -25
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +33 -11
  38. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +2 -2
  39. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +9 -5
  40. package/dist/collection/components/store/checkout/cart.js +9 -2
  41. package/dist/collection/components/store/checkout/stripe.js +266 -31
  42. package/dist/collection/components/stripe/zonos-address/zonos-address.css +2 -1
  43. package/dist/collection/components/stripe/zonos-address/zonos-address.js +24 -3
  44. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +2 -1
  45. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +7 -5
  46. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +3 -2
  47. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +2 -2
  48. package/dist/collection/components/utils/handleFetch.js +2 -1
  49. package/dist/collection/components/utils/logging/log.js +0 -5
  50. package/dist/collection/types/checkout/api/CreateParty.js +1 -0
  51. package/dist/collection/types/generated/graphql.internal.types.js +3 -0
  52. package/dist/collection/types/index.js +1 -0
  53. package/dist/esm/{cart-5b417c0d.js → cart-2f84f632.js} +284 -41
  54. package/dist/esm/{debounce-7ebfa15b.js → debounce-0e42da22.js} +1 -1
  55. package/dist/esm/{getBorderRadius-174305ff.js → getBorderRadius-71b3b8ab.js} +1 -1
  56. package/dist/esm/{handleFetch-621e45bc.js → handleFetch-7dd4622b.js} +2 -6
  57. package/dist/esm/index.js +8 -8
  58. package/dist/esm/{isDarkColor-915b06b8.js → isDarkColor-3a9d6108.js} +1 -1
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/{localization-669a1714.js → localization-e17c211b.js} +2 -2
  61. package/dist/esm/{paypal-3a0cf86b.js → paypal-1cf701aa.js} +6 -6
  62. package/dist/esm/{updateCheckoutSessionAttributes-183ca6c1.js → updateCheckoutSessionAttributes-5097e715.js} +2 -2
  63. package/dist/esm/zonos-address_11.entry.js +104 -84
  64. package/dist/esm/zonos-badge.entry.js +1 -1
  65. package/dist/esm/zonos-banner.entry.js +1 -1
  66. package/dist/esm/zonos-button_3.entry.js +3 -3
  67. package/dist/esm/zonos-card.entry.js +2 -2
  68. package/dist/esm/zonos-cart-items_14.entry.js +91 -41
  69. package/dist/esm/zonos-checkout.entry.js +45 -21
  70. package/dist/esm/zonos-collapse.entry.js +1 -1
  71. package/dist/esm/zonos-controller.entry.js +6 -6
  72. package/dist/esm/zonos-country-flag.entry.js +3 -3
  73. package/dist/esm/zonos-country-select_4.entry.js +13 -9
  74. package/dist/esm/zonos-elements.js +1 -1
  75. package/dist/esm/zonos-empty-state-payment_4.entry.js +7 -7
  76. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  77. package/dist/esm/zonos-hello.entry.js +4 -4
  78. package/dist/esm/zonos-input.entry.js +2 -2
  79. package/dist/esm/zonos-language-select_2.entry.js +3 -3
  80. package/dist/esm/zonos-logo.entry.js +1 -1
  81. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  82. package/dist/esm/zonos-stripe-input.entry.js +3 -3
  83. package/dist/esm/zonos-text.entry.js +1 -1
  84. package/dist/esm/zonos-toggle.entry.js +1 -1
  85. package/dist/esm/zonos-v-stack.entry.js +1 -1
  86. package/dist/esm/{zonosStore-504a7030.js → zonosStore-00975763.js} +1 -1
  87. package/dist/esm-es5/cart-2f84f632.js +1 -0
  88. package/dist/esm-es5/{debounce-7ebfa15b.js → debounce-0e42da22.js} +1 -1
  89. package/dist/esm-es5/{getBorderRadius-174305ff.js → getBorderRadius-71b3b8ab.js} +1 -1
  90. package/dist/esm-es5/handleFetch-7dd4622b.js +1 -0
  91. package/dist/esm-es5/index.js +1 -1
  92. package/dist/esm-es5/{isDarkColor-915b06b8.js → isDarkColor-3a9d6108.js} +1 -1
  93. package/dist/esm-es5/loader.js +1 -1
  94. package/dist/esm-es5/{localization-669a1714.js → localization-e17c211b.js} +1 -1
  95. package/dist/esm-es5/{paypal-3a0cf86b.js → paypal-1cf701aa.js} +2 -2
  96. package/dist/esm-es5/{updateCheckoutSessionAttributes-183ca6c1.js → updateCheckoutSessionAttributes-5097e715.js} +1 -1
  97. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  98. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  99. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  100. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  101. package/dist/esm-es5/zonos-card.entry.js +1 -1
  102. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  103. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  104. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  105. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  106. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  107. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  108. package/dist/esm-es5/zonos-elements.js +1 -1
  109. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  110. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  111. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  112. package/dist/esm-es5/zonos-input.entry.js +1 -1
  113. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  114. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  115. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  116. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  117. package/dist/esm-es5/zonos-text.entry.js +1 -1
  118. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  119. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  120. package/dist/esm-es5/{zonosStore-504a7030.js → zonosStore-00975763.js} +1 -1
  121. package/dist/scripts/index.d.ts +8 -0
  122. package/dist/scripts/index.js +1 -1
  123. package/dist/scripts/loadZonos.js +1 -1
  124. package/dist/scripts/zonos.js +1 -1
  125. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +8 -4
  126. package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +3 -0
  127. package/dist/types/components/common/zonos-country-select/zonos-country-select.d.ts +1 -0
  128. package/dist/types/components/store/checkout/cart.d.ts +6 -2
  129. package/dist/types/components/store/checkout/stripe.d.ts +33 -6
  130. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +6 -0
  131. package/dist/types/types/checkout/api/CheckoutSession.d.ts +2 -0
  132. package/dist/types/types/checkout/api/CreateParty.d.ts +34 -0
  133. package/dist/types/types/generated/graphql.internal.types.d.ts +21 -5
  134. package/dist/types/types/generated/graphql.internal.types.ts +26 -3
  135. package/dist/types/types/index.d.ts +1 -0
  136. package/dist/types/types/utils/ZonosSettings.d.ts +6 -0
  137. package/dist/zonos-elements/index.esm.js +1 -1
  138. package/dist/zonos-elements/{p-c5455a34.system.js → p-0751b878.system.js} +1 -1
  139. package/dist/zonos-elements/{p-39039ab7.system.entry.js → p-08b29f73.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-0731fbba.entry.js → p-0ca1d6dd.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-e1c2b8f8.entry.js → p-144b5006.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-d5bdbbb3.system.js → p-19182dc7.system.js} +1 -1
  143. package/dist/zonos-elements/{p-066afca1.system.entry.js → p-1dc78af3.system.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-5f2a2ca7.js → p-207bd04a.js} +1 -1
  145. package/dist/zonos-elements/p-20839c46.js +1 -0
  146. package/dist/zonos-elements/{p-63ca1242.system.entry.js → p-2122d2cc.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-a09bdd20.system.entry.js → p-239695e8.system.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-6b406abd.entry.js → p-23fe7661.entry.js} +1 -1
  149. package/dist/zonos-elements/p-2652198d.js +1 -0
  150. package/dist/zonos-elements/p-30a9f802.system.entry.js +1 -0
  151. package/dist/zonos-elements/{p-4451a598.system.js → p-3633a952.system.js} +1 -1
  152. package/dist/zonos-elements/{p-6be43ba8.entry.js → p-36b686b6.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-b7a5b367.js → p-371d91d1.js} +2 -2
  154. package/dist/zonos-elements/{p-081fa4a8.entry.js → p-3934b38a.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-a4d995a2.system.js → p-3c752420.system.js} +1 -1
  156. package/dist/zonos-elements/p-3ee44728.system.js +1 -1
  157. package/dist/zonos-elements/{p-7f568108.system.js → p-44c0a584.system.js} +2 -2
  158. package/dist/zonos-elements/{p-cd376c7a.system.entry.js → p-45a2f9b1.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-0d908c15.system.js → p-4a1b4a2d.system.js} +1 -1
  160. package/dist/zonos-elements/p-4c70fd75.entry.js +1 -0
  161. package/dist/zonos-elements/{p-07905246.entry.js → p-4d62f3de.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-bb850bb7.entry.js → p-4dbaa2c2.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-0fb14108.entry.js → p-4ed73ff8.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-ef594c0c.entry.js → p-4f5513dc.entry.js} +1 -1
  165. package/dist/zonos-elements/p-542acc2c.js +1 -0
  166. package/dist/zonos-elements/p-5711e187.system.js +1 -0
  167. package/dist/zonos-elements/{p-c607d026.entry.js → p-5956a9e0.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-d096d7f2.entry.js → p-5b7686f8.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-67f807bc.entry.js → p-63a4dac5.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-51d596a0.system.entry.js → p-695bf400.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-d35d17f3.js → p-6aa728f2.js} +1 -1
  172. package/dist/zonos-elements/{p-4bf54953.js → p-71c6bdc3.js} +1 -1
  173. package/dist/zonos-elements/{p-0f368368.system.js → p-738a49c0.system.js} +1 -1
  174. package/dist/zonos-elements/{p-7e346632.system.entry.js → p-74276b82.system.entry.js} +1 -1
  175. package/dist/zonos-elements/{p-d1a31577.entry.js → p-77e22be4.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-a3a8ba10.entry.js → p-78dd1c53.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-3d6f6367.system.entry.js → p-7f9bbbb3.system.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-ea30d92d.system.entry.js → p-896f2358.system.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-a63bac79.system.entry.js → p-8f41d864.system.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-1f706fc9.system.entry.js → p-964e2587.system.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-1530f958.system.entry.js → p-97831744.system.entry.js} +1 -1
  182. package/dist/zonos-elements/{p-160da12a.system.entry.js → p-9d95c896.system.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-4f04b499.entry.js → p-a24870af.entry.js} +1 -1
  184. package/dist/zonos-elements/p-a411ce2a.system.js +1 -0
  185. package/dist/zonos-elements/{p-5c772fab.system.entry.js → p-a4686344.system.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-a158b406.js → p-a6f77d44.js} +1 -1
  187. package/dist/zonos-elements/{p-fc3a6495.entry.js → p-a8f421ac.entry.js} +1 -1
  188. package/dist/zonos-elements/{p-da304b78.entry.js → p-aa40d402.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-6c991320.entry.js → p-ad1e1dbc.entry.js} +1 -1
  190. package/dist/zonos-elements/p-b1bfeec9.system.entry.js +1 -0
  191. package/dist/zonos-elements/{p-ab6efb03.system.entry.js → p-baa88176.system.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-963fa567.system.entry.js → p-bf9cb85f.system.entry.js} +1 -1
  193. package/dist/zonos-elements/p-bfdb4e7a.entry.js +1 -0
  194. package/dist/zonos-elements/{p-803e59d2.system.entry.js → p-c345b306.system.entry.js} +1 -1
  195. package/dist/zonos-elements/{p-a958c4f0.system.entry.js → p-d1697144.system.entry.js} +1 -1
  196. package/dist/zonos-elements/p-d1c0bf92.entry.js +1 -0
  197. package/dist/zonos-elements/{p-b3fa7f19.js → p-d6a53ea6.js} +1 -1
  198. package/dist/zonos-elements/{p-02463cc1.system.entry.js → p-db424e02.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-39428328.system.js → p-eb77c0bf.system.js} +1 -1
  200. package/dist/zonos-elements/{p-f49834d4.system.entry.js → p-ef1ccec6.system.entry.js} +1 -1
  201. package/dist/zonos-elements/{p-5d909d3d.entry.js → p-fdf5b8f4.entry.js} +1 -1
  202. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  203. package/package.json +1 -1
  204. package/dist/esm-es5/cart-5b417c0d.js +0 -1
  205. package/dist/esm-es5/handleFetch-621e45bc.js +0 -1
  206. package/dist/zonos-elements/p-0794c530.entry.js +0 -1
  207. package/dist/zonos-elements/p-0fc02cde.js +0 -1
  208. package/dist/zonos-elements/p-1b3e92ea.system.entry.js +0 -1
  209. package/dist/zonos-elements/p-1b75aa35.system.js +0 -1
  210. package/dist/zonos-elements/p-2d4e0280.entry.js +0 -1
  211. package/dist/zonos-elements/p-40a2a649.js +0 -1
  212. package/dist/zonos-elements/p-5539386e.system.entry.js +0 -1
  213. package/dist/zonos-elements/p-91553cf0.system.js +0 -1
  214. package/dist/zonos-elements/p-c740353c.js +0 -1
  215. package/dist/zonos-elements/p-f1f3a846.entry.js +0 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-7c1e1bc1.js');
4
- const localization = require('./localization-e9089be5.js');
5
- const handleFetch = require('./handleFetch-969d05d8.js');
6
- const isDarkColor = require('./isDarkColor-35e8daec.js');
7
- const getBorderRadius = require('./getBorderRadius-c424eb05.js');
3
+ const zonosStore = require('./zonosStore-f8ee56aa.js');
4
+ const localization = require('./localization-9b43376c.js');
5
+ const handleFetch = require('./handleFetch-05227713.js');
6
+ const isDarkColor = require('./isDarkColor-428965f4.js');
7
+ const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
8
8
 
9
9
  /**
10
10
  * Extract value from translated object
@@ -37,7 +37,7 @@ const prepCartCalculateLandedCost = (cartId) => {
37
37
  const stripeBillingAddressData = stripeStore.stripeShippingSameAsBilling
38
38
  ? stripeStore.stripeAddressEventData
39
39
  : stripeStore.stripeBillingAddressEventData;
40
- if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
40
+ if (!stripeAddressData || !stripeBillingAddressData) {
41
41
  throw new Error('Missing stripe address data');
42
42
  }
43
43
  // Attempt to get translated address if available
@@ -114,7 +114,7 @@ const prepCalculateLandedCost = () => {
114
114
  ? stripeStore.stripeAddressEventData
115
115
  : stripeStore.stripeBillingAddressEventData;
116
116
  handleFetch.log({ stripeAddressData, stripeBillingAddressData }, 'info');
117
- if (!(stripeAddressData === null || stripeAddressData === void 0 ? void 0 : stripeAddressData.complete) || !(stripeBillingAddressData === null || stripeBillingAddressData === void 0 ? void 0 : stripeBillingAddressData.complete)) {
117
+ if (!stripeAddressData || !stripeBillingAddressData) {
118
118
  throw new Error('Missing stripe address data');
119
119
  }
120
120
  // Attempt to get translated address if available
@@ -256,7 +256,7 @@ const calculateLandedCost = async (abortController) => {
256
256
  };
257
257
 
258
258
  const cartCalculateLandedCost = async ({ abortController, cartId, }) => {
259
- var _a;
259
+ var _a, _b;
260
260
  // request to get landed cost info
261
261
  const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/cart-calculate-landed-cost', {
262
262
  body: prepCartCalculateLandedCost(cartId),
@@ -264,7 +264,8 @@ const cartCalculateLandedCost = async ({ abortController, cartId, }) => {
264
264
  signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
265
265
  });
266
266
  if (errors.length || !json) {
267
- const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
267
+ const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.' ||
268
+ ((_b = errors[0]) === null || _b === void 0 ? void 0 : _b.message.includes('signal is aborted'));
268
269
  const errorMessage = isAbortedRequest
269
270
  ? 'The landed cost calculation request was aborted to initiate a new one.'
270
271
  : 'Failed to calculate landed cost';
@@ -599,6 +600,7 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = z
599
600
  checkoutSettlementCurrency: 'USD',
600
601
  clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
601
602
  companyName: '',
603
+ companyNameUsedWhenAsyncAddressUpdate: '',
602
604
  customAddressErrors: {
603
605
  city: '',
604
606
  firstName: '',
@@ -625,6 +627,8 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = z
625
627
  hasPaymentError: false,
626
628
  isFetchingLandedCost: false,
627
629
  isFetchingSession: false,
630
+ partyBillingId: null,
631
+ partyShippingId: null,
628
632
  shouldInventoryRefund: false,
629
633
  shouldRenderPayInUsdButton: false,
630
634
  /**
@@ -637,10 +641,12 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = z
637
641
  stripe: null,
638
642
  stripeAddressElement: null,
639
643
  stripeAddressEventData: null,
644
+ stripeAddressUsedWhenAsyncAddressUpdate: null,
640
645
  stripeAddressUsedWhenFetchingLC: null,
641
646
  stripeAddressUsedWhenValidatingAddress: null,
642
647
  stripeBillingAddressElement: null,
643
648
  stripeBillingAddressEventData: null,
649
+ stripeBillingAddressUsedWhenAsyncAddressUpdate: null,
644
650
  stripeBillingAddressUsedWhenFetchingLC: null,
645
651
  stripeBillingAddressUsedWhenValidatingAddress: null,
646
652
  stripeCustomerSessionClientSecret: null,
@@ -654,7 +660,7 @@ const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = z
654
660
  stripePaymentEventData: null,
655
661
  stripeShippingSameAsBilling: true,
656
662
  taxId: '',
657
- taxIdUsedWhenFetchingLC: '',
663
+ taxIdUsedWhenAsyncAddressUpdate: '',
658
664
  translatedAddress: {
659
665
  address: {},
660
666
  billingAddress: {},
@@ -759,15 +765,178 @@ const checkIsAddressOutdatedForValidation = () => {
759
765
  JSON.stringify((_d = stripeStore.stripeBillingAddressUsedWhenValidatingAddress) === null || _d === void 0 ? void 0 : _d.value);
760
766
  return isAddressDataDirty || isBillingAddressDataDirty;
761
767
  };
762
- const checkIsAddressOutdatedForLCPrefetch = () => {
768
+ const checkIsAddressOutdatedForAsyncAddressUpdate = () => {
763
769
  var _a, _b, _c, _d, _e, _f;
764
770
  const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
765
771
  JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
766
- const isAddressDataDirty = JSON.stringify((_c = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _c === void 0 ? void 0 : _c.value) !==
767
- JSON.stringify((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value);
772
+ 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);
768
773
  const isBillingAddressDataDirty = !stripeStore.stripeShippingSameAsBilling &&
769
- JSON.stringify((_e = stripeStore.stripeBillingAddressEventData) === null || _e === void 0 ? void 0 : _e.value) !==
770
- JSON.stringify((_f = stripeStore.stripeBillingAddressUsedWhenFetchingLC) === null || _f === void 0 ? void 0 : _f.value);
774
+ 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);
775
+ const isTaxIdDirty = stripeStore.taxIdUsedWhenAsyncAddressUpdate !== stripeStore.taxId;
776
+ const isCompanyNameDirty = stripeStore.companyNameUsedWhenAsyncAddressUpdate !==
777
+ stripeStore.companyName;
778
+ return (isLinkDataDirty ||
779
+ isAddressDataDirty ||
780
+ isBillingAddressDataDirty ||
781
+ isTaxIdDirty ||
782
+ isCompanyNameDirty);
783
+ };
784
+ const buildAddressForPartyCreate = ({ address, firstName, lastName, name, phone, }) => {
785
+ const _firstName = (name === null || name === void 0 ? void 0 : name.split(' ')[0]) || firstName || '';
786
+ const _lastName = (name === null || name === void 0 ? void 0 : name.split(' ')[1]) || lastName || '';
787
+ if (!_firstName || !_lastName) {
788
+ void handleFetch.sendErrorLog({
789
+ endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
790
+ errors: ['No name found'],
791
+ metadata: {
792
+ allLogs: handleFetch.allLogs,
793
+ cartId: window.Zonos.cartId,
794
+ checkoutSessionId: localization.storageStore.checkoutSessionId,
795
+ firstName,
796
+ lastName,
797
+ name,
798
+ },
799
+ });
800
+ }
801
+ if (!phone) {
802
+ void handleFetch.sendErrorLog({
803
+ endpoint: 'PARTY_CREATE_NO_PHONE_FOUND',
804
+ errors: ['No phone found'],
805
+ metadata: {
806
+ allLogs: handleFetch.allLogs,
807
+ cartId: window.Zonos.cartId,
808
+ checkoutSessionId: localization.storageStore.checkoutSessionId,
809
+ phone,
810
+ },
811
+ });
812
+ }
813
+ return {
814
+ city: address.city,
815
+ country: address.country,
816
+ firstName: _firstName,
817
+ lastName: _lastName,
818
+ line1: address.line1,
819
+ line2: address.line2,
820
+ phone: phone || '',
821
+ postal_code: address.postal_code,
822
+ state: address.state,
823
+ };
824
+ };
825
+ const stripeStoreAsyncAddressUpdate = async () => {
826
+ var _a, _b, _c, _d;
827
+ if (!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) ||
828
+ (!stripeStore.stripeShippingSameAsBilling &&
829
+ !((_b = stripeStore.stripeBillingAddressEventData) === null || _b === void 0 ? void 0 : _b.complete)) ||
830
+ !stripeStore.stripeBillingAddressEventData) {
831
+ return {
832
+ partiesCreated: false,
833
+ };
834
+ }
835
+ // If there is no landed cost data, no need to create parties
836
+ if (!cartStore.landedCostData) {
837
+ return {
838
+ partiesCreated: false,
839
+ };
840
+ }
841
+ const firstLandedCostRootId = (_c = cartStore.landedCostData.find(Boolean)) === null || _c === void 0 ? void 0 : _c.landedCost.rootId;
842
+ if (!firstLandedCostRootId) {
843
+ // do nothing if we don't have selected landed cost
844
+ void handleFetch.sendErrorLog({
845
+ endpoint: 'PF_NO_SELECTED_LANDED_COST',
846
+ errors: ['No selected landed cost'],
847
+ metadata: {
848
+ allLogs: handleFetch.allLogs,
849
+ cartId: window.Zonos.cartId,
850
+ checkoutSessionId: localization.storageStore.checkoutSessionId,
851
+ },
852
+ });
853
+ return {
854
+ partiesCreated: false,
855
+ };
856
+ }
857
+ const isAddressOutdated = checkIsAddressOutdatedForAsyncAddressUpdate();
858
+ if (!isAddressOutdated) {
859
+ return {
860
+ partiesCreated: false,
861
+ };
862
+ }
863
+ const address = buildAddressForPartyCreate({
864
+ address: stripeStore.stripeAddressEventData.value.address,
865
+ firstName: stripeStore.stripeAddressEventData.value.firstName,
866
+ lastName: stripeStore.stripeAddressEventData.value.lastName,
867
+ name: stripeStore.stripeAddressEventData.value.name,
868
+ phone: stripeStore.stripeAddressEventData.value.phone,
869
+ });
870
+ const billingAddress = stripeStore.stripeShippingSameAsBilling
871
+ ? address
872
+ : buildAddressForPartyCreate({
873
+ address: stripeStore.stripeBillingAddressEventData.value.address,
874
+ firstName: stripeStore.stripeBillingAddressEventData.value.firstName,
875
+ lastName: stripeStore.stripeBillingAddressEventData.value.lastName,
876
+ name: stripeStore.stripeBillingAddressEventData.value.name,
877
+ phone: stripeStore.stripeBillingAddressEventData.value.phone,
878
+ });
879
+ const isE2ETest = new URLSearchParams(window.location.search).get('zonosE2ETest') === '1';
880
+ const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/create-parties', {
881
+ body: {
882
+ address,
883
+ billingAddress,
884
+ companyName: stripeStore.companyName,
885
+ email: ((_d = stripeStore.stripeLinkEventData) === null || _d === void 0 ? void 0 : _d.value.email) || '',
886
+ isTest: isE2ETest,
887
+ rootId: firstLandedCostRootId,
888
+ taxId: stripeStore.taxId,
889
+ },
890
+ method: 'POST',
891
+ });
892
+ if (errors.length || !json) {
893
+ handleFetch.logError('Error occurs when creating parties', JSON.stringify(errors, null, 2));
894
+ void handleFetch.sendErrorLog({
895
+ endpoint: 'PF_PARTY_CREATE_FAILED',
896
+ errors: ['Failed to create parties'],
897
+ metadata: {
898
+ allLogs: handleFetch.allLogs,
899
+ cartId: window.Zonos.cartId,
900
+ checkoutSessionId: localization.storageStore.checkoutSessionId,
901
+ errors,
902
+ json,
903
+ },
904
+ });
905
+ return {
906
+ partiesCreated: false,
907
+ };
908
+ }
909
+ stripeStore.companyNameUsedWhenAsyncAddressUpdate = stripeStore.companyName;
910
+ stripeStore.stripeAddressUsedWhenAsyncAddressUpdate =
911
+ stripeStore.stripeAddressEventData;
912
+ stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate =
913
+ stripeStore.stripeBillingAddressEventData;
914
+ stripeStore.taxIdUsedWhenAsyncAddressUpdate = stripeStore.taxId;
915
+ stripeStore.partyBillingId = json.billToPartyId;
916
+ stripeStore.partyShippingId = json.shipToPartyId;
917
+ return {
918
+ partiesCreated: true,
919
+ };
920
+ };
921
+ /**
922
+ * Extract only the necessary address info for landed cost prefetch
923
+ */
924
+ const buildAddressForLCPrefetch = (address) => {
925
+ return {
926
+ countryCode: address.address.country,
927
+ postalCode: address.address.postal_code,
928
+ state: address.address.state,
929
+ };
930
+ };
931
+ const checkIsAddressOutdatedForLCPrefetch = () => {
932
+ var _a, _b;
933
+ const isLinkDataDirty = JSON.stringify((_a = stripeStore.stripeLinkUsedWhenFetchingLC) === null || _a === void 0 ? void 0 : _a.value) !==
934
+ JSON.stringify((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.value);
935
+ const isAddressDataDirty = stripeStore.stripeAddressEventData &&
936
+ JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeAddressEventData.value)) !== JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC);
937
+ const isBillingAddressDataDirty = !stripeStore.stripeShippingSameAsBilling &&
938
+ stripeStore.stripeBillingAddressEventData &&
939
+ JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeBillingAddressEventData.value)) !== JSON.stringify(stripeStore.stripeBillingAddressUsedWhenFetchingLC);
771
940
  return isLinkDataDirty || isAddressDataDirty || isBillingAddressDataDirty;
772
941
  };
773
942
  /**
@@ -781,14 +950,64 @@ const isPrefetchInfoOutdated = () => {
781
950
  ((_a = cartStore.landedCostData.find(Boolean)) === null || _a === void 0 ? void 0 : _a.subtotals.items) !==
782
951
  cartStore.subtotal;
783
952
  const isAddressOutdated = checkIsAddressOutdatedForLCPrefetch();
784
- // Auto prefetch landed cost if tax id is updated
785
- const isTaxIdDirty = stripeStore.taxIdUsedWhenFetchingLC !== stripeStore.taxId;
953
+ handleFetch.log('isPrefetchInfoOutdated', 'info', {
954
+ isAddressOutdated,
955
+ });
786
956
  return (
787
957
  // if landed cost data is not available, we need to fetch it
788
- !cartStore.landedCostData ||
958
+ (!cartStore.landedCostData && !stripeStore.isFetchingLandedCost) ||
789
959
  isAddressOutdated ||
790
- isTotalAmountChanged ||
791
- isTaxIdDirty);
960
+ isTotalAmountChanged);
961
+ };
962
+ const getCountryField = (country) => {
963
+ var _a, _b;
964
+ const countryFieldLabels = (_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.countryFields;
965
+ const stripeCountryFieldLabels = (_b = zonosStore.zonosStore.genericSettings) === null || _b === void 0 ? void 0 : _b.stripeCountryFieldLabels;
966
+ const stripeFoundCountryField = stripeCountryFieldLabels && country in stripeCountryFieldLabels
967
+ ? stripeCountryFieldLabels[country]
968
+ : null;
969
+ const zonosFoundCountryField = countryFieldLabels && country in countryFieldLabels
970
+ ? countryFieldLabels[country]
971
+ : null;
972
+ /**
973
+ * 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
974
+ * 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
975
+ **/
976
+ if (cartStore.addressFormRenderType === 'stripe') {
977
+ return stripeFoundCountryField || zonosFoundCountryField;
978
+ }
979
+ return zonosFoundCountryField;
980
+ };
981
+ const isAddressReadyToRequestLandedCost = () => {
982
+ var _a, _b, _c, _d;
983
+ const linkReady = !!((_a = stripeStore.stripeLinkEventData) === null || _a === void 0 ? void 0 : _a.complete);
984
+ const shippingAddressReady = !!((_b = stripeStore.stripeAddressEventData) === null || _b === void 0 ? void 0 : _b.complete);
985
+ const billingAddressReady = stripeStore.stripeShippingSameAsBilling
986
+ ? shippingAddressReady
987
+ : !!((_c = stripeStore.stripeBillingAddressEventData) === null || _c === void 0 ? void 0 : _c.complete);
988
+ const shipToCountry = ((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value.address.country) || 'US';
989
+ const countryField = getCountryField(shipToCountry);
990
+ // Only send landed cost request if the address is complete when we can't get the country field
991
+ if (!countryField || !stripeStore.stripeAddressEventData) {
992
+ return shippingAddressReady && billingAddressReady && linkReady;
993
+ }
994
+ const isValidLine1 = stripeStore.stripeAddressEventData.value.address.line1.length > 0;
995
+ const isValidName = stripeStore.stripeAddressEventData.value.firstName &&
996
+ stripeStore.stripeAddressEventData.value.lastName;
997
+ const isStateValid = !countryField.stateRequired ||
998
+ (countryField.stateRequired &&
999
+ stripeStore.stripeAddressEventData.value.address.state.length > 0);
1000
+ const isPostalCodeValid = !countryField.zipRequired ||
1001
+ (countryField.zipRequired &&
1002
+ stripeStore.stripeAddressEventData.value.address.postal_code.length >= 3);
1003
+ const hasPhoneNumber = stripeStore.stripeAddressEventData.value.phone &&
1004
+ stripeStore.stripeAddressEventData.value.phone.length > 0;
1005
+ return (linkReady &&
1006
+ isValidName &&
1007
+ isValidLine1 &&
1008
+ isStateValid &&
1009
+ isPostalCodeValid &&
1010
+ hasPhoneNumber);
792
1011
  };
793
1012
  const stripeCalculateLandedCost = async () => {
794
1013
  var _a;
@@ -837,26 +1056,27 @@ const stripeCalculateLandedCost = async () => {
837
1056
  }
838
1057
  };
839
1058
  const stripeStorePrefetchLandedCost = async (params) => {
840
- var _a, _b, _c, _d, _e, _f, _g, _h;
1059
+ var _a, _b, _c, _d;
841
1060
  const retries = (params === null || params === void 0 ? void 0 : params.retries) || 0;
842
1061
  const applyingPromocode = !!(params === null || params === void 0 ? void 0 : params.applyingPromocode);
843
- const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
844
- const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
845
- const stripeBillingAddressReady = stripeStore.stripeShippingSameAsBilling
846
- ? !!((_c = stripeStore.stripeLinkEventData) === null || _c === void 0 ? void 0 : _c.complete)
847
- : !!((_d = stripeStore.stripeBillingAddressEventData) === null || _d === void 0 ? void 0 : _d.complete);
848
1062
  const shouldRefetch = isPrefetchInfoOutdated();
1063
+ const isRequestReadyToPrefetch = isAddressReadyToRequestLandedCost();
1064
+ // Should not do anything if the address is not ready to request landed cost
1065
+ if (!isRequestReadyToPrefetch) {
1066
+ return {
1067
+ isRequestNotReady: true,
1068
+ };
1069
+ }
849
1070
  if (shouldRefetch) {
850
1071
  // if the info used when fetching landed cost is different from the current info, abort the previous request
851
- (_e = stripeStore.fetchingLandedCostAbortController) === null || _e === void 0 ? void 0 : _e.abort();
1072
+ (_a = stripeStore.fetchingLandedCostAbortController) === null || _a === void 0 ? void 0 : _a.abort();
852
1073
  stripeStore.fetchingLandedCostAbortController = null;
853
1074
  }
854
1075
  // Do not fetch if we are not ready or data is not outdated
855
- if ((!shouldRefetch && !applyingPromocode) ||
856
- !stripeAddressReady ||
857
- !stripeLinkReady ||
858
- !stripeBillingAddressReady) {
859
- return;
1076
+ if (!shouldRefetch && !applyingPromocode) {
1077
+ return {
1078
+ isRequestNotReady: false,
1079
+ };
860
1080
  }
861
1081
  // 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)
862
1082
  if (retries) {
@@ -869,24 +1089,31 @@ const stripeStorePrefetchLandedCost = async (params) => {
869
1089
  stripeStore.isFetchingLandedCost = true;
870
1090
  }
871
1091
  if (stripeStore.stripeAddressEventData) {
872
- stripeStore.stripeAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeAddressEventData);
1092
+ stripeStore.stripeAddressUsedWhenFetchingLC = {
1093
+ countryCode: stripeStore.stripeAddressEventData.value.address.country,
1094
+ postalCode: stripeStore.stripeAddressEventData.value.address.postal_code,
1095
+ state: stripeStore.stripeAddressEventData.value.address.state,
1096
+ };
873
1097
  }
874
1098
  if (stripeStore.stripeBillingAddressEventData) {
875
- stripeStore.stripeBillingAddressUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeBillingAddressEventData);
1099
+ stripeStore.stripeBillingAddressUsedWhenFetchingLC = {
1100
+ countryCode: stripeStore.stripeBillingAddressEventData.value.address.country,
1101
+ postalCode: stripeStore.stripeBillingAddressEventData.value.address.postal_code,
1102
+ state: stripeStore.stripeBillingAddressEventData.value.address.state,
1103
+ };
876
1104
  }
877
1105
  if (stripeStore.stripeLinkEventData) {
878
1106
  stripeStore.stripeLinkUsedWhenFetchingLC = Object.assign({}, stripeStore.stripeLinkEventData);
879
1107
  }
880
- stripeStore.taxIdUsedWhenFetchingLC = stripeStore.taxId;
881
1108
  try {
882
1109
  // Reset cart items to non-restricted state and restricted item list
883
1110
  cartStoreResetCartItems();
884
1111
  // fetch and apply landed cost
885
1112
  await stripeCalculateLandedCost();
886
1113
  // This is the cheapest service level since we already sorted them after fetching landed cost
887
- const cheapestServiceLevel = (_f = cartStore.shippingData) === null || _f === void 0 ? void 0 : _f.find(Boolean);
1114
+ const cheapestServiceLevel = (_b = cartStore.shippingData) === null || _b === void 0 ? void 0 : _b.find(Boolean);
888
1115
  // Landed cost that matches with service level
889
- 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));
1116
+ 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));
890
1117
  // apply new subtotal and total, this is mainly to show items in the presentment currency
891
1118
  const subtotals = !!matchLandedCost ? matchLandedCost.subtotals : null;
892
1119
  if (subtotals) {
@@ -910,9 +1137,11 @@ const stripeStorePrefetchLandedCost = async (params) => {
910
1137
  if (retries < 1) {
911
1138
  // retry fetching landed cost one more time
912
1139
  await stripeStorePrefetchLandedCost(Object.assign(Object.assign({}, params), { retries: (retries || 0) + 1 }));
913
- return;
1140
+ return {
1141
+ isRequestNotReady: false,
1142
+ };
914
1143
  }
915
- const shipToAddress = (_h = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _h === void 0 ? void 0 : _h.value;
1144
+ const shipToAddress = (_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value;
916
1145
  void handleFetch.sendErrorLog({
917
1146
  endpoint: `Failed to fetch landed cost (${retries} retries)`,
918
1147
  errors: [err.message],
@@ -925,6 +1154,9 @@ const stripeStorePrefetchLandedCost = async (params) => {
925
1154
  handleFetch.logError(err);
926
1155
  }
927
1156
  stripeStore.isFetchingLandedCost = false;
1157
+ return {
1158
+ isRequestNotReady: false,
1159
+ };
928
1160
  };
929
1161
  const stripeStoreApplyPromoCode = async () => {
930
1162
  var _a, _b;
@@ -935,6 +1167,8 @@ const stripeStoreApplyPromoCode = async () => {
935
1167
  if (cartStore.step === 'payment') {
936
1168
  cartStorePreviousStep();
937
1169
  }
1170
+ // async update address with new root id from the new quote
1171
+ await stripeStoreAsyncAddressUpdate();
938
1172
  // This is the cheapest service level since we already sorted them after fetching landed cost
939
1173
  const cheapestServiceLevel = (_a = cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.find(Boolean);
940
1174
  // Landed cost that matches with service level
@@ -1313,6 +1547,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1313
1547
  const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/update-checkout-session', {
1314
1548
  body: {
1315
1549
  adjustmentsAmount,
1550
+ billToPartyId: stripeStore.partyBillingId,
1316
1551
  cartId,
1317
1552
  currency,
1318
1553
  customerAuthenticationToken: cartStore.customerAuthenticationToken || undefined,
@@ -1326,6 +1561,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
1326
1561
  },
1327
1562
  ],
1328
1563
  presentmentCountryCode,
1564
+ shipToPartyId: stripeStore.partyShippingId,
1329
1565
  skipPaymentIntent: stripeStore.skipPaymentIntent,
1330
1566
  varianceTestInput,
1331
1567
  },
@@ -1466,7 +1702,8 @@ stripeStoreOnChange('clientSecret', clientSecret => {
1466
1702
  }
1467
1703
  });
1468
1704
 
1469
- const { reset, state: cartStore } = zonosStore.createStore(() => ({
1705
+ const { onChange: cartStoreOnChange, reset, state: cartStore, } = zonosStore.createStore(() => ({
1706
+ addressFormRenderType: 'stripe',
1470
1707
  adjustmentTotal: 0,
1471
1708
  adjustments: [],
1472
1709
  checkoutSession: null,
@@ -1681,12 +1918,14 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
1681
1918
  }
1682
1919
  const { errors, json } = await stripeStoreUpdateCheckoutSession({
1683
1920
  adjustmentsAmount,
1921
+ billToPartyId: stripeStore.partyBillingId,
1684
1922
  cartId,
1685
1923
  currency,
1686
1924
  id: localization.storageStore.checkoutSessionId,
1687
1925
  itemsAmount,
1688
1926
  landedCostId,
1689
1927
  presentmentCountryCode: localization.localizationStore.selectedCountryCode,
1928
+ shipToPartyId: stripeStore.partyShippingId,
1690
1929
  varianceTestInput: localization.storageStore.enabledVariantTestKeys || [],
1691
1930
  });
1692
1931
  if (errors.length > 0 || !json) {
@@ -1770,9 +2009,11 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
1770
2009
  // update session with selected landed cost
1771
2010
  const updateCalculateStatus = await cartStoreReCalculateTotal({
1772
2011
  adjustmentsAmount: cartStore.adjustmentTotal,
2012
+ billToPartyId: stripeStore.partyBillingId,
1773
2013
  cartId: window.Zonos.cartId,
1774
2014
  dutiesTaxesFeesEstimate: dutiesTaxesFeesEstimate,
1775
2015
  landedCostId: (_f = selectedLandedCost.landedCost) === null || _f === void 0 ? void 0 : _f.id,
2016
+ shipToPartyId: stripeStore.partyShippingId,
1776
2017
  varianceTestInput: localization.storageStore.enabledVariantTestKeys || [],
1777
2018
  });
1778
2019
  // update conditionally render pay in USD button
@@ -1835,10 +2076,12 @@ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
1835
2076
  stripeStore.isFetchingSession = true;
1836
2077
  await cartStoreReCalculateTotal({
1837
2078
  adjustmentsAmount: adjustmentTotal,
2079
+ billToPartyId: stripeStore.partyBillingId,
1838
2080
  cartId: window.Zonos.cartId,
1839
2081
  currency: currency,
1840
2082
  dutiesTaxesFeesEstimate: 0,
1841
2083
  itemsAmount: total,
2084
+ shipToPartyId: stripeStore.partyShippingId,
1842
2085
  // attempt to init session on failure to update checkout session
1843
2086
  shouldInitSessionOnFailure: true,
1844
2087
  varianceTestInput: localization.storageStore.enabledVariantTestKeys || [],
@@ -1900,6 +2143,7 @@ exports.cartStoreGetMethod = cartStoreGetMethod;
1900
2143
  exports.cartStoreGetShippingTransitInfo = cartStoreGetShippingTransitInfo;
1901
2144
  exports.cartStoreHasOneEligibleItem = cartStoreHasOneEligibleItem;
1902
2145
  exports.cartStoreNextStep = cartStoreNextStep;
2146
+ exports.cartStoreOnChange = cartStoreOnChange;
1903
2147
  exports.cartStoreReset = cartStoreReset;
1904
2148
  exports.cartStoreResetTabItems = cartStoreResetTabItems;
1905
2149
  exports.cartStoreSetCheckoutSession = cartStoreSetCheckoutSession;
@@ -1912,6 +2156,7 @@ exports.initStripeElements = initStripeElements;
1912
2156
  exports.sortServiceLevelOptionsByAmount = sortServiceLevelOptionsByAmount;
1913
2157
  exports.stripeStore = stripeStore;
1914
2158
  exports.stripeStoreApplyPromoCode = stripeStoreApplyPromoCode;
2159
+ exports.stripeStoreAsyncAddressUpdate = stripeStoreAsyncAddressUpdate;
1915
2160
  exports.stripeStoreCleanupDomesticShippingSession = stripeStoreCleanupDomesticShippingSession;
1916
2161
  exports.stripeStoreConfirmPayment = stripeStoreConfirmPayment;
1917
2162
  exports.stripeStoreGetDomesticShippingSession = stripeStoreGetDomesticShippingSession;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-7c1e1bc1.js');
3
+ const zonosStore = require('./zonosStore-f8ee56aa.js');
4
4
 
5
5
  var root = zonosStore._root;
6
6
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-7c1e1bc1.js');
3
+ const zonosStore = require('./zonosStore-f8ee56aa.js');
4
4
 
5
5
  /**
6
6
  * Get the border radius for the elements based on the style
@@ -37,11 +37,6 @@ const log = (message, type, ..._additionalInfo) => {
37
37
  !!window.location.search.match(/\?.*(&*)zonosDebug=1/);
38
38
  // if debug is false, do not log
39
39
  if (!isDebug) {
40
- // log errors to the console if the type is error
41
- if (type === 'error') {
42
- // eslint-disable-next-line no-console
43
- console.error(message, ...additionalInfo);
44
- }
45
40
  return;
46
41
  }
47
42
  let loggingIframe = document.querySelector('iframe#zonos---debug-logging-iframe');
@@ -434,12 +429,13 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
434
429
  }
435
430
  const nextFallbackApiType = getNextFallbackApiType(basePathType);
436
431
  const unknownError = errors.find(({ type }) => type === 'unknown');
432
+ const isAbortError = errors.find(({ message }) => message.includes('signal is aborted'));
437
433
  const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
438
434
  const shouldCallFallback =
439
435
  // If next fallback is available, and the error is unknown (Failed to fetch) or 404
440
436
  nextFallbackApiType && isUnknownError;
441
437
  // Should log the error if it's unknown error
442
- if (isUnknownError) {
438
+ if (isUnknownError || isAbortError) {
443
439
  void sendErrorLog({
444
440
  endpoint: fallbackApiList[basePathType] + path,
445
441
  errors: errors.map(({ message }) => `API: ${message}`),
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
6
6
  const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
7
- const handleFetch = require('./handleFetch-969d05d8.js');
7
+ const handleFetch = require('./handleFetch-05227713.js');
8
8
  const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
9
9
  const VarianceTest = require('./VarianceTest-0cb1e118.js');
10
10
  const TaxId = require('./TaxId-12acedde.js');
@@ -132,7 +132,7 @@ const getZonosQaUrl = () => {
132
132
  return null;
133
133
  }
134
134
  const qaUrl = extractZonosQaUrl(window.location.href);
135
- const cdnUrl = "https://v1.3.208.js.zonos.com";
135
+ const cdnUrl = "https://v1.3.209.js.zonos.com";
136
136
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
137
137
  if (!qaUrl &&
138
138
  (cdnUrl.includes('test.') ||
@@ -375,10 +375,10 @@ const zonosLoadUrl = (() => {
375
375
  }
376
376
  return null;
377
377
  })();
378
- const ZONOS_URL = "https://v1.3.208.js.zonos.com";
379
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.208";
380
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.208";
381
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.208";
378
+ const ZONOS_URL = "https://v1.3.209.js.zonos.com";
379
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.209";
380
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.209";
381
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.209";
382
382
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
383
383
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
384
384
  class Zonos {
@@ -396,7 +396,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
396
396
  ? new URLSearchParams(window.location.search).get('iframeLogType')
397
397
  : null;
398
398
  Zonos.isBigCommerce = false;
399
- Zonos.releaseDate = "1748878470643";
399
+ Zonos.releaseDate = "1749049121169";
400
400
  Zonos.isLegacyCheckout = false;
401
401
  Zonos.domain = typeof window !== 'undefined'
402
402
  ? // domain that embeds the iframe
@@ -414,7 +414,7 @@ Zonos.isNpm = true;
414
414
  Zonos.zonosQaUrl = null;
415
415
  Zonos.zonosQaUrlApi = null;
416
416
  Zonos.trackEventLogs = [];
417
- Zonos.version = `v${"1.3.208"}`;
417
+ Zonos.version = `v${"1.3.209"}`;
418
418
  Zonos.modeAlerted = false;
419
419
  Zonos.cartData = null;
420
420
  Zonos.paypal = null;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const zonosStore = require('./zonosStore-7c1e1bc1.js');
3
+ const zonosStore = require('./zonosStore-f8ee56aa.js');
4
4
 
5
5
  var tinycolor$1 = {exports: {}};
6
6