@zonos/elements 1.3.288 → 1.3.290

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 (321) hide show
  1. package/dist/cjs/{cart-CV4buPlT.js → cart-7DceSLKl.js} +3 -3
  2. package/dist/cjs/{collect-jzWKzrV7.js → collect-C08DUE1L.js} +3 -3
  3. package/dist/cjs/{debounce-5sZmmlCI.js → debounce-Cd2emZPn.js} +2 -2
  4. package/dist/cjs/{debounce-Nu2lJW4A.js → debounce-vY0QYT6o.js} +1 -1
  5. package/dist/cjs/{getBorderRadius-DGZiQu09.js → getBorderRadius-CyYZw4qq.js} +1 -1
  6. package/dist/cjs/{getMissingRequiredShippingFields-r5vYIqoX.js → getMissingRequiredShippingFields-Duz8xpmf.js} +1 -1
  7. package/dist/cjs/{hasInclusivePrice-BZMQohG9.js → hasInclusivePrice-C-iyXqJ0.js} +1 -1
  8. package/dist/cjs/index.cjs.js +8 -9
  9. package/dist/cjs/{invoice-CHw-mJdS.js → invoice-DSuHUQpi.js} +3 -3
  10. package/dist/cjs/{localization-CxXsmxs5.js → localization-BJqYz_PB.js} +192 -69
  11. package/dist/cjs/{paypal-BLuHeOJH.js → paypal-CZoctP9S.js} +4 -4
  12. package/dist/cjs/{placeTestOrder-VK_CMeq0.js → placeTestOrder-D7baFuaV.js} +2 -2
  13. package/dist/cjs/{renderCheckoutCurrency-CC4CAy-a.js → renderCheckoutCurrency-Ca2HH1Gc.js} +2 -2
  14. package/dist/cjs/{shouldShowLanguageSelect-Bj_jKWPK.js → shouldShowLanguageSelect-FyTdz7U_.js} +1 -1
  15. package/dist/cjs/{submitGtag-CcEL-w5D.js → submitGtag-D79e8u6s.js} +1 -1
  16. package/dist/cjs/{throttle-BcxGntLr.js → throttle-zSVRQLC0.js} +2 -2
  17. package/dist/cjs/{updateCheckoutSessionAttributes-Dltl5RBx.js → updateCheckoutSessionAttributes-jMtfOL2m.js} +1 -1
  18. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +11 -11
  19. package/dist/cjs/zonos-address-display_2.cjs.entry.js +3 -3
  20. package/dist/cjs/zonos-address_4.cjs.entry.js +8 -8
  21. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +5 -5
  22. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  24. package/dist/cjs/zonos-button_3.cjs.entry.js +2 -2
  25. package/dist/cjs/zonos-card_5.cjs.entry.js +7 -7
  26. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +15 -15
  27. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +2 -2
  28. package/dist/cjs/zonos-checkout.cjs.entry.js +12 -12
  29. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  30. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +4 -4
  31. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +11 -11
  32. package/dist/cjs/zonos-collect.cjs.entry.js +7 -7
  33. package/dist/cjs/zonos-controller.cjs.entry.js +7 -7
  34. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  35. package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
  36. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  37. package/dist/cjs/zonos-hello.cjs.entry.js +129 -51
  38. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  39. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +6 -6
  40. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +11 -11
  41. package/dist/cjs/zonos-invoice.cjs.entry.js +7 -7
  42. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  43. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  44. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +5 -5
  45. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  46. package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
  47. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  48. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  49. package/dist/cjs/{zonosStore-BCNYr6Tk.js → zonosStore-Bx9jK82G.js} +2 -0
  50. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +1 -1
  51. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +1 -1
  52. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +1 -1
  53. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +1 -1
  54. package/dist/collection/components/hello/zonos-hello/zonos-hello.css +17 -15
  55. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +29 -52
  56. package/dist/collection/components/main/zonos-controller.js +2 -2
  57. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -2
  58. package/dist/collection/components/store/hello/localization.js +69 -34
  59. package/dist/collection/components/store/zonosStore.js +2 -0
  60. package/dist/collection/components/stripe/zonos-address/zonos-address.js +2 -2
  61. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -3
  62. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  63. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +0 -1
  64. package/dist/collection/components/utils/api/getLocalization.js +2 -2
  65. package/dist/collection/components/utils/checkout/isShippableCountry.js +2 -4
  66. package/dist/collection/components/utils/checkout/watchBigcommerceDomesticCheckout.js +1 -0
  67. package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +2 -0
  68. package/dist/collection/components/utils/formatDate.js +1 -3
  69. package/dist/collection/components/utils/getOverridenZCountry.js +3 -5
  70. package/dist/collection/components/utils/hello/countryOverrideStorage.js +49 -0
  71. package/dist/collection/components/utils/hello/getZCountryUrlParam.js +5 -9
  72. package/dist/collection/components/utils/hello/isCountryCode.js +1 -0
  73. package/dist/collection/components/utils/hello/isCountryInShippingZone.js +8 -0
  74. package/dist/collection/components/utils/hello/reconcileRememberedCountryOverride.js +37 -0
  75. package/dist/collection/components/utils/hello/resolveHelloFloatPlacement.js +98 -0
  76. package/dist/collection/components/utils/hello/shouldShowHelloWidget.js +27 -20
  77. package/dist/collection/environment.js +0 -1
  78. package/dist/collection/scripts/_stripe.js +0 -2
  79. package/dist/collection/scripts/_zonosBase.js +1 -1
  80. package/dist/collection/types/generated/graphql.frontend.types.js +218 -63
  81. package/dist/collection/types/generated/graphql.internal.types.js +815 -152
  82. package/dist/collection/utils/formattedCloudflareApiUrl.js +1 -0
  83. package/dist/collection/utils/generateCloudflareDeployUrl.js +5 -2
  84. package/dist/esm/{cart-ekBk_gxV.js → cart-Cleo1j5P.js} +3 -3
  85. package/dist/esm/{collect-33rMINDo.js → collect-CspdWIRo.js} +3 -3
  86. package/dist/esm/{debounce-D4ko2kvZ.js → debounce-BR3PaG8X.js} +1 -1
  87. package/dist/esm/{debounce-DWPsxJsW.js → debounce-CrmpwbEE.js} +2 -2
  88. package/dist/esm/{getBorderRadius-HwG64EKM.js → getBorderRadius-DYfkeXdx.js} +1 -1
  89. package/dist/esm/{getMissingRequiredShippingFields-u1nhQzJ1.js → getMissingRequiredShippingFields-B1IL1-gn.js} +1 -1
  90. package/dist/esm/{hasInclusivePrice-CAVXi310.js → hasInclusivePrice-DKRplpLX.js} +1 -1
  91. package/dist/esm/index.js +8 -9
  92. package/dist/esm/{invoice-BNDWuVsD.js → invoice-D49igPQ9.js} +3 -3
  93. package/dist/esm/{localization-AOqYXGdP.js → localization-BiL8bPsY.js} +192 -70
  94. package/dist/esm/{paypal-CW1D2XqZ.js → paypal-D4vWRxHJ.js} +4 -4
  95. package/dist/esm/{placeTestOrder-nhmsLLOA.js → placeTestOrder-BNmc5RCo.js} +2 -2
  96. package/dist/esm/{renderCheckoutCurrency-BQANmZyM.js → renderCheckoutCurrency-BNbwijGo.js} +2 -2
  97. package/dist/esm/{shouldShowLanguageSelect-BQFCXouB.js → shouldShowLanguageSelect-B82gTfHz.js} +1 -1
  98. package/dist/esm/{submitGtag-CCGQS060.js → submitGtag-df9AQ2zL.js} +1 -1
  99. package/dist/esm/{throttle-D5GyA3yr.js → throttle-Cvlvb-dm.js} +2 -2
  100. package/dist/esm/{updateCheckoutSessionAttributes-eRSqdC74.js → updateCheckoutSessionAttributes-4Jq6V4pO.js} +1 -1
  101. package/dist/esm/zonos-address-completion-dialog_7.entry.js +11 -11
  102. package/dist/esm/zonos-address-display_2.entry.js +3 -3
  103. package/dist/esm/zonos-address_4.entry.js +8 -8
  104. package/dist/esm/zonos-airwallex-payment.entry.js +5 -5
  105. package/dist/esm/zonos-badge.entry.js +1 -1
  106. package/dist/esm/zonos-banner.entry.js +1 -1
  107. package/dist/esm/zonos-button_3.entry.js +2 -2
  108. package/dist/esm/zonos-card_5.entry.js +7 -7
  109. package/dist/esm/zonos-cart-items_12.entry.js +15 -15
  110. package/dist/esm/zonos-checkbox_2.entry.js +2 -2
  111. package/dist/esm/zonos-checkout.entry.js +12 -12
  112. package/dist/esm/zonos-collapse.entry.js +1 -1
  113. package/dist/esm/zonos-collect-cart-items_3.entry.js +4 -4
  114. package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
  115. package/dist/esm/zonos-collect.entry.js +7 -7
  116. package/dist/esm/zonos-controller.entry.js +7 -7
  117. package/dist/esm/zonos-country-flag.entry.js +2 -2
  118. package/dist/esm/zonos-country-select_4.entry.js +3 -3
  119. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  120. package/dist/esm/zonos-hello.entry.js +129 -51
  121. package/dist/esm/zonos-input.entry.js +2 -2
  122. package/dist/esm/zonos-invoice-cart-items_2.entry.js +6 -6
  123. package/dist/esm/zonos-invoice-finish_5.entry.js +11 -11
  124. package/dist/esm/zonos-invoice.entry.js +7 -7
  125. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  126. package/dist/esm/zonos-logo.entry.js +1 -1
  127. package/dist/esm/zonos-policy-consent_2.entry.js +5 -5
  128. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  129. package/dist/esm/zonos-stripe-input.entry.js +3 -3
  130. package/dist/esm/zonos-text.entry.js +1 -1
  131. package/dist/esm/zonos-v-stack.entry.js +1 -1
  132. package/dist/esm/{zonosStore-DrIOAz4M.js → zonosStore-msUlqmSD.js} +2 -0
  133. package/dist/esm-es5/{cart-ekBk_gxV.js → cart-Cleo1j5P.js} +8 -8
  134. package/dist/esm-es5/{collect-33rMINDo.js → collect-CspdWIRo.js} +1 -1
  135. package/dist/esm-es5/{debounce-D4ko2kvZ.js → debounce-BR3PaG8X.js} +7 -7
  136. package/dist/esm-es5/debounce-CrmpwbEE.js +1 -0
  137. package/dist/esm-es5/{getBorderRadius-HwG64EKM.js → getBorderRadius-DYfkeXdx.js} +1 -1
  138. package/dist/esm-es5/{getMissingRequiredShippingFields-u1nhQzJ1.js → getMissingRequiredShippingFields-B1IL1-gn.js} +3 -3
  139. package/dist/esm-es5/{hasInclusivePrice-CAVXi310.js → hasInclusivePrice-DKRplpLX.js} +1 -1
  140. package/dist/esm-es5/index.js +6 -8
  141. package/dist/esm-es5/{invoice-BNDWuVsD.js → invoice-D49igPQ9.js} +1 -1
  142. package/dist/esm-es5/{localization-AOqYXGdP.js → localization-BiL8bPsY.js} +74 -68
  143. package/dist/esm-es5/{paypal-CW1D2XqZ.js → paypal-D4vWRxHJ.js} +1 -1
  144. package/dist/esm-es5/{placeTestOrder-nhmsLLOA.js → placeTestOrder-BNmc5RCo.js} +1 -1
  145. package/dist/esm-es5/{renderCheckoutCurrency-BQANmZyM.js → renderCheckoutCurrency-BNbwijGo.js} +1 -1
  146. package/dist/esm-es5/{shouldShowLanguageSelect-BQFCXouB.js → shouldShowLanguageSelect-B82gTfHz.js} +1 -1
  147. package/dist/esm-es5/{submitGtag-CCGQS060.js → submitGtag-df9AQ2zL.js} +1 -1
  148. package/dist/esm-es5/{throttle-D5GyA3yr.js → throttle-Cvlvb-dm.js} +2 -2
  149. package/dist/esm-es5/{updateCheckoutSessionAttributes-eRSqdC74.js → updateCheckoutSessionAttributes-4Jq6V4pO.js} +1 -1
  150. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +3 -3
  151. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  152. package/dist/esm-es5/zonos-address_4.entry.js +2 -2
  153. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  154. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  155. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  156. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  157. package/dist/esm-es5/zonos-card_5.entry.js +2 -2
  158. package/dist/esm-es5/zonos-cart-items_12.entry.js +2 -2
  159. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
  160. package/dist/esm-es5/zonos-checkout.entry.js +6 -6
  161. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  162. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  163. package/dist/esm-es5/zonos-collect-finish_6.entry.js +2 -2
  164. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  165. package/dist/esm-es5/zonos-controller.entry.js +3 -3
  166. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  167. package/dist/esm-es5/zonos-country-select_4.entry.js +2 -2
  168. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  169. package/dist/esm-es5/zonos-hello.entry.js +21 -24
  170. package/dist/esm-es5/zonos-input.entry.js +1 -1
  171. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +2 -2
  172. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +2 -2
  173. package/dist/esm-es5/zonos-invoice.entry.js +3 -3
  174. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  175. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  176. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  177. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  178. package/dist/esm-es5/zonos-stripe-input.entry.js +2 -2
  179. package/dist/esm-es5/zonos-text.entry.js +1 -1
  180. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  181. package/dist/esm-es5/{zonosStore-DrIOAz4M.js → zonosStore-msUlqmSD.js} +1 -1
  182. package/dist/scripts/index.d.ts +36 -6
  183. package/dist/scripts/index.js +1 -1
  184. package/dist/scripts/loadZonos.js +1 -1
  185. package/dist/scripts/zonos.js +1 -1
  186. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +5 -3
  187. package/dist/types/components/store/hello/localization.d.ts +2 -1
  188. package/dist/types/components/utils/api/getLocalization.d.ts +3 -1
  189. package/dist/types/components/utils/getOverridenZCountry.d.ts +2 -3
  190. package/dist/types/components/utils/hello/countryOverrideStorage.d.ts +5 -0
  191. package/dist/types/components/utils/hello/isCountryCode.d.ts +2 -0
  192. package/dist/types/components/utils/hello/isCountryInShippingZone.d.ts +2 -0
  193. package/dist/types/components/utils/hello/reconcileRememberedCountryOverride.d.ts +18 -0
  194. package/dist/types/components/utils/hello/resolveHelloFloatPlacement.d.ts +39 -0
  195. package/dist/types/components/utils/hello/shouldShowHelloWidget.d.ts +8 -4
  196. package/dist/types/components.d.ts +4 -6
  197. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +10 -0
  198. package/dist/types/types/generated/graphql.frontend.types.d.ts +41 -52
  199. package/dist/types/types/generated/graphql.frontend.types.ts +226 -114
  200. package/dist/types/types/generated/graphql.internal.types.d.ts +465 -100
  201. package/dist/types/types/generated/graphql.internal.types.ts +1007 -253
  202. package/dist/types/types/hello/HelloConfig.d.ts +12 -0
  203. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +1 -0
  204. package/dist/types/utils/generateCloudflareDeployUrl.d.ts +5 -2
  205. package/dist/zonos-elements/index.esm.js +1 -1
  206. package/dist/zonos-elements/{p-39c8a898.entry.js → p-028e0500.entry.js} +1 -1
  207. package/dist/zonos-elements/p-079af8c0.system.entry.js +118 -0
  208. package/dist/zonos-elements/{p-058f07aa.system.entry.js → p-0a4a7742.system.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-04cc0dac.system.entry.js → p-0dca8a26.system.entry.js} +47 -47
  210. package/dist/zonos-elements/{p-d33dfc78.system.entry.js → p-0ee74bf3.system.entry.js} +30 -30
  211. package/dist/zonos-elements/{p-e284d329.entry.js → p-11bab88b.entry.js} +1 -1
  212. package/dist/zonos-elements/{p-7a5d2211.system.entry.js → p-13d3a372.system.entry.js} +18 -18
  213. package/dist/zonos-elements/{p-1568ab06.system.entry.js → p-1409de3b.system.entry.js} +1 -1
  214. package/dist/zonos-elements/{p-8328f44d.entry.js → p-193d9722.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-dcdbc610.system.entry.js → p-195f6e38.system.entry.js} +2 -2
  216. package/dist/zonos-elements/{p-daf9fa07.system.entry.js → p-1b77464d.system.entry.js} +16 -16
  217. package/dist/zonos-elements/{p-cc5306fe.system.entry.js → p-1bac5ac1.system.entry.js} +1 -1
  218. package/dist/zonos-elements/{p-128485dc.entry.js → p-1c150f26.entry.js} +1 -1
  219. package/dist/zonos-elements/{p-cf5688f7.entry.js → p-234c202c.entry.js} +1 -1
  220. package/dist/zonos-elements/{p-5a631080.system.entry.js → p-23f6346b.system.entry.js} +1 -1
  221. package/dist/zonos-elements/{p-cc949df1.system.entry.js → p-244e0302.system.entry.js} +1 -1
  222. package/dist/zonos-elements/{p-7681798d.entry.js → p-24f3c547.entry.js} +1 -1
  223. package/dist/zonos-elements/{p-5c08d36b.entry.js → p-2603dce0.entry.js} +1 -1
  224. package/dist/zonos-elements/{p-6b0afaa7.entry.js → p-26295311.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-d4c4a00e.entry.js → p-34c5e145.entry.js} +1 -1
  226. package/dist/zonos-elements/{p-f6e0aeba.system.entry.js → p-35509b10.system.entry.js} +185 -185
  227. package/dist/zonos-elements/{p-4a54f664.entry.js → p-35539d3d.entry.js} +1 -1
  228. package/dist/zonos-elements/{p-5024df2d.system.entry.js → p-3c800376.system.entry.js} +61 -61
  229. package/dist/zonos-elements/{p-f8fd756a.system.entry.js → p-474e8a92.system.entry.js} +1 -1
  230. package/dist/zonos-elements/{p-d55b9664.system.entry.js → p-481ecc23.system.entry.js} +20 -20
  231. package/dist/zonos-elements/{p-4973f8d8.system.entry.js → p-4fd78ecf.system.entry.js} +14 -14
  232. package/dist/zonos-elements/{p-8cd3f1e2.entry.js → p-52d9fd3a.entry.js} +1 -1
  233. package/dist/zonos-elements/{p-a6faab6a.entry.js → p-55916c90.entry.js} +1 -1
  234. package/dist/zonos-elements/p-5b06f069.entry.js +1 -0
  235. package/dist/zonos-elements/{p-5d3079e8.entry.js → p-5df25a1a.entry.js} +1 -1
  236. package/dist/zonos-elements/{p-450ed170.system.entry.js → p-5f347f91.system.entry.js} +3 -3
  237. package/dist/zonos-elements/{p-beeb9d36.system.entry.js → p-756d303f.system.entry.js} +1 -1
  238. package/dist/zonos-elements/{p-5836d426.system.entry.js → p-79ddb12a.system.entry.js} +1 -1
  239. package/dist/zonos-elements/{p-f27317d3.system.entry.js → p-7d284341.system.entry.js} +4 -4
  240. package/dist/zonos-elements/{p-f6ba59f6.system.entry.js → p-7e1050dd.system.entry.js} +10 -10
  241. package/dist/zonos-elements/{p-02ef0f99.system.entry.js → p-7ee2af6e.system.entry.js} +1 -1
  242. package/dist/zonos-elements/{p-34d1545a.entry.js → p-83aa1c8c.entry.js} +1 -1
  243. package/dist/zonos-elements/{p-9818f823.entry.js → p-84c9ce16.entry.js} +1 -1
  244. package/dist/zonos-elements/{p-CaUXHglQ.system.js → p-8PPEbm_0.system.js} +9 -9
  245. package/dist/zonos-elements/{p-b6deae2b.system.entry.js → p-92fe9a1f.system.entry.js} +2 -2
  246. package/dist/zonos-elements/{p-f57495dc.entry.js → p-990b49f2.entry.js} +1 -1
  247. package/dist/zonos-elements/{p-cadf6b63.system.entry.js → p-9ef0f69e.system.entry.js} +10 -10
  248. package/dist/zonos-elements/{p-CZl1nwqv.system.js → p-B4Ufchqh.system.js} +3 -3
  249. package/dist/zonos-elements/{p-BtMauqj_.system.js → p-B5NDhB1w.system.js} +6 -8
  250. package/dist/zonos-elements/{p-CJCoACvU.js → p-BDrM4x5N.js} +2 -2
  251. package/dist/zonos-elements/p-BGktDPwA.system.js +1 -0
  252. package/dist/zonos-elements/{p-C19J2XSh.js → p-BJzAgoqz.js} +1 -1
  253. package/dist/zonos-elements/p-BKoLoalh.js +1 -0
  254. package/dist/zonos-elements/{p-Dj-O6VfM.system.js → p-BT9_ehlh.system.js} +2 -2
  255. package/dist/zonos-elements/{p-B2EZRfoq.system.js → p-B_5RofQ9.system.js} +15 -15
  256. package/dist/zonos-elements/p-BaF00SfB.js +1 -0
  257. package/dist/zonos-elements/{p-D0erXw7p.js → p-BpDCLBwW.js} +1 -1
  258. package/dist/zonos-elements/{p-DkpYo2Fs.js → p-BtWDzGMx.js} +1 -1
  259. package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
  260. package/dist/zonos-elements/{p-CPnR_T0a.system.js → p-BuU_p5DP.system.js} +58 -58
  261. package/dist/zonos-elements/{p-D5AtAlJx.system.js → p-CASTsiDR.system.js} +3 -3
  262. package/dist/zonos-elements/{p-CaAod213.system.js → p-CBx5nYet.system.js} +1 -1
  263. package/dist/zonos-elements/{p-DIJaXkiE.system.js → p-CEmXVahp.system.js} +111 -105
  264. package/dist/zonos-elements/{p-nU86HJ5w.js → p-CUaf1cEg.js} +1 -1
  265. package/dist/zonos-elements/p-CX_vfdWt.js +1 -0
  266. package/dist/zonos-elements/p-C_z9WL8a.js +1 -0
  267. package/dist/zonos-elements/p-CcJF6xhQ.js +1 -0
  268. package/dist/zonos-elements/{p-DjuFsKLG.js → p-CewmhMGk.js} +1 -1
  269. package/dist/zonos-elements/{p-CYdt69j5.system.js → p-Cpe_ISNt.system.js} +18 -18
  270. package/dist/zonos-elements/{p-DTgv0QpG.js → p-Cuk0LLGQ.js} +1 -1
  271. package/dist/zonos-elements/p-Cxuiqv1I.js +1 -0
  272. package/dist/zonos-elements/p-DQZncB2d.system.js +9 -0
  273. package/dist/zonos-elements/{p-D-DawUYF.system.js → p-DVITR-Eu.system.js} +1 -1
  274. package/dist/zonos-elements/{p-DGsEWFDU.system.js → p-DYIisqF7.system.js} +1 -1
  275. package/dist/zonos-elements/{p-uV7m6KrY.system.js → p-DoEHepOc.system.js} +1 -1
  276. package/dist/zonos-elements/{p-DHwpNxG9.js → p-DwkyNtpD.js} +1 -1
  277. package/dist/zonos-elements/{p-CKTIJ2Gr.js → p-NJVOYjda.js} +1 -1
  278. package/dist/zonos-elements/{p-CtEsvWI6.js → p-W82paT5F.js} +1 -1
  279. package/dist/zonos-elements/{p-04bfcd72.system.entry.js → p-a571beaa.system.entry.js} +13 -13
  280. package/dist/zonos-elements/{p-5562a955.system.entry.js → p-a5c25829.system.entry.js} +3 -3
  281. package/dist/zonos-elements/{p-b68ca96f.entry.js → p-a938c174.entry.js} +1 -1
  282. package/dist/zonos-elements/{p-844a743a.entry.js → p-ab54d0a1.entry.js} +1 -1
  283. package/dist/zonos-elements/{p-9ebe9a36.entry.js → p-acd50b0b.entry.js} +1 -1
  284. package/dist/zonos-elements/{p-0f603278.system.entry.js → p-b5882fbb.system.entry.js} +2 -2
  285. package/dist/zonos-elements/{p-891b47d7.entry.js → p-ba510730.entry.js} +1 -1
  286. package/dist/zonos-elements/{p-e9320825.entry.js → p-c3b02dbf.entry.js} +1 -1
  287. package/dist/zonos-elements/{p-be64d823.system.entry.js → p-c403f004.system.entry.js} +1 -1
  288. package/dist/zonos-elements/{p-64e7bc5b.entry.js → p-c4ad6d4b.entry.js} +1 -1
  289. package/dist/zonos-elements/p-ca3175d9.entry.js +1 -0
  290. package/dist/zonos-elements/{p-a38e62cc.entry.js → p-d3d0656a.entry.js} +1 -1
  291. package/dist/zonos-elements/{p-9b6482ef.entry.js → p-d4d2b39e.entry.js} +1 -1
  292. package/dist/zonos-elements/{p-ea8790aa.entry.js → p-d6b72f6d.entry.js} +1 -1
  293. package/dist/zonos-elements/p-d74bc3e8.entry.js +1 -0
  294. package/dist/zonos-elements/p-db75322d.entry.js +1 -0
  295. package/dist/zonos-elements/p-dd8ca91e.entry.js +1 -0
  296. package/dist/zonos-elements/{p-7ae48e31.entry.js → p-ddca5ee1.entry.js} +1 -1
  297. package/dist/zonos-elements/{p-bdba7d9e.system.entry.js → p-dfc87b10.system.entry.js} +1 -1
  298. package/dist/zonos-elements/{p-e101d722.system.entry.js → p-f37b8aaf.system.entry.js} +2 -2
  299. package/dist/zonos-elements/{p-b14819ab.system.entry.js → p-fb869759.system.entry.js} +1 -1
  300. package/dist/zonos-elements/{p-i1iCWKdv.js → p-sz4L-ZnB.js} +1 -1
  301. package/dist/zonos-elements/{p-D31lQiWo.system.js → p-tGJYTlGL.system.js} +4 -4
  302. package/dist/zonos-elements/p-tkSf-lrO.system.js +13 -0
  303. package/dist/zonos-elements/{p-DPW1yXt9.system.js → p-uuZUZPIm.system.js} +61 -61
  304. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  305. package/package.json +12 -11
  306. package/dist/esm-es5/debounce-DWPsxJsW.js +0 -1
  307. package/dist/zonos-elements/p-0466650f.entry.js +0 -1
  308. package/dist/zonos-elements/p-2ba738ec.entry.js +0 -1
  309. package/dist/zonos-elements/p-3ERbuo5a.js +0 -1
  310. package/dist/zonos-elements/p-6f742021.entry.js +0 -1
  311. package/dist/zonos-elements/p-89ddab88.entry.js +0 -1
  312. package/dist/zonos-elements/p-BANhKkF2.system.js +0 -1
  313. package/dist/zonos-elements/p-BJufDgh3.js +0 -1
  314. package/dist/zonos-elements/p-BSgVcCxT.system.js +0 -9
  315. package/dist/zonos-elements/p-CQqNJo0D.system.js +0 -13
  316. package/dist/zonos-elements/p-LypTHRUC.js +0 -1
  317. package/dist/zonos-elements/p-adfee3a3.entry.js +0 -1
  318. package/dist/zonos-elements/p-f2cedbcd.system.entry.js +0 -121
  319. package/dist/zonos-elements/p-lGLcGvEA.js +0 -1
  320. package/dist/zonos-elements/p-pfIceXbY.js +0 -1
  321. package/dist/zonos-elements/p-t_ClFAJR.js +0 -1
@@ -1,4 +1,4 @@
1
- var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-CPnR_T0a.system.js","./p-DIJaXkiE.system.js","./p-BbgqQIHv.system.js","./p-zVLAvre1.system.js","./p-DW-fW8yR.system.js","./p-BSgVcCxT.system.js","./p-Cby4EkFu.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.k;a=e.l;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=e("g",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2/*return*/,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4/*yield*/,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2/*return*/,{errors:n,json:o}]}}))}))}));var O=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),A=O.reset,C=O.state;e("R",C);
1
+ var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-BuU_p5DP.system.js","./p-CEmXVahp.system.js","./p-BbgqQIHv.system.js","./p-zVLAvre1.system.js","./p-DW-fW8yR.system.js","./p-DQZncB2d.system.js","./p-Cby4EkFu.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.m;a=e.l;s=e.f;u=e.e},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=e("g",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2/*return*/,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4/*yield*/,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2/*return*/,{errors:n,json:o}]}}))}))}));var O=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),A=O.reset,C=O.state;e("R",C);
2
2
  /**
3
3
  * Reset store credit store to initial state
4
4
  */var k=e("S",(function(){A()}));
@@ -24,12 +24,12 @@ var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e ins
24
24
  * Validates against available balance and cart total
25
25
  */var N=e("a5",(function(e){if(e===null){C.amountToApply=null;C.error=null;return}
26
26
  // Validate amount
27
- if(e<=0){C.error="Amount must be greater than zero";return}if(C.availableBalance!==null&&e>C.availableBalance){C.error="Amount exceeds available balance";return}var r=Xe.total+(Xe.storeCredit||0);if(e>r){C.error="Amount exceeds order total";return}C.error=null;C.amountToApply=e}));
27
+ if(e<=0){C.error="Amount must be greater than zero";return}if(C.availableBalance!==null&&e>C.availableBalance){C.error="Amount exceeds available balance";return}var r=Qe.total+(Qe.storeCredit||0);if(e>r){C.error="Amount exceeds order total";return}C.error=null;C.amountToApply=e}));
28
28
  /**
29
29
  * Toggle whether to use full balance or custom amount.
30
30
  * When switching to custom mode, clears the applied amount so the user
31
31
  * must explicitly apply via the Apply button.
32
- */var j=e("a3",(function(e){C.useFullBalance=e;C.error=null;if(e&&C.availableBalance!==null){var r=Xe.total+(Xe.storeCredit||0);var n=Math.min(C.availableBalance,r);C.amountToApply=n}else if(!e){C.amountToApply=null}}));
32
+ */var j=e("a3",(function(e){C.useFullBalance=e;C.error=null;if(e&&C.availableBalance!==null){var r=Qe.total+(Qe.storeCredit||0);var n=Math.min(C.availableBalance,r);C.amountToApply=n}else if(!e){C.amountToApply=null}}));
33
33
  /**
34
34
  * Get the storeCreditApplication input for checkout session update.
35
35
  * Sends mode: 'NONE' when store credit is not being used to clear any
@@ -37,7 +37,7 @@ if(e<=0){C.error="Amount must be greater than zero";return}if(C.availableBalance
37
37
  */var D=function(){if(!C.isEnabled||C.amountToApply===null){return{mode:"NONE"}}if(C.useFullBalance){return{mode:"FULL"}}return{amount:C.amountToApply,mode:"PARTIAL"}};
38
38
  /**
39
39
  * Get the effective amount to apply based on settings
40
- */var L=e("K",(function(){if(!C.isEnabled||C.availableBalance===null){return 0}if(C.useFullBalance){return Math.min(C.availableBalance,Xe.total+(Xe.storeCredit||0))}return C.amountToApply||0}));
40
+ */var L=e("K",(function(){if(!C.isEnabled||C.availableBalance===null){return 0}if(C.useFullBalance){return Math.min(C.availableBalance,Qe.total+(Qe.storeCredit||0))}return C.amountToApply||0}));
41
41
  /**
42
42
  * Check whether the effective store credit amount covers the full order total.
43
43
  * When true, the Stripe/PayPal payment flow should be skipped and
@@ -49,7 +49,7 @@ if(e<=0){C.error="Amount must be greater than zero";return}if(C.availableBalance
49
49
  */var R=e("B",(function(){
50
50
  // Only consider full coverage after the backend has confirmed store credit
51
51
  // was applied (cartStore.storeCredit > 0) and the remaining total is 0.
52
- return C.amountToApply!==null&&C.amountToApply>0&&Xe.storeCredit>0&&Xe.total<=0}));
52
+ return C.amountToApply!==null&&C.amountToApply>0&&Qe.storeCredit>0&&Qe.total<=0}));
53
53
  /**
54
54
  * Create an order paid entirely by store credit.
55
55
  * Should only be called when `storeCreditStoreCoversFullAmount()` is true.
@@ -91,28 +91,28 @@ var d=Y({currentAddress:s,translatedAddress:le.translatedAddress.address});var l
91
91
  // the address as complete when both fields are filled.
92
92
  firstName:m,lastName:h,phone:f.phone},
93
93
  // Use the first item's currency code
94
- cartCurrencyCode:(r=Xe.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||a.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:le.companyName,email:o===null||o===void 0?void 0:o.value.email,
94
+ cartCurrencyCode:(r=Qe.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||a.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:le.companyName,email:o===null||o===void 0?void 0:o.value.email,
95
95
  // firstName and lastName should be valid now since stripe only mark
96
96
  // the address as complete when both fields are filled.
97
- firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Xe.promoCode?[{amount:0,productId:null,promoCode:Xe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var K=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
97
+ firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Qe.promoCode?[{amount:0,productId:null,promoCode:Qe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var K=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
98
98
  // maybe we don't need email now for prefetch the landed cost
99
99
  var r=le.stripeLinkEventData;var n=le.stripeAddressEventData;var o=le.stripeShippingSameAsBilling?le.stripeAddressEventData:le.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}
100
100
  // Attempt to get translated address if available
101
- var i=Y({currentAddress:n,translatedAddress:le.translatedAddress.address});var a=W({name:i.name}),s=a.firstName,u=a.lastName;var l=Y({currentAddress:o,translatedAddress:le.translatedAddress.address});var c=W({name:l.name}),v=c.firstName,f=c.lastName;var p=Xe.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Xe.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Xe.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{
101
+ var i=Y({currentAddress:n,translatedAddress:le.translatedAddress.address});var a=W({name:i.name}),s=a.firstName,u=a.lastName;var l=Y({currentAddress:o,translatedAddress:le.translatedAddress.address});var c=W({name:l.name}),v=c.firstName,f=c.lastName;var p=Qe.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Qe.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Qe.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{
102
102
  // firstName and lastName should be valid now since stripe only mark
103
103
  // the address as complete when both fields are filled.
104
104
  firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:le.companyName,email:r===null||r===void 0?void 0:r.value.email,
105
105
  // firstName and lastName should be valid now since stripe only mark
106
106
  // the address as complete when both fields are filled.
107
- firstName:s,lastName:u,phone:i.phone},isTest:e,items:Xe.items,landedCostAdjustments:m,shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=K();return[4/*yield*/,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,
107
+ firstName:s,lastName:u,phone:i.phone},isTest:e,items:Qe.items,landedCostAdjustments:m,shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=K();return[4/*yield*/,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,
108
108
  // zonosApiKey should always be available
109
- publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Xe.promoCode})];case 1:s=v.sent();if(!s||
109
+ publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Qe.promoCode})];case 1:s=v.sent();if(!s||
110
110
  // Only show errors if there are no rate back (checkoutSessionWorkflow) and there are errors
111
111
  !((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4/*yield*/,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2/*return*/,s]}}))}))};var G=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3/*break*/,2];return[4/*yield*/,V(t)];case 1:o=d.sent();return[2/*return*/,o];case 2:return[4/*yield*/,c("/api/zonos-elements/calculate-landed-cost",{body:K(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}
112
112
  // We want to show any successful quotes even if there are errors
113
113
  a.forEach((function(e){
114
114
  // eslint-disable-next-line no-console
115
- console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2/*return*/,s]}return[2/*return*/,s]}}))}))};var X=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,c("/api/zonos-elements/cart-calculate-landed-cost",{body:H(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2/*return*/,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var Z=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3/*break*/,2];return[4/*yield*/,G(e)];case 1:n=a.sent();return[2/*return*/,n];case 2:return[4/*yield*/,X({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2/*return*/,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var $=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();i=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=
115
+ console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2/*return*/,s]}return[2/*return*/,s]}}))}))};var Q=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,c("/api/zonos-elements/cart-calculate-landed-cost",{body:H(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2/*return*/,u]}}))}))};var X=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var Z=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3/*break*/,2];return[4/*yield*/,G(e)];case 1:n=a.sent();return[2/*return*/,n];case 2:return[4/*yield*/,Q({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=X(t,["cartWorkflow"]);return[2/*return*/,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var $=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();i=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=
116
116
  // if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
117
117
  window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&
118
118
  // if found, it means we want to test the conversion event in development site, or test mode and staging mode
@@ -202,17 +202,17 @@ le.stripe=window.Zonos.stripe}));var we=function(){var e,r,n,t;var o=JSON.string
202
202
  /**
203
203
  * If user updates the address after prefetching the landed cost, should always create and attach
204
204
  * @caveat this will cause the scenario goes wrong after prefetching landed cost, with the current logic, it won't create party because nothing change after the prefetch happened
205
- */var u=(e=Xe.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Xe.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;
205
+ */var u=(e=Qe.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Qe.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;
206
206
  // If haven't prefetched landed cost, there is no need to update address async
207
207
  if(!u||!d){return false}
208
208
  // If we don't have landed cost parties data, should way
209
209
  if(le.partyShippingId!==u||le.partyBillingId!==d){return true}var l=JSON.stringify((n=le.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=le.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=le.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=le.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!le.stripeShippingSameAsBilling&&JSON.stringify((a=le.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=le.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=le.taxIdUsedWhenAsyncAddressUpdate!==le.taxId;var p=le.companyNameUsedWhenAsyncAddressUpdate!==le.companyName;return l||c||v||f||p};var ge=e("a0",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=W({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var be=e("X",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=le.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!le.stripeShippingSameAsBilling&&!((r=le.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!le.stripeBillingAddressEventData){return[2/*return*/,{partiesCreated:false}]}
210
210
  // If there is no landed cost data, no need to create parties
211
- if(!Xe.landedCostData){return[2/*return*/,{partiesCreated:false}]}i=(n=Xe.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){
211
+ if(!Qe.landedCostData){return[2/*return*/,{partiesCreated:false}]}i=(n=Qe.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){
212
212
  // do nothing if we don't have selected landed cost
213
213
  void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2/*return*/,{partiesCreated:false}]}a=ye();if(!a){return[2/*return*/,{partiesCreated:false}]}s=ge({address:le.stripeAddressEventData.value.address,firstName:le.stripeAddressEventData.value.firstName,lastName:le.stripeAddressEventData.value.lastName,name:le.stripeAddressEventData.value.name,phone:le.stripeAddressEventData.value.phone});u=le.stripeShippingSameAsBilling?s:ge({address:le.stripeBillingAddressEventData.value.address,firstName:le.stripeBillingAddressEventData.value.firstName,lastName:le.stripeBillingAddressEventData.value.lastName,name:le.stripeBillingAddressEventData.value.name,phone:le.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4/*yield*/,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:le.companyName,email:((o=le.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:le.shortAddressCode,taxId:le.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2/*return*/,{partiesCreated:false}]}le.companyNameUsedWhenAsyncAddressUpdate=le.companyName;le.stripeAddressUsedWhenAsyncAddressUpdate=le.stripeAddressEventData;le.stripeBillingAddressUsedWhenAsyncAddressUpdate=le.stripeBillingAddressEventData;le.taxIdUsedWhenAsyncAddressUpdate=le.taxId;le.partyBillingId=m.billToPartyId;le.partyShippingId=m.shipToPartyId;
214
214
  // Update parties data with the new parties id
215
- Xe.partiesData=Xe.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2/*return*/,{partiesCreated:true}]}}))}))}));
215
+ Qe.partiesData=Qe.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2/*return*/,{partiesCreated:true}]}}))}))}));
216
216
  /**
217
217
  * Extract only the necessary address info for landed cost prefetch
218
218
  */var _e=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Se=function(){var e,r;var n=JSON.stringify((e=le.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=le.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=le.stripeAddressEventData&&JSON.stringify(_e(le.stripeAddressEventData.value))!==JSON.stringify(le.stripeAddressUsedWhenFetchingLC);var o=!le.stripeShippingSameAsBilling&&le.stripeBillingAddressEventData&&JSON.stringify(_e(le.stripeBillingAddressEventData.value))!==JSON.stringify(le.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};
@@ -221,28 +221,28 @@ Xe.partiesData=Xe.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!=
221
221
  * Purpose is to resend the request if the info used when fetching landed cost is different from the current info
222
222
  */var Oe=function(){var e;
223
223
  // Mark the landed cost is outdated since the item total amount has changed (items total didn't match with the cart subtotal)
224
- var r=Xe.landedCostData&&((e=Xe.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Xe.subtotal;var n=Se();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});
224
+ var r=Qe.landedCostData&&((e=Qe.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Qe.subtotal;var n=Se();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});
225
225
  // if landed cost data is not available, we need to fetch it
226
- return!Xe.landedCostData&&!le.isFetchingLandedCost||n||r};var Ae=e("W",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;
226
+ return!Qe.landedCostData&&!le.isFetchingLandedCost||n||r};var Ae=e("W",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;
227
227
  /**
228
228
  * 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
229
229
  * 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
230
- **/if(Xe.addressFormRenderType==="stripe"){return a||s}return s}));var Ce=function(){var e,r,n,t;var o=!!((e=le.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=le.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=le.stripeShippingSameAsBilling?i:!!((n=le.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=le.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ae(s);if(i&&a&&o){return true}
230
+ **/if(Qe.addressFormRenderType==="stripe"){return a||s}return s}));var Ce=function(){var e,r,n,t;var o=!!((e=le.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=le.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=le.stripeShippingSameAsBilling?i:!!((n=le.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=le.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ae(s);if(i&&a&&o){return true}
231
231
  // Only send landed cost request if the address is complete when we can't get the country field
232
232
  if(!u||!le.stripeAddressEventData){return i&&a&&o}var d=le.stripeAddressEventData.value.address.line1.length>0;var l=le.stripeAddressEventData.value.firstName&&le.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&le.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&le.stripeAddressEventData.value.address.postal_code.length>=3;var f=le.stripeAddressEventData.value.phone&&le.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var ke=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;le.fetchingLandedCostAbortController=r;
233
233
  // Reset cart items to non-restricted state and restricted item list
234
234
  pr();return[4/*yield*/,Z(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;
235
235
  // Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
236
236
  // constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
237
- Xe.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Xe.shippingData=ne((d===null||d===void 0?void 0:d.filter(Boolean))||[]);
237
+ Qe.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Qe.shippingData=ne((d===null||d===void 0?void 0:d.filter(Boolean))||[]);
238
238
  // check and update cart items with restrictions
239
239
  er(a);
240
240
  // reset abort controller after we are done
241
- le.fetchingLandedCostAbortController=null;Xe.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];
241
+ le.fetchingLandedCostAbortController=null;Qe.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];
242
242
  // update cart store with landed cost info
243
- Xe.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void $({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Xe.promoCodeApplied&&!Xe.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Xe.promoCodeError=c;
243
+ Qe.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void $({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Qe.promoCodeApplied&&!Qe.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Qe.promoCodeError=c;
244
244
  // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
245
- if(!c){sessionStorage.setItem("zonos--promo-code",Xe.promoCode)}return[2/*return*/]}}))}))};var Ie=e("w",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=Ce();
245
+ if(!c){sessionStorage.setItem("zonos--promo-code",Qe.promoCode)}return[2/*return*/]}}))}))};var Ie=e("w",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=Ce();
246
246
  // Should not do anything if the address is not ready to request landed cost
247
247
  if(!u){return[2/*return*/,{isRequestNotReady:true}]}if(s){
248
248
  // if the info used when fetching landed cost is different from the current info, abort the previous request
@@ -256,25 +256,25 @@ pr();
256
256
  // fetch and apply landed cost
257
257
  return[4/*yield*/,ke()];case 2:
258
258
  // fetch and apply landed cost
259
- w.sent();d=(n=Xe.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Xe.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){
259
+ w.sent();d=(n=Qe.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Qe.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){
260
260
  // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
261
261
  or({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3/*break*/,7];case 3:f=w.sent();
262
262
  // default to empty array if we failed to fetch landed cost, so we can show the error message
263
- Xe.landedCostData=[];Xe.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3/*break*/,6];if(!(i<1))return[3/*break*/,5];
263
+ Qe.landedCostData=[];Qe.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3/*break*/,6];if(!(i<1))return[3/*break*/,5];
264
264
  // retry fetching landed cost one more time
265
265
  return[4/*yield*/,Ie(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:
266
266
  // retry fetching landed cost one more time
267
267
  w.sent();return[2/*return*/,{isRequestNotReady:false}];case 5:m=(o=le.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3/*break*/,7];case 7:le.isFetchingLandedCost=false;return[2/*return*/,{isRequestNotReady:false}]}}))}))}));var Te=e("N",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4/*yield*/,Ie({applyingPromocode:true})];case 1:o.sent();
268
268
  // Go back to shipping step if we are in payment step so user can reselect shipping method
269
- if(Xe.step==="payment"){wr()}
269
+ if(Qe.step==="payment"){wr()}
270
270
  // async update address with new root id from the new quote
271
271
  return[4/*yield*/,be()];case 2:
272
272
  // async update address with new root id from the new quote
273
- o.sent();n=(e=Xe.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Xe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2/*return*/]}return[4/*yield*/,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2/*return*/]}}))}))}));var Ee=e("P",(function(){Xe.promoCode="";sessionStorage.removeItem("zonos--promo-code");
273
+ o.sent();n=(e=Qe.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Qe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2/*return*/]}return[4/*yield*/,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2/*return*/]}}))}))}));var Ee=e("P",(function(){Qe.promoCode="";sessionStorage.removeItem("zonos--promo-code");
274
274
  // reset promocode error state
275
- Xe.promoCodeError=false;Xe.promoCodeApplied=false}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:
275
+ Qe.promoCodeError=false;Qe.promoCodeApplied=false}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:
276
276
  // Go back to shipping step if we are in payment step so user can reselect shipping method
277
- if(Xe.step==="payment"){wr()}Ee();return[4/*yield*/,Te()];case 1:e.sent();return[2/*return*/]}}))}))}));var Ne=e("Q",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;
277
+ if(Qe.step==="payment"){wr()}Ee();return[4/*yield*/,Te()];case 1:e.sent();return[2/*return*/]}}))}))}));var Ne=e("Q",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;
278
278
  // Inspect the PaymentIntent `status` to indicate the status of the payment
279
279
  // to your customer.
280
280
 
@@ -287,7 +287,7 @@ switch(e){case"succeeded":{r=[o("Your payment went through successfully! Thank y
287
287
  * Handle inventory check and returns error message if the callback provided.
288
288
  */var je=e("n",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3/*break*/,2];return[4/*yield*/,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2/*return*/,null]}
289
289
  // Proceed if the item is available
290
- if(!u.available||u.status===204){return[2/*return*/,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){le.shouldInventoryRefund=true;return[2/*return*/,null]}return[2/*return*/,null];case 2:if(typeof t!=="function"){return[2/*return*/,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4/*yield*/,t({items:Xe.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2/*return*/,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Xe.items}});throw l;case 6:return[2/*return*/]}}))}))}));
290
+ if(!u.available||u.status===204){return[2/*return*/,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){le.shouldInventoryRefund=true;return[2/*return*/,null]}return[2/*return*/,null];case 2:if(typeof t!=="function"){return[2/*return*/,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4/*yield*/,t({items:Qe.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2/*return*/,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Qe.items}});throw l;case 6:return[2/*return*/]}}))}))}));
291
291
  /**
292
292
  * Handle inventory check and returns error message if the callback provided.
293
293
  */var De=e("F",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);
@@ -301,7 +301,7 @@ t.sent();return[2/*return*/]}}))}))}));var Le=e("c",(function(e){return __awaite
301
301
  // secret) can't be evaluated by Stripe. Do not treat it as a successful Stripe
302
302
  // payment — return an error so callers don't run success analytics / order
303
303
  // polling off a secret Stripe never confirmed.
304
- if(!i.includes("_secret_")){return[2/*return*/,{error:true,messages:[o("Something went wrong.")]}]}return[4/*yield*/,le.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=Ne(s),d=u.isError,l=u.messages;return[2/*return*/,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("E",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=le.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=le.stripeElements;s=le.stripe;u=le.clientSecret;le.customErrorMessage=null;if(!((n=Xe.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4/*yield*/,te()];case 1:l=h.sent();if(!l.valid){le.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3/*break*/,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void $({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4/*yield*/,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){
304
+ if(!i.includes("_secret_")){return[2/*return*/,{error:true,messages:[o("Something went wrong.")]}]}return[4/*yield*/,le.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=Ne(s),d=u.isError,l=u.messages;return[2/*return*/,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("E",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=le.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=le.stripeElements;s=le.stripe;u=le.clientSecret;le.customErrorMessage=null;if(!((n=Qe.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4/*yield*/,te()];case 1:l=h.sent();if(!l.valid){le.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3/*break*/,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void $({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4/*yield*/,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){
305
305
  // PaymentIntent was canceled or expired, or status is `require_capture`.
306
306
  // don't throw error here because we will reset the checkout session last step
307
307
  return[2/*return*/]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){
@@ -326,7 +326,7 @@ acceptedAt:J.acceptedAt||(new Date).toISOString(),locale:a.selectedLocale,polici
326
326
  * determined server-side by the billing company; this override is primarily used
327
327
  * for testing. Returns `undefined` when the param is missing or not a valid
328
328
  * processor.
329
- */var Ue=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(ae).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var ze=e("q",(function(){var e;var r=Xe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Xe.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Xe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Xe.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:a.selectedLocale}],paymentProcessor:Ue(),presentmentCountryCode:a.selectedCountryCode,skipPaymentIntent:le.skipPaymentIntent,varianceTestInput:n};return o}));var Be=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){
329
+ */var Ue=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(ae).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var ze=e("q",(function(){var e;var r=Qe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Qe.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Qe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Qe.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:a.selectedLocale}],paymentProcessor:Ue(),presentmentCountryCode:a.selectedCountryCode,skipPaymentIntent:le.skipPaymentIntent,varianceTestInput:n};return o}));var Be=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){
330
330
  // We want to log the error anytime we fail to create a checkout session
331
331
  void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});tr({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2/*return*/]}return[4/*yield*/,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));
332
332
  // We want to log the error anytime we fail to create a payment intent
@@ -340,7 +340,7 @@ sr(i.checkoutSessionPaymentIntentCreate);return[2/*return*/]}}))}))}));
340
340
  // check if the error is related to expired cart and thow error so we can show error message accordingly
341
341
  if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2/*return*/,false]}u=i.checkoutSessionCreate;
342
342
  // update cart store with updated information
343
- sr(u);or({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Xe.exchangeRate);d("done-init-checkout-session");return[2/*return*/,true]}}))}))}));var Je=e("z",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;
343
+ sr(u);or({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Qe.exchangeRate);d("done-init-checkout-session");return[2/*return*/,true]}}))}))}));var Je=e("z",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;
344
344
  // Checkout session id should be available at this point
345
345
  if(!e){v("Failed to update checkout session base currency");return[2/*return*/,false]}
346
346
  // Only update checkout session currency if setting is enabled
@@ -349,7 +349,7 @@ if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlemen
349
349
  if(!r||o!==le.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2/*return*/,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2/*return*/,true]}}))}))}));
350
350
  /**
351
351
  * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
352
- */var Me=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4/*yield*/,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:le.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Xe.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:a.selectedLocale}],presentmentCountryCode:m,shipToPartyId:le.partyShippingId,skipPaymentIntent:le.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,i=n.json;if(o.length||!i){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2/*return*/,{errors:o,json:i}]}return[2/*return*/,{errors:[],json:i}]}}))}))};
352
+ */var Me=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4/*yield*/,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:le.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Qe.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:a.selectedLocale}],presentmentCountryCode:m,shipToPartyId:le.partyShippingId,skipPaymentIntent:le.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,i=n.json;if(o.length||!i){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2/*return*/,{errors:o,json:i}]}return[2/*return*/,{errors:[],json:i}]}}))}))};
353
353
  /**
354
354
  * Pushes the buyer's policy consent into the checkout session's metadata via the
355
355
  * dedicated metadata-only mutation. Called from the payment continue handler so
@@ -409,7 +409,7 @@ if(e&&le.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){session
409
409
  // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
410
410
  promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},
411
411
  // eslint-disable-next-line sort-keys/sort-keys-fix
412
- payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ke.onChange,Ge=Ke.reset,Xe=Ke.state;e({I:Ve,d:Xe});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};
412
+ payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ke.onChange,Ge=Ke.reset,Qe=Ke.state;e({I:Ve,d:Qe});var Xe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};
413
413
  /**
414
414
  * Format shipping transit info to be displayed on UI
415
415
  * @returns
@@ -418,25 +418,25 @@ payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=K
418
418
  * - minTransit: 3
419
419
  */var Ze=e("Z",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;
420
420
  // Don't care about falsy 0 values because this is international shipping and 0 days is not feasible
421
- if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var $e=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};
421
+ if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Xe(n.type)}}));var $e=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};
422
422
  /**
423
423
  * Check and set restricted items in cart
424
- */var er=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Xe.items.find((function(r){return $e({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Xe.restrictedItems=r;
424
+ */var er=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Qe.items.find((function(r){return $e({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Qe.restrictedItems=r;
425
425
  // remove items that are restricted from cart
426
- Xe.items=Xe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return $e({item1:r,item2:e})}))})}));return{cartItems:Xe.items,restrictedItems:r}};var rr=null;var nr=e("f",(function(){t.checkoutSessionId=null;
426
+ Qe.items=Qe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return $e({item1:r,item2:e})}))})}));return{cartItems:Qe.items,restrictedItems:r}};var rr=null;var nr=e("f",(function(){t.checkoutSessionId=null;
427
427
  // clear pending store credit debounce timer
428
428
  if(rr){clearTimeout(rr);rr=null}
429
429
  // reset store credit store
430
430
  k();
431
431
  // reset cart store
432
- Ge()}));var tr=e("r",(function(e){var r=e.messages,n=e.title;nr();he();Xe.step="error";Xe.error={messages:r,title:n}}));var or=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;
432
+ Ge()}));var tr=e("r",(function(e){var r=e.messages,n=e.title;nr();he();Qe.step="error";Qe.error={messages:r,title:n}}));var or=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;
433
433
  // update exchange rate so we can use it to display cart items
434
- Xe.exchangeRate=t.exchangeRate;Xe.adjustmentTotal=t.adjustments;Xe.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Xe.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Xe.subtotal=t.items;Xe.total=t.total;Xe.currency=t.presentmentCurrencyCode;Xe.dutiesTaxesFeesEstimate=r||null};
434
+ Qe.exchangeRate=t.exchangeRate;Qe.adjustmentTotal=t.adjustments;Qe.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Qe.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Qe.subtotal=t.items;Qe.total=t.total;Qe.currency=t.presentmentCurrencyCode;Qe.dutiesTaxesFeesEstimate=r||null};
435
435
  /**
436
436
  * Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
437
437
  */var ir=e("L",(function(){
438
438
  // filter all items with positive amount
439
- var e=Xe.items.filter((function(e){return e.amount>0}));
439
+ var e=Qe.items.filter((function(e){return e.amount>0}));
440
440
  // only check restricted status for items with positive amount
441
441
  // if there is no item restricted found => all items are restricted
442
442
  return!!e.find((function(e){return!e.isRestricted}))}));
@@ -447,9 +447,9 @@ return!!e.find((function(e){return!e.isRestricted}))}));
447
447
  * Single source of truth for this detection — previously duplicated inline
448
448
  * at each call site, which let one of them (the forceDialogOpen/preview init
449
449
  * path) miss it entirely.
450
- */var ar=e("m",(function(){var e,r;return!!(((r=(e=Xe.checkoutSession)===null||e===void 0?void 0:e.order)===null||r===void 0?void 0:r.id)&&!Xe.checkoutSession.completedAt)}));var sr=e("v",(function(e){var r,n,o,i,a,c,v;
450
+ */var ar=e("m",(function(){var e,r;return!!(((r=(e=Qe.checkoutSession)===null||e===void 0?void 0:e.order)===null||r===void 0?void 0:r.id)&&!Qe.checkoutSession.completedAt)}));var sr=e("v",(function(e){var r,n,o,i,a,c,v;
451
451
  // update stripe store with updated information
452
- le.clientSecret=e.clientSecret;le.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;le.customerProfile=e.customerProfile;Xe.checkoutSession=e;
452
+ le.clientSecret=e.clientSecret;le.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;le.customerProfile=e.customerProfile;Qe.checkoutSession=e;
453
453
  // Populate store credit balance from checkout session customer profile
454
454
  I((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){
455
455
  // Log error to track down the issue
@@ -459,14 +459,14 @@ if(e.id){t.checkoutSessionId=e.id}
459
459
  // Filter the response to only include test keys that we support and then save it to the session
460
460
  var f=s(e.varianceTestResults||[]);u(f);
461
461
  // Check if there is a redirect URL in the metadata to override
462
- var p=((a=(i=(o=Xe.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||(
462
+ var p=((a=(i=(o=Qe.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||(
463
463
  // Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
464
- (v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Xe.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,i,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Xe.selectedLandedCost){n=Xe.selectedLandedCost.subtotals;or({dutiesTaxesFeesEstimate:m,method:Xe.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Xe.exchangeRate)}
464
+ (v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Qe.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,i,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Qe.selectedLandedCost){n=Qe.selectedLandedCost.subtotals;or({dutiesTaxesFeesEstimate:m,method:Qe.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Qe.exchangeRate)}
465
465
  // update checkout session
466
466
  if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2/*return*/,false]}return[4/*yield*/,Me({adjustmentsAmount:c,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:a.selectedCountryCode})];case 1:i=e.sent(),s=i.errors,u=i.json;if(!(s.length>0||!u))return[3/*break*/,4];v("Error occurs when updating checkout session.");if(!y)return[3/*break*/,3];d("Initiating checkout session on failure","info");return[4/*yield*/,Fe()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){tr({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2/*return*/,false]}return[2/*return*/,true];case 3:return[2/*return*/,false];case 4:if(!w){
467
467
  // This is when we first open the checkout modal and we just want to get info from the old cart session.
468
468
  // use subtotals from checkout session to update cart total
469
- or({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Xe.exchangeRate)}sr(u.checkoutSessionUpdate);return[2/*return*/,true]}}))}))};
469
+ or({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Qe.exchangeRate)}sr(u.checkoutSessionUpdate);return[2/*return*/,true]}}))}))};
470
470
  /**
471
471
  * For some service levels, the landed cost that's DAP and we do remittance on behalf of the merchant, these landed cost should be treated as DDP
472
472
  */var dr=e("_",(function(e,r){var t,o,i,a;
@@ -474,41 +474,41 @@ or({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.m
474
474
  if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=le.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}
475
475
  // EU 3-EUR cutover (05CHECK-893): keep EU POSTAL remittance quotes as DAP so
476
476
  // the shopper is told duties are paid upon delivery, even though we remit.
477
- if(He({deliveryType:r,landedCost:e,shipToCountry:(a=le.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("Y",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,O,A,C,k,I,T;var E=e.applySubtotalsOnly,P=e.landedCostId,N=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:P,selectedShippingOption:N});Xe.selectedShippingOption=N;m=Ze(Xe.selectedShippingOption);if(m){h=m.maxTransit,w=m.minTransit,y=m.unit;Xe.selectedShippingOptionTransitTime="".concat(w,"-").concat(h," ").concat(y)}else{Xe.selectedShippingOptionTransitTime=""}g=(r=Xe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===P}));
477
+ if(He({deliveryType:r,landedCost:e,shipToCountry:(a=le.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("Y",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,O,A,C,k,I,T;var E=e.applySubtotalsOnly,P=e.landedCostId,N=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:P,selectedShippingOption:N});Qe.selectedShippingOption=N;m=Ze(Qe.selectedShippingOption);if(m){h=m.maxTransit,w=m.minTransit,y=m.unit;Qe.selectedShippingOptionTransitTime="".concat(w,"-").concat(h," ").concat(y)}else{Qe.selectedShippingOptionTransitTime=""}g=(r=Qe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===P}));
478
478
  // save selected landed cost for later use
479
- Xe.selectedLandedCost=g||null;if(!g){
479
+ Qe.selectedLandedCost=g||null;if(!g){
480
480
  // do nothing if we can't find landed cost for selected shipping option
481
- return[2/*return*/,false]}b=((t=g.landedCost.amountSubtotals)===null||t===void 0?void 0:t.landedCostTotal)||0;_=g.subtotals.exchangeRate.rate;S=b*_;if(S){d("DAP quote, using estimate: ".concat(S),"info")}Xe.landedCostMethod=dr(g.landedCost,(o=N.shippingProfile)===null||o===void 0?void 0:o.serviceLevel.deliveryType);
481
+ return[2/*return*/,false]}b=((t=g.landedCost.amountSubtotals)===null||t===void 0?void 0:t.landedCostTotal)||0;_=g.subtotals.exchangeRate.rate;S=b*_;if(S){d("DAP quote, using estimate: ".concat(S),"info")}Qe.landedCostMethod=dr(g.landedCost,(o=N.shippingProfile)===null||o===void 0?void 0:o.serviceLevel.deliveryType);
482
482
  // update shipping value and dutiesTaxFees on selectedShippingOption change
483
- Xe.shipping=g.subtotals.shipping;O=((i=g===null||g===void 0?void 0:g.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";A=!!((s=(a=g===null||g===void 0?void 0:g.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Xe.isSelectedShippingAboveDeminimis=A;Xe.isSelectedShippingGuarantee=O;C=false;if(!E)return[3/*break*/,1];k=g.subtotals;or({dutiesTaxesFeesEstimate:S,method:Xe.landedCostMethod,subtotals:k});d("Exchange rate updated for cart items (landed cost subtotal)","info",Xe.exchangeRate);C=true;return[3/*break*/,3];case 1:return[4/*yield*/,ur({adjustmentsAmount:Xe.adjustmentTotal,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(u=g.landedCost)===null||u===void 0?void 0:u.id})];case 2:
483
+ Qe.shipping=g.subtotals.shipping;O=((i=g===null||g===void 0?void 0:g.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";A=!!((s=(a=g===null||g===void 0?void 0:g.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Qe.isSelectedShippingAboveDeminimis=A;Qe.isSelectedShippingGuarantee=O;C=false;if(!E)return[3/*break*/,1];k=g.subtotals;or({dutiesTaxesFeesEstimate:S,method:Qe.landedCostMethod,subtotals:k});d("Exchange rate updated for cart items (landed cost subtotal)","info",Qe.exchangeRate);C=true;return[3/*break*/,3];case 1:return[4/*yield*/,ur({adjustmentsAmount:Qe.adjustmentTotal,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(u=g.landedCost)===null||u===void 0?void 0:u.id})];case 2:
484
484
  // update session with selected landed cost
485
- C=e.sent();e.label=3;case 3:I=(l=Xe.items.find(Boolean))===null||l===void 0?void 0:l.currencyCode;T=((c=le.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";
485
+ C=e.sent();e.label=3;case 3:I=(l=Qe.items.find(Boolean))===null||l===void 0?void 0:l.currencyCode;T=((c=le.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";
486
486
  // Only show pay in USD button if item's currency is in USD, the setting is enabled and the order presentment currency is not USD, also only in USD settlement ship to country list
487
- le.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((v=Xe.checkoutSession)===null||v===void 0?void 0:v.subtotals.presentmentCurrencyCode)!=="USD"&&!!((p=(f=n.genericSettings)===null||f===void 0?void 0:f.usdSettlementCountryEnabled)===null||p===void 0?void 0:p.includes(T));return[2/*return*/,C]}}))}))}));var cr=e("o",(function(e){var r=e.isPreview,n=e.sessionTimeout;
487
+ le.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((v=Qe.checkoutSession)===null||v===void 0?void 0:v.subtotals.presentmentCurrencyCode)!=="USD"&&!!((p=(f=n.genericSettings)===null||f===void 0?void 0:f.usdSettlementCountryEnabled)===null||p===void 0?void 0:p.includes(T));return[2/*return*/,C]}}))}))}));var cr=e("o",(function(e){var r=e.isPreview,n=e.sessionTimeout;
488
488
  // do nothing if in preview mode
489
489
  if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=
490
490
  // timeout query is mainly for testing purpose
491
- t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Xe.checkoutTimeoutInterval=setTimeout((function(){Xe.checkoutSessionTimeoutShow=true}),o)}));var vr=e("j",(function(){if(Xe.checkoutTimeoutInterval){clearTimeout(Xe.checkoutTimeoutInterval);Xe.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){
491
+ t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Qe.checkoutTimeoutInterval=setTimeout((function(){Qe.checkoutSessionTimeoutShow=true}),o)}));var vr=e("j",(function(){if(Qe.checkoutTimeoutInterval){clearTimeout(Qe.checkoutTimeoutInterval);Qe.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){
492
492
  // mark all items as not restricted
493
- Xe.items=Xe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Xe.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,u=e.shouldInitSessionOnFailure,d=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:
493
+ Qe.items=Qe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Qe.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,u=e.shouldInitSessionOnFailure,d=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:
494
494
  // Update adjustments and items
495
- Xe.adjustments=i;Xe.items=fr(a);n=(r=a.find(Boolean))===null||r===void 0?void 0:r.currencyCode;t=a.reduce((function(e,r){return e+r.amount*r.quantity}),0);o=i.reduce((function(e,r){return e+r.amount}),0);if(!n||!t){
495
+ Qe.adjustments=i;Qe.items=fr(a);n=(r=a.find(Boolean))===null||r===void 0?void 0:r.currencyCode;t=a.reduce((function(e,r){return e+r.amount*r.quantity}),0);o=i.reduce((function(e,r){return e+r.amount}),0);if(!n||!t){
496
496
  // do nothing if we can't get currency or total
497
- return[2/*return*/]}Xe.currency=n;
497
+ return[2/*return*/]}Qe.currency=n;
498
498
  // set loading state here because this is the first load checkout session when we already have checkout session id stored
499
- le.isFetchingSession=true;return[4/*yield*/,ur({adjustmentsAmount:o,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:t,landedCostId:s,shouldInitSessionOnFailure:d})];case 1:e.sent();le.isFetchingSession=false;return[2/*return*/]}}))}))}));var hr=function(){Xe.selectedShippingOption=null;Xe.isSelectedShippingAboveDeminimis=false;Xe.isSelectedShippingGuarantee=false;Xe.selectedShippingOptionTransitTime="";Xe.dutiesTaxesFees=0;Xe.dutiesTaxesFeesEstimate=0;Xe.shipping=0;
499
+ le.isFetchingSession=true;return[4/*yield*/,ur({adjustmentsAmount:o,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:t,landedCostId:s,shouldInitSessionOnFailure:d})];case 1:e.sent();le.isFetchingSession=false;return[2/*return*/]}}))}))}));var hr=function(){Qe.selectedShippingOption=null;Qe.isSelectedShippingAboveDeminimis=false;Qe.isSelectedShippingGuarantee=false;Qe.selectedShippingOptionTransitTime="";Qe.dutiesTaxesFees=0;Qe.dutiesTaxesFeesEstimate=0;Qe.shipping=0;
500
500
  // reset total to subtotal
501
- Xe.total=Xe.subtotal};var wr=function(){if(Xe.step==="shipping"){Xe.step="customer-info";
501
+ Qe.total=Qe.subtotal};var wr=function(){if(Qe.step==="shipping"){Qe.step="customer-info";
502
502
  // set shipping step to done
503
- Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})})}else if(Xe.step==="payment"){Xe.step="shipping";
503
+ Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{"customer-info":Object.assign(Object.assign({},Qe.tabItems.shipping),{isDone:false})})}else if(Qe.step==="payment"){Qe.step="shipping";
504
504
  // set shipping step to done
505
- Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})})}else if(Xe.step==="finish"){Xe.step="payment";
505
+ Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{shipping:Object.assign(Object.assign({},Qe.tabItems.shipping),{isDone:false})})}else if(Qe.step==="finish"){Qe.step="payment";
506
506
  // set shipping step to done
507
- Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{payment:Object.assign(Object.assign({},Xe.tabItems.payment),{isDone:false})})}};var yr=e("x",(function(){if(Xe.step==="customer-info"){Xe.step="shipping";
507
+ Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{payment:Object.assign(Object.assign({},Qe.tabItems.payment),{isDone:false})})}};var yr=e("x",(function(){if(Qe.step==="customer-info"){Qe.step="shipping";
508
508
  // set customer-info step to done
509
- Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems["customer-info"]),{isDone:true})})}else if(Xe.step==="shipping"){Xe.step="payment";
509
+ Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{"customer-info":Object.assign(Object.assign({},Qe.tabItems["customer-info"]),{isDone:true})})}else if(Qe.step==="shipping"){Qe.step="payment";
510
510
  // set shipping step to done
511
- Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:true})})}else if(Xe.step==="payment"){Xe.step="finish"}}));var gr=e("h",(function(){Xe.step="customer-info";Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Xe.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2/*return*/]}n=Xe.selectedLandedCost;o=Xe.currency||((e=Xe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";i=Xe.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Xe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4/*yield*/,Me({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:a.selectedCountryCode,storeCreditApplication:D()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2/*return*/]}
511
+ Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{shipping:Object.assign(Object.assign({},Qe.tabItems.shipping),{isDone:true})})}else if(Qe.step==="payment"){Qe.step="finish"}}));var gr=e("h",(function(){Qe.step="customer-info";Qe.tabItems=Object.assign(Object.assign({},Qe.tabItems),{"customer-info":Object.assign(Object.assign({},Qe.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Qe.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Qe.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2/*return*/]}n=Qe.selectedLandedCost;o=Qe.currency||((e=Qe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";i=Qe.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Qe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4/*yield*/,Me({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:a.selectedCountryCode,storeCreditApplication:D()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2/*return*/]}
512
512
  // Apply updated subtotals from the response
513
513
  or({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2/*return*/]}}))}))};
514
514
  /**