@zonos/elements 1.3.268 → 1.3.270

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 (163) hide show
  1. package/dist/cjs/{cart-af7c024e.js → cart-3ff48a0e.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-0fa6e022.js → hasInclusivePrice-aec06153.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-c2e3f232.js → invoice-ff716652.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-6014787b.js → isCollectMobileTablet-3ac53cab.js} +2 -2
  6. package/dist/cjs/{localization-f897bc45.js → localization-5c1c9c6a.js} +245 -4
  7. package/dist/cjs/{paypal-6756a0da.js → paypal-c55b6c45.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-a4874e51.js → placeTestOrder-230f534b.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-584d50fe.js → renderCheckoutCurrency-e9d8efa8.js} +2 -2
  10. package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +6 -6
  14. package/dist/cjs/zonos-checkout.cjs.entry.js +15 -72
  15. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  17. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-hello.cjs.entry.js +2 -45
  23. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  24. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  25. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  27. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
  28. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +2 -44
  29. package/dist/collection/components/store/hello/localization.js +12 -1
  30. package/dist/collection/components/utils/checkout/bigcommerceStorefrontApi.js +28 -0
  31. package/dist/collection/components/utils/checkout/removeBigcommerceCartShipping.js +83 -0
  32. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +6 -2
  33. package/dist/collection/components/utils/hello/shouldShowHelloWidget.js +61 -0
  34. package/dist/collection/utils/toggleBigcommerceNativeCurrencySelector.js +2 -1
  35. package/dist/esm/{cart-68c16805.js → cart-44fa77ef.js} +1 -1
  36. package/dist/esm/{hasInclusivePrice-f1ca1610.js → hasInclusivePrice-f0440925.js} +1 -1
  37. package/dist/esm/index.js +7 -7
  38. package/dist/esm/{invoice-d0eadc6a.js → invoice-89e71796.js} +2 -2
  39. package/dist/esm/{isCollectMobileTablet-11ade63f.js → isCollectMobileTablet-323d2ba1.js} +2 -2
  40. package/dist/esm/{localization-8e81b696.js → localization-066586b6.js} +242 -5
  41. package/dist/esm/{paypal-e32877e9.js → paypal-8725008c.js} +2 -2
  42. package/dist/esm/{placeTestOrder-4cf429d7.js → placeTestOrder-38be871e.js} +2 -2
  43. package/dist/esm/{renderCheckoutCurrency-9459b8a3.js → renderCheckoutCurrency-802f4481.js} +2 -2
  44. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  45. package/dist/esm/zonos-address_4.entry.js +2 -2
  46. package/dist/esm/zonos-card_5.entry.js +3 -3
  47. package/dist/esm/zonos-cart-items_12.entry.js +6 -6
  48. package/dist/esm/zonos-checkout.entry.js +4 -61
  49. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  50. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  51. package/dist/esm/zonos-collect.entry.js +4 -4
  52. package/dist/esm/zonos-controller.entry.js +2 -2
  53. package/dist/esm/zonos-country-flag.entry.js +1 -1
  54. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  55. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  56. package/dist/esm/zonos-hello.entry.js +2 -45
  57. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  58. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  59. package/dist/esm/zonos-invoice.entry.js +4 -4
  60. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  61. package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
  62. package/dist/esm-es5/{cart-68c16805.js → cart-44fa77ef.js} +1 -1
  63. package/dist/esm-es5/{hasInclusivePrice-f1ca1610.js → hasInclusivePrice-f0440925.js} +1 -1
  64. package/dist/esm-es5/index.js +1 -1
  65. package/dist/esm-es5/{invoice-d0eadc6a.js → invoice-89e71796.js} +1 -1
  66. package/dist/esm-es5/{isCollectMobileTablet-11ade63f.js → isCollectMobileTablet-323d2ba1.js} +1 -1
  67. package/dist/esm-es5/{localization-8e81b696.js → localization-066586b6.js} +1 -1
  68. package/dist/esm-es5/{paypal-e32877e9.js → paypal-8725008c.js} +1 -1
  69. package/dist/esm-es5/{placeTestOrder-4cf429d7.js → placeTestOrder-38be871e.js} +1 -1
  70. package/dist/esm-es5/{renderCheckoutCurrency-9459b8a3.js → renderCheckoutCurrency-802f4481.js} +1 -1
  71. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  72. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  73. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  74. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  75. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  76. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  77. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  78. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  79. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  80. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  81. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  82. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  83. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  84. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  85. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  86. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  87. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  88. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  89. package/dist/scripts/index.js +1 -1
  90. package/dist/scripts/loadZonos.js +1 -1
  91. package/dist/scripts/zonos.js +1 -1
  92. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +0 -1
  93. package/dist/types/components/utils/checkout/bigcommerceStorefrontApi.d.ts +9 -0
  94. package/dist/types/components/utils/checkout/removeBigcommerceCartShipping.d.ts +18 -0
  95. package/dist/types/components/utils/hello/shouldShowHelloWidget.d.ts +16 -0
  96. package/dist/zonos-elements/index.esm.js +1 -1
  97. package/dist/zonos-elements/{p-8ddc21f1.system.entry.js → p-08c7dc07.system.entry.js} +1 -1
  98. package/dist/zonos-elements/{p-b93b66c2.entry.js → p-0d251428.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-44b279cc.system.js → p-0d2d7fc4.system.js} +1 -1
  100. package/dist/zonos-elements/{p-7166df08.entry.js → p-0e9c0eff.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-64e8f05d.system.entry.js → p-0fb8b711.system.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-17e3cd62.js → p-208b270a.js} +1 -1
  103. package/dist/zonos-elements/{p-c3459f4a.entry.js → p-225f19b6.entry.js} +1 -1
  104. package/dist/zonos-elements/p-238370ad.system.js +1 -0
  105. package/dist/zonos-elements/{p-01913da8.js → p-260a5b57.js} +1 -1
  106. package/dist/zonos-elements/{p-623fc89a.system.entry.js → p-2651ca93.system.entry.js} +1 -1
  107. package/dist/zonos-elements/{p-5b05b461.system.js → p-27beefda.system.js} +1 -1
  108. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  109. package/dist/zonos-elements/{p-48805ed6.system.entry.js → p-2df84888.system.entry.js} +1 -1
  110. package/dist/zonos-elements/{p-e3d6f9b4.entry.js → p-2f61dc3c.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-50362897.entry.js → p-30e819ed.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-2ccd20c0.system.js → p-31a3b070.system.js} +1 -1
  113. package/dist/zonos-elements/{p-a0ee01dd.system.entry.js → p-553ca694.system.entry.js} +1 -1
  114. package/dist/zonos-elements/{p-af12a1b7.system.entry.js → p-5812b323.system.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-95f3bbad.system.entry.js → p-5ab4bc26.system.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-108b5307.system.entry.js → p-5df77315.system.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-97da66f2.entry.js → p-6704b83e.entry.js} +1 -1
  118. package/dist/zonos-elements/p-69ad7325.entry.js +1 -0
  119. package/dist/zonos-elements/{p-1376e67f.system.entry.js → p-6ac77d9f.system.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-4fe3d5e0.system.js → p-703f2737.system.js} +1 -1
  121. package/dist/zonos-elements/p-72666536.system.entry.js +1 -0
  122. package/dist/zonos-elements/{p-b71ef46e.js → p-7792f4c2.js} +1 -1
  123. package/dist/zonos-elements/{p-95b460e9.system.entry.js → p-7e03bd33.system.entry.js} +1 -1
  124. package/dist/zonos-elements/{p-53a59935.system.js → p-801dd8d8.system.js} +1 -1
  125. package/dist/zonos-elements/{p-673407b8.entry.js → p-91702715.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-6f41c193.entry.js → p-9abfb6b0.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-dcafbd4e.js → p-9e414000.js} +1 -1
  128. package/dist/zonos-elements/{p-bc9a30a1.system.entry.js → p-a2885536.system.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-620a9013.entry.js → p-a977cddd.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-24091606.system.entry.js → p-acd7009a.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-69089a6f.system.entry.js → p-ad4c8167.system.entry.js} +1 -1
  132. package/dist/zonos-elements/p-b1125711.system.js +1 -0
  133. package/dist/zonos-elements/p-b15ceaff.entry.js +1 -0
  134. package/dist/zonos-elements/p-b1a4f385.system.entry.js +1 -0
  135. package/dist/zonos-elements/{p-72c3756a.js → p-bea9d128.js} +1 -1
  136. package/dist/zonos-elements/{p-72960738.js → p-bfcc1432.js} +1 -1
  137. package/dist/zonos-elements/p-c049c527.js +1 -0
  138. package/dist/zonos-elements/p-c76ec587.system.js +1 -0
  139. package/dist/zonos-elements/{p-593764cf.system.entry.js → p-ccd0fa8f.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-38311c16.entry.js → p-d29dbeb3.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-7628569a.entry.js → p-d4c966cb.entry.js} +1 -1
  142. package/dist/zonos-elements/p-d659153c.entry.js +1 -0
  143. package/dist/zonos-elements/p-debd2e30.js +1 -0
  144. package/dist/zonos-elements/p-e11c3410.entry.js +1 -0
  145. package/dist/zonos-elements/{p-7fef8558.entry.js → p-eb96d62f.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-c91fade3.entry.js → p-ebc966d8.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-774de1ec.system.js → p-f5d4775a.system.js} +1 -1
  148. package/dist/zonos-elements/{p-5e18d92b.system.entry.js → p-fb83134b.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-c7ca3e98.system.entry.js → p-fc651784.system.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-fc5007e0.entry.js → p-fcf3ed5c.entry.js} +1 -1
  151. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  152. package/package.json +1 -1
  153. package/dist/zonos-elements/p-000b895a.entry.js +0 -1
  154. package/dist/zonos-elements/p-06e7fe2a.system.entry.js +0 -1
  155. package/dist/zonos-elements/p-0803ad10.js +0 -1
  156. package/dist/zonos-elements/p-11439d12.entry.js +0 -1
  157. package/dist/zonos-elements/p-17be8409.entry.js +0 -1
  158. package/dist/zonos-elements/p-1eef8c23.system.js +0 -1
  159. package/dist/zonos-elements/p-5fa2395d.system.js +0 -1
  160. package/dist/zonos-elements/p-7a220941.system.js +0 -1
  161. package/dist/zonos-elements/p-7cf8e1f0.js +0 -1
  162. package/dist/zonos-elements/p-8116d3ba.entry.js +0 -1
  163. package/dist/zonos-elements/p-b9a615bc.system.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-8e19daff.js';
2
- import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-68c16805.js';
3
- import { s as storageStore } from './localization-8e81b696.js';
2
+ import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-44fa77ef.js';
3
+ import { s as storageStore } from './localization-066586b6.js';
4
4
  import { h as handleFetch, s as sendErrorLog, l as logError } from './handleFetch-a844cac1.js';
5
5
  import { b as allLogs } from './VarianceTest-572cecf5.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-8e19daff.js';
2
- import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-68c16805.js';
3
- import { s as storageStore } from './localization-8e81b696.js';
2
+ import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-44fa77ef.js';
3
+ import { s as storageStore } from './localization-066586b6.js';
4
4
  import { h as handleFetch, s as sendErrorLog, l as logError } from './handleFetch-a844cac1.js';
5
5
  import { b as allLogs } from './VarianceTest-572cecf5.js';
6
6
 
@@ -17182,6 +17182,229 @@ const getShippingZones = async () => {
17182
17182
  return shippingZones || null;
17183
17183
  };
17184
17184
 
17185
+ /**
17186
+ * Fetch the checkout/cart ID from the BigCommerce Storefront Cart API.
17187
+ * The `/checkout` page URL does not include the checkout ID, so we
17188
+ * retrieve it from `/api/storefront/cart` which returns the active cart(s).
17189
+ */
17190
+ const fetchCheckoutId = async () => {
17191
+ var _a, _b;
17192
+ try {
17193
+ const response = await fetch('/api/storefront/cart', {
17194
+ credentials: 'same-origin',
17195
+ headers: {
17196
+ Accept: 'application/json',
17197
+ },
17198
+ });
17199
+ if (!response.ok) {
17200
+ log(`Failed to fetch BigCommerce cart: ${String(response.status)}`, 'error');
17201
+ return null;
17202
+ }
17203
+ const carts = (await response.json());
17204
+ return (_b = (_a = carts === null || carts === void 0 ? void 0 : carts[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
17205
+ }
17206
+ catch (error) {
17207
+ logError('Error fetching BigCommerce cart data', error);
17208
+ return null;
17209
+ }
17210
+ };
17211
+ /**
17212
+ * Fetch checkout data from the BigCommerce Storefront API.
17213
+ * This API is cookie-authenticated (same-origin), so no token is needed.
17214
+ */
17215
+ const fetchBigCommerceCheckout = async (checkoutId) => {
17216
+ try {
17217
+ const response = await fetch(`/api/storefront/checkouts/${checkoutId}?include=customer.customerGroup,customer.addresses`, {
17218
+ credentials: 'same-origin',
17219
+ headers: {
17220
+ Accept: 'application/json',
17221
+ 'Content-Type': 'application/json',
17222
+ },
17223
+ });
17224
+ if (!response.ok) {
17225
+ log(`Failed to fetch BigCommerce checkout: ${String(response.status)}`, 'error');
17226
+ return null;
17227
+ }
17228
+ return (await response.json());
17229
+ }
17230
+ catch (error) {
17231
+ logError('Error fetching BigCommerce checkout data', error);
17232
+ return null;
17233
+ }
17234
+ };
17235
+ /**
17236
+ * Delete a consignment (a saved shipping selection, e.g. a domestic shipping
17237
+ * quote the shopper added on the cart page) from the active BigCommerce
17238
+ * checkout via the Storefront API. Cookie-authenticated (same-origin), so no
17239
+ * token is needed. Returns the updated checkout on success, or null on
17240
+ * failure.
17241
+ */
17242
+ const deleteBigCommerceConsignment = async (checkoutId, consignmentId) => {
17243
+ try {
17244
+ const response = await fetch(`/api/storefront/checkouts/${checkoutId}/consignments/${consignmentId}`, {
17245
+ credentials: 'same-origin',
17246
+ headers: {
17247
+ Accept: 'application/json',
17248
+ 'Content-Type': 'application/json',
17249
+ },
17250
+ method: 'DELETE',
17251
+ });
17252
+ if (!response.ok) {
17253
+ log(`Failed to delete BigCommerce consignment: ${String(response.status)}`, 'error');
17254
+ return null;
17255
+ }
17256
+ return (await response.json());
17257
+ }
17258
+ catch (error) {
17259
+ logError('Error deleting BigCommerce consignment', error);
17260
+ return null;
17261
+ }
17262
+ };
17263
+ /**
17264
+ * Whether the BigCommerce shopper is already logged in. We key off the
17265
+ * customer's numeric `id` since the storefront API populates it only for
17266
+ * authenticated sessions (guest checkouts have an empty `customer` object).
17267
+ */
17268
+ const isBigCommerceCustomerLoggedIn = (checkout) => { var _a; return !!((_a = checkout === null || checkout === void 0 ? void 0 : checkout.customer) === null || _a === void 0 ? void 0 : _a.id); };
17269
+
17270
+ /**
17271
+ * Whether the Hello widget should be shown for the current shopper. This is the
17272
+ * single source of truth for Hello's visibility decision — the `zonos-hello`
17273
+ * component renders by it, and other features (e.g. BigCommerce cart shipping
17274
+ * cleanup) gate on it so their behavior stays in lockstep with what the shopper
17275
+ * actually sees.
17276
+ *
17277
+ * Resolves the configured `widgetVisibility` behavior (with the deprecated
17278
+ * `showForCountries` override) against the selected country and shipping-zone
17279
+ * state, then applies the include/exclude country overrides.
17280
+ *
17281
+ * @param showLog - emit a debug log when the shopper is not in a shipping zone.
17282
+ * Defaults to `true`; pass `false` from non-rendering callers to avoid log
17283
+ * noise.
17284
+ */
17285
+ const shouldShowHelloWidget = (showLog = true) => {
17286
+ var _a, _b;
17287
+ if (!localizationStore.localizationLoaded) {
17288
+ return false;
17289
+ }
17290
+ const { countryDisplayRules, showForCountries } = zonosStore.helloSettings;
17291
+ const visibilityRules = countryDisplayRules === null || countryDisplayRules === void 0 ? void 0 : countryDisplayRules.widgetVisibility;
17292
+ const selectedCountry = localizationStore.selectedCountryCode;
17293
+ // Resolve behavior: deprecated showForCountries overrides widgetVisibility.behavior
17294
+ // If showForCountries is an array of country codes, treat as legacy explicit list
17295
+ const behavior = Array.isArray(showForCountries)
17296
+ ? showForCountries
17297
+ : (showForCountries !== null && showForCountries !== void 0 ? showForCountries : visibilityRules === null || visibilityRules === void 0 ? void 0 : visibilityRules.behavior);
17298
+ if (showLog && !localizationStore.isShippableCountry) {
17299
+ log(`Hello: not shippable country - Show for countries: ${behavior}`);
17300
+ }
17301
+ // Legacy: explicit list of country codes from deprecated showForCountries
17302
+ if (Array.isArray(behavior)) {
17303
+ return !!selectedCountry && behavior.includes(selectedCountry);
17304
+ }
17305
+ // Determine base visibility from behavior
17306
+ let isVisible;
17307
+ if (behavior === 'ALL') {
17308
+ isVisible = true;
17309
+ }
17310
+ else {
17311
+ // Default: ONLY_SHIPPABLE
17312
+ isVisible = localizationStore.isShippableCountry;
17313
+ }
17314
+ // Apply includedCountries — force show the widget for these countries
17315
+ if (!isVisible &&
17316
+ selectedCountry &&
17317
+ ((_a = visibilityRules === null || visibilityRules === void 0 ? void 0 : visibilityRules.includedCountries) === null || _a === void 0 ? void 0 : _a.includes(selectedCountry))) {
17318
+ isVisible = true;
17319
+ }
17320
+ // Apply excludedCountries — force hide the widget for these countries
17321
+ if (isVisible &&
17322
+ selectedCountry &&
17323
+ ((_b = visibilityRules === null || visibilityRules === void 0 ? void 0 : visibilityRules.excludedCountries) === null || _b === void 0 ? void 0 : _b.includes(selectedCountry))) {
17324
+ isVisible = false;
17325
+ }
17326
+ return isVisible;
17327
+ };
17328
+
17329
+ /**
17330
+ * Guard against overlapping passes. `removeBigcommerceCartShipping` is fired on
17331
+ * every country change; without this flag, rapid country switches could stack
17332
+ * concurrent fetch/DELETE cycles against the same cart before the reload kicks
17333
+ * in.
17334
+ */
17335
+ let isRemoving = false;
17336
+ /**
17337
+ * On the BigCommerce cart page, drop any native domestic shipping quote the
17338
+ * shopper added before they switched to an international country, then reload
17339
+ * the page.
17340
+ *
17341
+ * The native cart stores a shipping estimate as a consignment on the active
17342
+ * checkout. When Hello is shown the shopper is checking out internationally
17343
+ * through Zonos, so that domestic shipping cost should not linger in the Grand
17344
+ * Total. We delete the consignment(s) and reload so the server re-renders the
17345
+ * cart consistently (subtotal, shipping, and Grand Total all add up).
17346
+ *
17347
+ * No-ops unless all of the following hold: the host is BigCommerce, the shopper
17348
+ * is on the cart page, they are in a shipping zone with Hello shown, and the
17349
+ * active checkout actually has a consignment. Because the reload happens only
17350
+ * when a consignment is found and removed, the freshly-loaded page has none —
17351
+ * so this cannot loop.
17352
+ */
17353
+ const removeBigcommerceCartShipping = async () => {
17354
+ var _a, _b;
17355
+ if (typeof window === 'undefined' || !((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.isBigCommerce)) {
17356
+ return;
17357
+ }
17358
+ // Only on the cart page and only when Hello is shown — elsewhere there is no
17359
+ // Grand Total to correct. Gate on Hello visibility (not raw shipping-zone
17360
+ // membership) so include/exclude country overrides are respected.
17361
+ if (window.location.pathname !== '/cart.php' ||
17362
+ !localizationStore.isShippableCountry ||
17363
+ !shouldShowHelloWidget(false)) {
17364
+ return;
17365
+ }
17366
+ if (isRemoving) {
17367
+ return;
17368
+ }
17369
+ isRemoving = true;
17370
+ try {
17371
+ const checkoutId = await fetchCheckoutId();
17372
+ if (!checkoutId) {
17373
+ return;
17374
+ }
17375
+ const checkout = await fetchBigCommerceCheckout(checkoutId);
17376
+ const consignmentIds = ((_b = checkout === null || checkout === void 0 ? void 0 : checkout.consignments) !== null && _b !== void 0 ? _b : [])
17377
+ .map(consignment => consignment.id)
17378
+ .filter((id) => !!id);
17379
+ // Nothing to do if there is no domestic shipping quote on the cart.
17380
+ if (!consignmentIds.length) {
17381
+ return;
17382
+ }
17383
+ log(`Removing ${String(consignmentIds.length)} BigCommerce cart consignment(s) for international shopper`, 'info');
17384
+ // `deleteBigCommerceConsignment` resolves to null on failure (it swallows
17385
+ // the error and logs it), so a non-null result means that consignment was
17386
+ // actually removed.
17387
+ const deleteResults = await Promise.all(consignmentIds.map(consignmentId => deleteBigCommerceConsignment(checkoutId, consignmentId)));
17388
+ const removedCount = deleteResults.filter(Boolean).length;
17389
+ // Only reload when at least one consignment was actually removed. If every
17390
+ // DELETE failed, reloading would re-run this on init with the same
17391
+ // consignments still present and trap the shopper in a reload loop.
17392
+ if (!removedCount) {
17393
+ log('No BigCommerce cart consignments were removed; skipping reload to avoid a reload loop', 'warn');
17394
+ return;
17395
+ }
17396
+ // Reload so the server re-renders the cart consistently without the removed
17397
+ // shipping, instead of surgically patching the DOM total.
17398
+ window.location.reload();
17399
+ }
17400
+ catch (error) {
17401
+ logError('Error removing BigCommerce cart shipping consignment', error);
17402
+ }
17403
+ finally {
17404
+ isRemoving = false;
17405
+ }
17406
+ };
17407
+
17185
17408
  const applyInclusiveEffectiveRate = (amount) => {
17186
17409
  const inclusivePrice = localizationStore.inclusivePricingConfigurations.find(x => x.shipToCountry === localizationStore.selectedCountryCode);
17187
17410
  if (!inclusivePrice) {
@@ -17446,8 +17669,12 @@ const convertCurrency = (element) => {
17446
17669
  rate !== currentIntlRateValue ||
17447
17670
  // Update currency when the country code changes
17448
17671
  currentCountryValue !== localizationStore.selectedCountryCode)) {
17449
- // Hide the currency until DOM is ready to display the new value
17450
- const timeoutId = performBlurSpecificElement(element);
17672
+ let timeoutId;
17673
+ // Only trigger blur effect if the source currency is different from the target currency
17674
+ if (zonosStore.sourceCurrency !== localizationStore.targetCurrency) {
17675
+ // Hide the currency until DOM is ready to display the new value
17676
+ timeoutId = performBlurSpecificElement(element);
17677
+ }
17451
17678
  const appliedInclusivePrice = applyInclusiveEffectiveRate(amount);
17452
17679
  const customizedCurrencyFormat = typeof zonosStore.currencyConverter === 'function' &&
17453
17680
  zonosStore.currencyConverter({
@@ -17572,7 +17799,7 @@ const toggleBigcommerceNativeCurrencySelector = () => {
17572
17799
  return;
17573
17800
  }
17574
17801
  const bigcommerceCurrencyCode = document.body.dataset.currencyCode;
17575
- const shouldHide = localizationStore.isShippableCountry &&
17802
+ const shouldHide = (shouldShowHelloWidget(false) || localizationStore.isShippableCountry) &&
17576
17803
  !!bigcommerceCurrencyCode &&
17577
17804
  bigcommerceCurrencyCode === zonosStore.sourceCurrency;
17578
17805
  try {
@@ -17757,6 +17984,11 @@ const localizationStoreUpdateSelectedCountryCode = ({ isInitializing, newSelecte
17757
17984
  // because `currencyDisplay` is also invoked from the price-mutation
17758
17985
  // observer in `zonos-hello.tsx`, which fires on every DOM render.
17759
17986
  toggleBigcommerceNativeCurrencySelector();
17987
+ // On the BigCommerce cart page, drop any native domestic shipping quote the
17988
+ // shopper added before switching to an international country so the Grand
17989
+ // Total reflects only subtotal + coupon. No-ops off-cart, off-BigCommerce,
17990
+ // for non-shippable countries, or when the cart has no consignment.
17991
+ void removeBigcommerceCartShipping();
17760
17992
  if (!selectedCountryCode) {
17761
17993
  return;
17762
17994
  }
@@ -17934,7 +18166,12 @@ const initLocalizationStore = async () => {
17934
18166
  newSelectedCountryCode: 'CA',
17935
18167
  });
17936
18168
  }
17937
- localizationStore.localizationLoaded = true;
18169
+ if (!localizationStore.localizationLoaded) {
18170
+ localizationStore.localizationLoaded = true;
18171
+ void removeBigcommerceCartShipping();
18172
+ // shouldShowHelloWidget is false because localization is not loaded yet
18173
+ void toggleBigcommerceNativeCurrencySelector();
18174
+ }
17938
18175
  };
17939
18176
 
17940
- export { VARIANT_TEST_KEY_EXPIRATION as V, localizationStoreUpdateSelectedCountryCode as a, storageStoreSetEnabledVariantTestKeys as b, localizationStoreOnChange as c, currencyFormat as d, getOverridenZCountry as e, filterValidTests as f, getZCountryUrlParam as g, initLocalizationStore as h, isValidSelector as i, setZCountryUrlParam as j, currencyDisplay as k, localizationStore as l, currencyConvertAndFormat as m, currencyConvert as n, applyInclusiveEffectiveRate as o, translationStoreOnChange as p, storageStoreOnChange as q, getFallbackDefaultCountryCode as r, storageStore as s, translate as t, localizationStoreUpdateSelectedLocale as u };
18177
+ export { VARIANT_TEST_KEY_EXPIRATION as V, fetchCheckoutId as a, fetchBigCommerceCheckout as b, localizationStoreUpdateSelectedCountryCode as c, storageStoreSetEnabledVariantTestKeys as d, localizationStoreOnChange as e, filterValidTests as f, getZCountryUrlParam as g, currencyFormat as h, isBigCommerceCustomerLoggedIn as i, getOverridenZCountry as j, isValidSelector as k, localizationStore as l, initLocalizationStore as m, setZCountryUrlParam as n, currencyDisplay as o, currencyConvertAndFormat as p, currencyConvert as q, shouldShowHelloWidget as r, storageStore as s, translate as t, applyInclusiveEffectiveRate as u, translationStoreOnChange as v, storageStoreOnChange as w, getFallbackDefaultCountryCode as x, localizationStoreUpdateSelectedLocale as y };
@@ -1,6 +1,6 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-8e19daff.js';
2
- import { t as trackConversionEvent, v as isPolicyConsentRequired, E as policyConsentStore, A as validateCheckoutSession, b as stripeStore, d as cartStore, x as stripeStoreHandleInventoryCheck, y as storeCreditStoreApplyCredit, J as stripeStoreRecordPolicyConsent, z as storeCreditStoreCoversFullAmount, B as storeCreditStoreCreateOrder, u as cartStoreNextStep, h as cartStoreClearCheckoutInterval, I as storeCreditStoreGetEffectiveAmount } from './cart-68c16805.js';
3
- import { t as translate, s as storageStore } from './localization-8e81b696.js';
2
+ import { t as trackConversionEvent, v as isPolicyConsentRequired, E as policyConsentStore, A as validateCheckoutSession, b as stripeStore, d as cartStore, x as stripeStoreHandleInventoryCheck, y as storeCreditStoreApplyCredit, J as stripeStoreRecordPolicyConsent, z as storeCreditStoreCoversFullAmount, B as storeCreditStoreCreateOrder, u as cartStoreNextStep, h as cartStoreClearCheckoutInterval, I as storeCreditStoreGetEffectiveAmount } from './cart-44fa77ef.js';
3
+ import { t as translate, s as storageStore } from './localization-066586b6.js';
4
4
  import { h as handleFetch, g as getIsTestMode, l as logError, j as jsonParse } from './handleFetch-a844cac1.js';
5
5
  import { i as isContrastColor } from './isContrastColor-fbddacb6.js';
6
6
  import { l as log } from './VarianceTest-572cecf5.js';
@@ -1,5 +1,5 @@
1
- import { d as cartStore } from './cart-68c16805.js';
2
- import { s as storageStore } from './localization-8e81b696.js';
1
+ import { d as cartStore } from './cart-44fa77ef.js';
2
+ import { s as storageStore } from './localization-066586b6.js';
3
3
  import { l as logError, h as handleFetch } from './handleFetch-a844cac1.js';
4
4
 
5
5
  const placeTestOrder = async () => {
@@ -1,5 +1,5 @@
1
- import { d as cartStore } from './cart-68c16805.js';
2
- import { o as applyInclusiveEffectiveRate, d as currencyFormat } from './localization-8e81b696.js';
1
+ import { d as cartStore } from './cart-44fa77ef.js';
2
+ import { u as applyInclusiveEffectiveRate, h as currencyFormat } from './localization-066586b6.js';
3
3
 
4
4
  const getDisplayCurrency = () => {
5
5
  var _a, _b;
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h, a as Host, d as createEvent, g as getElement } from './index-cfd394c8.js';
2
- import { t as translate, l as localizationStore, s as storageStore, q as storageStoreOnChange } from './localization-8e81b696.js';
2
+ import { t as translate, l as localizationStore, s as storageStore, w as storageStoreOnChange } from './localization-066586b6.js';
3
3
  import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
4
- import { U as extractName, b as stripeStore, r as stripeStorePrefetchLandedCost, t as trackConversionEvent } from './cart-68c16805.js';
4
+ import { U as extractName, b as stripeStore, r as stripeStorePrefetchLandedCost, t as trackConversionEvent } from './cart-44fa77ef.js';
5
5
  import { c as classes } from './classes-0d95c529.js';
6
6
  import { g as getBorderRadius } from './getBorderRadius-d23f47a6.js';
7
7
  import { z as zonosStore, f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, d as createEvent, h, a as Host, g as getElement } from './index-cfd394c8.js';
2
2
  import { t as throttle_1 } from './throttle-f09d0659.js';
3
- import { b as stripeStore, t as trackConversionEvent, U as extractName, H as stripeStoreOnChange, r as stripeStorePrefetchLandedCost, d as cartStore } from './cart-68c16805.js';
4
- import { s as storageStore, r as getFallbackDefaultCountryCode, t as translate, q as storageStoreOnChange, l as localizationStore } from './localization-8e81b696.js';
3
+ import { b as stripeStore, t as trackConversionEvent, U as extractName, H as stripeStoreOnChange, r as stripeStorePrefetchLandedCost, d as cartStore } from './cart-44fa77ef.js';
4
+ import { s as storageStore, x as getFallbackDefaultCountryCode, t as translate, w as storageStoreOnChange, l as localizationStore } from './localization-066586b6.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
6
6
  import { l as logError, i as isCheckoutMobile, s as sendErrorLog } from './handleFetch-a844cac1.js';
7
7
  import { a as shouldRenderTaxIdInput, s as shouldRenderShortAddressCodeInput } from './shouldRenderTaxIdInput-2572bf77.js';
@@ -2,10 +2,10 @@ import { r as registerInstance, h, a as Host, g as getElement, d as createEvent
2
2
  import { f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-d23f47a6.js';
5
- import { b as stripeStore, t as trackConversionEvent } from './cart-68c16805.js';
6
- import { s as storageStore } from './localization-8e81b696.js';
5
+ import { b as stripeStore, t as trackConversionEvent } from './cart-44fa77ef.js';
6
+ import { s as storageStore } from './localization-066586b6.js';
7
7
  import { l as logError } from './handleFetch-a844cac1.js';
8
- import { d as paypalStoreInitButtons, e as paypalStoreOnChange } from './paypal-e32877e9.js';
8
+ import { d as paypalStoreInitButtons, e as paypalStoreOnChange } from './paypal-8725008c.js';
9
9
  import { l as log } from './VarianceTest-572cecf5.js';
10
10
  import './isDarkColor-566f04c5.js';
11
11
  import './isContrastColor-fbddacb6.js';
@@ -1,18 +1,18 @@
1
1
  import { r as registerInstance, e as getAssetPath, h, a as Host, F as Fragment, d as createEvent, g as getElement } from './index-cfd394c8.js';
2
- import { d as cartStore, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, b as stripeStore, F as stripeStoreReset, c as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, R as storeCreditStore, S as storeCreditStoreReset, z as storeCreditStoreCoversFullAmount, v as isPolicyConsentRequired, E as policyConsentStore, J as stripeStoreRecordPolicyConsent, u as cartStoreNextStep, T as stripeStoreTranslateAddressToLatin, U as extractName, G as cartStoreOnChange, V as stripeStoreAsyncAddressUpdate, L as cartStoreUpdateSelectedShippingOption, W as cartStoreGetShippingTransitInfo, X as cartStoreGetMethod, Y as sortServiceLevelOptionsByAmount } from './cart-68c16805.js';
3
- import { t as translate, l as localizationStore, s as storageStore, c as localizationStoreOnChange } from './localization-8e81b696.js';
4
- import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-9459b8a3.js';
2
+ import { d as cartStore, M as cartStoreHasOneEligibleItem, N as stripeStoreApplyPromoCode, O as stripeStoreRemovePromoCode, b as stripeStore, F as stripeStoreReset, c as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, Q as stripeStoreMessageBasedOnStatus, R as storeCreditStore, S as storeCreditStoreReset, z as storeCreditStoreCoversFullAmount, v as isPolicyConsentRequired, E as policyConsentStore, J as stripeStoreRecordPolicyConsent, u as cartStoreNextStep, T as stripeStoreTranslateAddressToLatin, U as extractName, G as cartStoreOnChange, V as stripeStoreAsyncAddressUpdate, L as cartStoreUpdateSelectedShippingOption, W as cartStoreGetShippingTransitInfo, X as cartStoreGetMethod, Y as sortServiceLevelOptionsByAmount } from './cart-44fa77ef.js';
3
+ import { t as translate, l as localizationStore, s as storageStore, e as localizationStoreOnChange } from './localization-066586b6.js';
4
+ import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-802f4481.js';
5
5
  import { c as cleanHtmlMarkdown } from './cleanHtmlMarkdown-5f7856f2.js';
6
6
  import { c as classes } from './classes-0d95c529.js';
7
7
  import { z as zonosStore, h as zonosStoreOnChange, g as getZonosStoreTheme, f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
8
- import { D as DUTY_KEY, T as TAXES_KEY, h as hasInclusivePrice } from './hasInclusivePrice-f1ca1610.js';
9
- import { s as submitAnalytics, c as paypalStoreReset, a as paypalStore } from './paypal-e32877e9.js';
8
+ import { D as DUTY_KEY, T as TAXES_KEY, h as hasInclusivePrice } from './hasInclusivePrice-f0440925.js';
9
+ import { s as submitAnalytics, c as paypalStoreReset, a as paypalStore } from './paypal-8725008c.js';
10
10
  import { h as handleFetch, s as sendErrorLog, j as jsonParse, g as getIsTestMode, i as isCheckoutMobile, a as getIsStagingMode } from './handleFetch-a844cac1.js';
11
11
  import { c as createCustomEvent } from './createCustomEvent-58159025.js';
12
12
  import { g as getBorderRadius } from './getBorderRadius-d23f47a6.js';
13
13
  import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
14
14
  import { l as languages } from './ILanguage-cd6acb72.js';
15
- import { p as placeTestOrder } from './placeTestOrder-4cf429d7.js';
15
+ import { p as placeTestOrder } from './placeTestOrder-38be871e.js';
16
16
  import { i as isDarkColor } from './isDarkColor-566f04c5.js';
17
17
  import { g as getContrastColor } from './getContrastColor-f0bd5b65.js';
18
18
  import { i as isColorVariable } from './isColorVariable-0a94004f.js';
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, h, F as Fragment, a as Host } from './index-cfd394c8.js';
2
- import { s as stripeStoreGetDomesticShippingSession, a as stripeStoreSaveDomesticShippingSession, b as stripeStore, i as initStripeElements, c as stripeStoreRetrievePayment, d as cartStore, e as cartStoreUpdateItems, f as cartStoreReset, p as policyConsentStoreReset, g as cartStoreResetTabItems, h as cartStoreClearCheckoutInterval, j as stripeStoreInitCheckoutSession, k as stripeStoreGetPaymentIntent, l as cartStoreStartCheckoutInterval, t as trackConversionEvent, m as getCheckoutSessionBody, n as cartStoreUpdateToErrorState, o as stripeStoreCleanupDomesticShippingSession, q as cartStoreSetCheckoutSession, r as stripeStorePrefetchLandedCost, u as cartStoreNextStep, v as isPolicyConsentRequired, w as stripeStoreUpdateCheckoutSessionBaseCurrency, x as stripeStoreHandleInventoryCheck, y as storeCreditStoreApplyCredit, z as storeCreditStoreCoversFullAmount, A as validateCheckoutSession, B as storeCreditStoreCreateOrder, C as stripeStoreConfirmPayment, D as stripeStoreHandleInventoryRefund, E as policyConsentStore, F as stripeStoreReset, G as cartStoreOnChange, H as stripeStoreOnChange, I as storeCreditStoreGetEffectiveAmount } from './cart-68c16805.js';
3
- import { p as paypalStoreHasPaypalEnabled, s as submitAnalytics, a as paypalStore, b as paypalInitScript } from './paypal-e32877e9.js';
4
- import { f as filterValidTests, l as localizationStore, a as localizationStoreUpdateSelectedCountryCode, g as getZCountryUrlParam, s as storageStore, V as VARIANT_TEST_KEY_EXPIRATION, b as storageStoreSetEnabledVariantTestKeys, t as translate, c as localizationStoreOnChange, d as currencyFormat } from './localization-8e81b696.js';
2
+ import { s as stripeStoreGetDomesticShippingSession, a as stripeStoreSaveDomesticShippingSession, b as stripeStore, i as initStripeElements, c as stripeStoreRetrievePayment, d as cartStore, e as cartStoreUpdateItems, f as cartStoreReset, p as policyConsentStoreReset, g as cartStoreResetTabItems, h as cartStoreClearCheckoutInterval, j as stripeStoreInitCheckoutSession, k as stripeStoreGetPaymentIntent, l as cartStoreStartCheckoutInterval, t as trackConversionEvent, m as getCheckoutSessionBody, n as cartStoreUpdateToErrorState, o as stripeStoreCleanupDomesticShippingSession, q as cartStoreSetCheckoutSession, r as stripeStorePrefetchLandedCost, u as cartStoreNextStep, v as isPolicyConsentRequired, w as stripeStoreUpdateCheckoutSessionBaseCurrency, x as stripeStoreHandleInventoryCheck, y as storeCreditStoreApplyCredit, z as storeCreditStoreCoversFullAmount, A as validateCheckoutSession, B as storeCreditStoreCreateOrder, C as stripeStoreConfirmPayment, D as stripeStoreHandleInventoryRefund, E as policyConsentStore, F as stripeStoreReset, G as cartStoreOnChange, H as stripeStoreOnChange, I as storeCreditStoreGetEffectiveAmount } from './cart-44fa77ef.js';
3
+ import { p as paypalStoreHasPaypalEnabled, s as submitAnalytics, a as paypalStore, b as paypalInitScript } from './paypal-8725008c.js';
4
+ import { f as filterValidTests, a as fetchCheckoutId, b as fetchBigCommerceCheckout, i as isBigCommerceCustomerLoggedIn, l as localizationStore, c as localizationStoreUpdateSelectedCountryCode, g as getZCountryUrlParam, s as storageStore, V as VARIANT_TEST_KEY_EXPIRATION, d as storageStoreSetEnabledVariantTestKeys, t as translate, e as localizationStoreOnChange, h as currencyFormat } from './localization-066586b6.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-8e19daff.js';
6
6
  import { b as buildCartItemsByTempCart } from './buildCartItemsByTempCart-a117f75d.js';
7
- import { h as handleFetch, l as logError, g as getIsTestMode, j as jsonParse, b as getAdditionalLogMetadata, s as sendErrorLog, a as getIsStagingMode, i as isCheckoutMobile } from './handleFetch-a844cac1.js';
7
+ import { h as handleFetch, g as getIsTestMode, j as jsonParse, l as logError, b as getAdditionalLogMetadata, s as sendErrorLog, a as getIsStagingMode, i as isCheckoutMobile } from './handleFetch-a844cac1.js';
8
8
  import { u as updateCheckoutSessionAttributes } from './updateCheckoutSessionAttributes-40e301a4.js';
9
9
  import { l as log, g as getElapsedTime, b as allLogs } from './VarianceTest-572cecf5.js';
10
10
  import { _ as _getIsValidCartId, c as checkoutHiddenBtnSelector, a as checkoutHiddenInternationalBtnSelector, d as domesticRedirectedBtnSelector, g as getAbandonedCartRenewTokenValue } from './CheckoutConfig-724d7bae.js';
@@ -93,63 +93,6 @@ const buildCartUrl = ({ cartId, checkoutSessionId, customerAddress1, customerAdd
93
93
  return `${hostedCheckoutUrl}?${urlParams.toString()}`;
94
94
  };
95
95
 
96
- /**
97
- * Fetch the checkout/cart ID from the BigCommerce Storefront Cart API.
98
- * The `/checkout` page URL does not include the checkout ID, so we
99
- * retrieve it from `/api/storefront/cart` which returns the active cart(s).
100
- */
101
- const fetchCheckoutId = async () => {
102
- var _a, _b;
103
- try {
104
- const response = await fetch('/api/storefront/cart', {
105
- credentials: 'same-origin',
106
- headers: {
107
- Accept: 'application/json',
108
- },
109
- });
110
- if (!response.ok) {
111
- log(`Failed to fetch BigCommerce cart: ${String(response.status)}`, 'error');
112
- return null;
113
- }
114
- const carts = (await response.json());
115
- return (_b = (_a = carts === null || carts === void 0 ? void 0 : carts[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
116
- }
117
- catch (error) {
118
- logError('Error fetching BigCommerce cart data', error);
119
- return null;
120
- }
121
- };
122
- /**
123
- * Fetch checkout data from the BigCommerce Storefront API.
124
- * This API is cookie-authenticated (same-origin), so no token is needed.
125
- */
126
- const fetchBigCommerceCheckout = async (checkoutId) => {
127
- try {
128
- const response = await fetch(`/api/storefront/checkouts/${checkoutId}?include=customer.customerGroup,customer.addresses`, {
129
- credentials: 'same-origin',
130
- headers: {
131
- Accept: 'application/json',
132
- 'Content-Type': 'application/json',
133
- },
134
- });
135
- if (!response.ok) {
136
- log(`Failed to fetch BigCommerce checkout: ${String(response.status)}`, 'error');
137
- return null;
138
- }
139
- return (await response.json());
140
- }
141
- catch (error) {
142
- logError('Error fetching BigCommerce checkout data', error);
143
- return null;
144
- }
145
- };
146
- /**
147
- * Whether the BigCommerce shopper is already logged in. We key off the
148
- * customer's numeric `id` since the storefront API populates it only for
149
- * authenticated sessions (guest checkouts have an empty `customer` object).
150
- */
151
- const isBigCommerceCustomerLoggedIn = (checkout) => { var _a; return !!((_a = checkout === null || checkout === void 0 ? void 0 : checkout.customer) === null || _a === void 0 ? void 0 : _a.id); };
152
-
153
96
  /**
154
97
  * The query flag that BigCommerce carries back to `cart.php` after the
155
98
  * shopper logs in. When present, Zonos-elements knows to resume the
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, e as getAssetPath, h, a as Host } from './index-cfd394c8.js';
2
- import { d as cartStore } from './cart-68c16805.js';
2
+ import { d as cartStore } from './cart-44fa77ef.js';
3
3
  import { c as cleanHtmlMarkdown } from './cleanHtmlMarkdown-5f7856f2.js';
4
4
  import { f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
5
5
  import { c as classes } from './classes-0d95c529.js';
6
6
  import { s as styles } from './styles-6fc2fad9.js';
7
- import './localization-8e81b696.js';
7
+ import './localization-066586b6.js';
8
8
  import './handleFetch-a844cac1.js';
9
9
  import './VarianceTest-572cecf5.js';
10
10
  import './isDarkColor-566f04c5.js';
@@ -1,17 +1,17 @@
1
1
  import { r as registerInstance, d as createEvent, h, F as Fragment, a as Host, g as getElement } from './index-cfd394c8.js';
2
- import { b as stripeStore, c as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, F as stripeStoreReset, Q as stripeStoreMessageBasedOnStatus, d as cartStore, u as cartStoreNextStep, G as cartStoreOnChange } from './cart-68c16805.js';
3
- import { s as submitAnalytics, c as paypalStoreReset, a as paypalStore, b as paypalInitScript } from './paypal-e32877e9.js';
4
- import { t as translate, s as storageStore, l as localizationStore, p as translationStoreOnChange } from './localization-8e81b696.js';
2
+ import { b as stripeStore, c as stripeStoreRetrievePayment, t as trackConversionEvent, P as stripeStoreResetPromoCode, F as stripeStoreReset, Q as stripeStoreMessageBasedOnStatus, d as cartStore, u as cartStoreNextStep, G as cartStoreOnChange } from './cart-44fa77ef.js';
3
+ import { s as submitAnalytics, c as paypalStoreReset, a as paypalStore, b as paypalInitScript } from './paypal-8725008c.js';
4
+ import { t as translate, s as storageStore, l as localizationStore, v as translationStoreOnChange } from './localization-066586b6.js';
5
5
  import { z as zonosStore } from './zonosStore-8e19daff.js';
6
6
  import { h as handleFetch, s as sendErrorLog, g as getIsTestMode, i as isCheckoutMobile, a as getIsStagingMode } from './handleFetch-a844cac1.js';
7
7
  import { c as createCustomEvent } from './createCustomEvent-58159025.js';
8
8
  import { g as getBorderRadius } from './getBorderRadius-d23f47a6.js';
9
9
  import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
10
- import { i as isCollectMobile, a as isCollectTablet, e as collectStore } from './isCollectMobileTablet-11ade63f.js';
10
+ import { i as isCollectMobile, a as isCollectTablet, e as collectStore } from './isCollectMobileTablet-323d2ba1.js';
11
11
  import { c as classes } from './classes-0d95c529.js';
12
12
  import { l as languages } from './ILanguage-cd6acb72.js';
13
- import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-9459b8a3.js';
14
- import { p as placeTestOrder } from './placeTestOrder-4cf429d7.js';
13
+ import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-802f4481.js';
14
+ import { p as placeTestOrder } from './placeTestOrder-38be871e.js';
15
15
  import { r as renderFallback } from './renderFallback-b250f4e9.js';
16
16
  import './isDarkColor-566f04c5.js';
17
17
  import './isContrastColor-fbddacb6.js';
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, h, a as Host, F as Fragment } from './index-cfd394c8.js';
2
- import { b as stripeStore, i as initStripeElements, c as stripeStoreRetrievePayment, d as cartStore, n as cartStoreUpdateToErrorState, e as cartStoreUpdateItems, j as stripeStoreInitCheckoutSession, k as stripeStoreGetPaymentIntent, w as stripeStoreUpdateCheckoutSessionBaseCurrency, C as stripeStoreConfirmPayment, H as stripeStoreOnChange, F as stripeStoreReset, f as cartStoreReset } from './cart-68c16805.js';
3
- import { i as isCollectMobile, a as isCollectTablet, c as collectStoreUpdateSelectedShippingOption, b as collectStoreInitShippingInfo, d as collectStoreAsyncAddressUpdate, e as collectStore } from './isCollectMobileTablet-11ade63f.js';
4
- import { p as paypalStoreHasPaypalEnabled, a as paypalStore } from './paypal-e32877e9.js';
5
- import { s as storageStore, t as translate, c as localizationStoreOnChange, d as currencyFormat, l as localizationStore } from './localization-8e81b696.js';
2
+ import { b as stripeStore, i as initStripeElements, c as stripeStoreRetrievePayment, d as cartStore, n as cartStoreUpdateToErrorState, e as cartStoreUpdateItems, j as stripeStoreInitCheckoutSession, k as stripeStoreGetPaymentIntent, w as stripeStoreUpdateCheckoutSessionBaseCurrency, C as stripeStoreConfirmPayment, H as stripeStoreOnChange, F as stripeStoreReset, f as cartStoreReset } from './cart-44fa77ef.js';
3
+ import { i as isCollectMobile, a as isCollectTablet, c as collectStoreUpdateSelectedShippingOption, b as collectStoreInitShippingInfo, d as collectStoreAsyncAddressUpdate, e as collectStore } from './isCollectMobileTablet-323d2ba1.js';
4
+ import { p as paypalStoreHasPaypalEnabled, a as paypalStore } from './paypal-8725008c.js';
5
+ import { s as storageStore, t as translate, e as localizationStoreOnChange, h as currencyFormat, l as localizationStore } from './localization-066586b6.js';
6
6
  import { z as zonosStore } from './zonosStore-8e19daff.js';
7
7
  import { b as buildCartItemsByTempCart } from './buildCartItemsByTempCart-a117f75d.js';
8
8
  import { h as handleFetch, s as sendErrorLog, l as logError, g as getIsTestMode } from './handleFetch-a844cac1.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, d as createEvent, h, a as Host } from './index-cfd394c8.js';
2
- import { b as stripeStore } from './cart-68c16805.js';
3
- import { e as getOverridenZCountry, i as isValidSelector, h as initLocalizationStore, s as storageStore, a as localizationStoreUpdateSelectedCountryCode } from './localization-8e81b696.js';
2
+ import { b as stripeStore } from './cart-44fa77ef.js';
3
+ import { j as getOverridenZCountry, k as isValidSelector, m as initLocalizationStore, s as storageStore, c as localizationStoreUpdateSelectedCountryCode } from './localization-066586b6.js';
4
4
  import { z as zonosStore, e as zonosStoreInitSetting, f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
5
5
  import { g as getGenericSettingsOverride, i as iframeServices, a as injectPrivateIframe } from './getGenericSettingsOverride-0bc3e118.js';
6
6
  import { h as handleFetch, l as logError } from './handleFetch-a844cac1.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-cfd394c8.js';
2
- import { l as localizationStore } from './localization-8e81b696.js';
2
+ import { l as localizationStore } from './localization-066586b6.js';
3
3
  import { f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import './handleFetch-a844cac1.js';
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-cfd394c8.js';
2
- import { a as localizationStoreUpdateSelectedCountryCode, t as translate, l as localizationStore } from './localization-8e81b696.js';
2
+ import { c as localizationStoreUpdateSelectedCountryCode, t as translate, l as localizationStore } from './localization-066586b6.js';
3
3
  import { f as zonosStoreFontFamily } from './zonosStore-8e19daff.js';
4
4
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
5
5
  import { i as isDarkColor } from './isDarkColor-566f04c5.js';
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, d as createEvent, h, F as Fragment, a as Host } from './index-cfd394c8.js';
2
- import { l as localizationStore, t as translate, d as currencyFormat } from './localization-8e81b696.js';
2
+ import { l as localizationStore, t as translate, h as currencyFormat } from './localization-066586b6.js';
3
3
  import { z as zonosStore } from './zonosStore-8e19daff.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
6
- import { h as hasInclusivePrice, T as TAXES_KEY, D as DUTY_KEY } from './hasInclusivePrice-f1ca1610.js';
6
+ import { h as hasInclusivePrice, T as TAXES_KEY, D as DUTY_KEY } from './hasInclusivePrice-f0440925.js';
7
7
  import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
8
8
  import { e as euCountryCodes } from './TaxId-50d72254.js';
9
9
  import './handleFetch-a844cac1.js';