@zonos/elements 1.3.257 → 1.3.259

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 (180) hide show
  1. package/dist/cjs/{cart-cd0a054b.js → cart-c618fd5b.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-3650109c.js → hasInclusivePrice-58a9f15d.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-1cea739b.js → invoice-c9cb6683.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-65c71740.js → isCollectMobileTablet-93a5194a.js} +2 -2
  6. package/dist/cjs/{localization-adaab93f.js → localization-5994d4de.js} +25 -3
  7. package/dist/cjs/{paypal-326d7bc5.js → paypal-091e089e.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-53f2fe97.js → placeTestOrder-b07f8edb.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-cf2e3b93.js → renderCheckoutCurrency-7876a1d4.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 +442 -17
  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 +45 -12
  22. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  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-store-credit.cjs.entry.js +3 -3
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +72 -0
  29. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +43 -10
  30. package/dist/collection/components/store/hello/localization.js +25 -3
  31. package/dist/collection/components/utils/checkout/bigcommerceStorefrontApi.js +6 -0
  32. package/dist/collection/components/utils/checkout/buildBigcommerceLoginUrl.js +65 -0
  33. package/dist/collection/components/utils/checkout/checkBigCommerceBypassCustomerGroup.js +12 -7
  34. package/dist/collection/components/utils/checkout/checkBigCommerceForceLogin.js +116 -0
  35. package/dist/collection/components/utils/checkout/fetchBigCommerceCheckoutSettings.js +92 -0
  36. package/dist/collection/components/utils/checkout/fixBigCommerceLoginCreateAccountLink.js +53 -0
  37. package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +40 -7
  38. package/dist/collection/types/checkout/api/BigCommerceCheckoutSettings.js +1 -0
  39. package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
  40. package/dist/collection/types/generated/graphql.internal.types.js +39 -0
  41. package/dist/collection/types/index.js +1 -0
  42. package/dist/esm/{cart-4cd47a1b.js → cart-76fb528f.js} +1 -1
  43. package/dist/esm/{hasInclusivePrice-7a3dc4c3.js → hasInclusivePrice-275b1048.js} +1 -1
  44. package/dist/esm/index.js +7 -7
  45. package/dist/esm/{invoice-03ff7bbb.js → invoice-9efcb941.js} +2 -2
  46. package/dist/esm/{isCollectMobileTablet-9eb77c9a.js → isCollectMobileTablet-a7e5b909.js} +2 -2
  47. package/dist/esm/{localization-79e08480.js → localization-76ce3e29.js} +25 -3
  48. package/dist/esm/{paypal-67c86683.js → paypal-75c5c66d.js} +2 -2
  49. package/dist/esm/{placeTestOrder-e81fff15.js → placeTestOrder-22633bf2.js} +2 -2
  50. package/dist/esm/{renderCheckoutCurrency-1fc00db4.js → renderCheckoutCurrency-d27b0082.js} +2 -2
  51. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  52. package/dist/esm/zonos-address_4.entry.js +2 -2
  53. package/dist/esm/zonos-card_5.entry.js +3 -3
  54. package/dist/esm/zonos-cart-items_12.entry.js +6 -6
  55. package/dist/esm/zonos-checkout.entry.js +443 -18
  56. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  57. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  58. package/dist/esm/zonos-collect.entry.js +4 -4
  59. package/dist/esm/zonos-controller.entry.js +2 -2
  60. package/dist/esm/zonos-country-flag.entry.js +1 -1
  61. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  62. package/dist/esm/zonos-hello-dialog.entry.js +45 -12
  63. package/dist/esm/zonos-hello.entry.js +1 -1
  64. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  65. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  66. package/dist/esm/zonos-invoice.entry.js +4 -4
  67. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  68. package/dist/esm/zonos-store-credit.entry.js +3 -3
  69. package/dist/esm-es5/{cart-4cd47a1b.js → cart-76fb528f.js} +1 -1
  70. package/dist/esm-es5/{hasInclusivePrice-7a3dc4c3.js → hasInclusivePrice-275b1048.js} +1 -1
  71. package/dist/esm-es5/index.js +1 -1
  72. package/dist/esm-es5/{invoice-03ff7bbb.js → invoice-9efcb941.js} +1 -1
  73. package/dist/esm-es5/{isCollectMobileTablet-9eb77c9a.js → isCollectMobileTablet-a7e5b909.js} +1 -1
  74. package/dist/esm-es5/{localization-79e08480.js → localization-76ce3e29.js} +1 -1
  75. package/dist/esm-es5/{paypal-67c86683.js → paypal-75c5c66d.js} +2 -2
  76. package/dist/esm-es5/{placeTestOrder-e81fff15.js → placeTestOrder-22633bf2.js} +1 -1
  77. package/dist/esm-es5/{renderCheckoutCurrency-1fc00db4.js → renderCheckoutCurrency-d27b0082.js} +1 -1
  78. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  79. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  80. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  81. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  82. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  83. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  84. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  85. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  86. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  87. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  88. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  89. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  90. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  91. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  92. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  93. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  94. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  95. package/dist/esm-es5/zonos-store-credit.entry.js +1 -1
  96. package/dist/scripts/index.d.ts +21 -5
  97. package/dist/scripts/index.js +1 -1
  98. package/dist/scripts/loadZonos.js +1 -1
  99. package/dist/scripts/zonos.js +1 -1
  100. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +16 -0
  101. package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog.d.ts +6 -0
  102. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  103. package/dist/types/components/utils/checkout/bigcommerceStorefrontApi.d.ts +6 -0
  104. package/dist/types/components/utils/checkout/buildBigcommerceLoginUrl.d.ts +27 -0
  105. package/dist/types/components/utils/checkout/checkBigCommerceBypassCustomerGroup.d.ts +12 -0
  106. package/dist/types/components/utils/checkout/checkBigCommerceForceLogin.d.ts +50 -0
  107. package/dist/types/components/utils/checkout/fetchBigCommerceCheckoutSettings.d.ts +18 -0
  108. package/dist/types/components/utils/checkout/fixBigCommerceLoginCreateAccountLink.d.ts +17 -0
  109. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +6 -5
  110. package/dist/types/types/checkout/CheckoutConfig.d.ts +9 -0
  111. package/dist/types/types/checkout/api/BigCommerceCheckoutSettings.d.ts +12 -0
  112. package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -1
  113. package/dist/types/types/generated/graphql.frontend.types.ts +3 -1
  114. package/dist/types/types/generated/graphql.internal.types.d.ts +58 -9
  115. package/dist/types/types/generated/graphql.internal.types.ts +69 -9
  116. package/dist/types/types/index.d.ts +1 -0
  117. package/dist/zonos-elements/index.esm.js +1 -1
  118. package/dist/zonos-elements/{p-aa3e3438.system.entry.js → p-055c8d6c.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-ce2fd652.entry.js → p-0a9741f7.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-3fc43187.system.entry.js → p-10da499b.system.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-2c1c6d60.system.entry.js → p-14d35979.system.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-271eebd3.system.js → p-1523f6a8.system.js} +1 -1
  123. package/dist/zonos-elements/{p-c585d169.entry.js → p-1661f938.entry.js} +1 -1
  124. package/dist/zonos-elements/{p-3092ec40.system.entry.js → p-1e9e284e.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-7559c494.js → p-1ebb59a3.js} +1 -1
  126. package/dist/zonos-elements/{p-4e2262e8.js → p-24f41959.js} +1 -1
  127. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  128. package/dist/zonos-elements/{p-0ca6ee9b.entry.js → p-29d16ad0.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-0f4822cc.system.entry.js → p-2b2b1c8c.system.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-91eeccaa.entry.js → p-2d854a75.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-a90c977a.system.js → p-2ec799e4.system.js} +1 -1
  132. package/dist/zonos-elements/{p-d0690cdc.system.js → p-3600280d.system.js} +1 -1
  133. package/dist/zonos-elements/p-3ee8496e.js +1 -0
  134. package/dist/zonos-elements/{p-21519ebe.entry.js → p-425f747b.entry.js} +1 -1
  135. package/dist/zonos-elements/p-439dc620.system.entry.js +1 -0
  136. package/dist/zonos-elements/{p-9f3aab4e.system.entry.js → p-4b138a6e.system.entry.js} +1 -1
  137. package/dist/zonos-elements/{p-7aeb496e.entry.js → p-5262f6e8.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-b53856bf.system.js → p-567abb43.system.js} +1 -1
  139. package/dist/zonos-elements/{p-9d435f12.system.entry.js → p-5fa3d1c8.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-e9f36d6b.system.entry.js → p-6cf8fe49.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-8adc0a13.system.js → p-6d36b307.system.js} +1 -1
  142. package/dist/zonos-elements/{p-380143db.entry.js → p-6e50f6f5.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-80ba5f70.entry.js → p-7157a5a3.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-3675766a.entry.js → p-788c6839.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-a7b0345b.entry.js → p-791e13e7.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-e173fbd1.system.entry.js → p-8585c761.system.entry.js} +1 -1
  147. package/dist/zonos-elements/p-868a8667.js +1 -0
  148. package/dist/zonos-elements/{p-c2139758.entry.js → p-9460919d.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-6b83ac7f.entry.js → p-99d92a84.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-0740f8a4.system.entry.js → p-9a9c9441.system.entry.js} +1 -1
  151. package/dist/zonos-elements/p-9cbac993.entry.js +1 -0
  152. package/dist/zonos-elements/{p-a60544cc.entry.js → p-9cff66a7.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-b3824361.entry.js → p-a0f6910c.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-7caa75bb.js → p-a18adf27.js} +1 -1
  155. package/dist/zonos-elements/{p-8b35e475.system.entry.js → p-a4b6865d.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-c23e2501.system.entry.js → p-a89096d6.system.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-e3f9779a.system.entry.js → p-afca19b0.system.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-429c1d0c.entry.js → p-afdb4445.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-4a84387a.system.entry.js → p-b34f1336.system.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-5818f4a7.entry.js → p-bba9af4c.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-e62342c3.js → p-bd938f80.js} +1 -1
  162. package/dist/zonos-elements/{p-8ed0fad5.js → p-bdb3f7a2.js} +2 -2
  163. package/dist/zonos-elements/p-c85e988d.system.js +1 -0
  164. package/dist/zonos-elements/{p-e5f5b086.system.js → p-cc645667.system.js} +1 -1
  165. package/dist/zonos-elements/p-d13120f6.entry.js +1 -0
  166. package/dist/zonos-elements/{p-e80832cb.system.entry.js → p-e5f48239.system.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-22bb7836.system.js → p-e6168c82.system.js} +1 -1
  168. package/dist/zonos-elements/{p-e56f5954.system.js → p-e8a68ce7.system.js} +1 -1
  169. package/dist/zonos-elements/p-ed03b7fd.js +1 -0
  170. package/dist/zonos-elements/{p-b414b484.system.entry.js → p-edb0306c.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-e6feafc1.system.entry.js → p-f4e54f09.system.entry.js} +1 -1
  172. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  173. package/package.json +1 -1
  174. package/dist/zonos-elements/p-0e83d193.js +0 -1
  175. package/dist/zonos-elements/p-6bcbe651.js +0 -1
  176. package/dist/zonos-elements/p-7cbbf483.system.js +0 -1
  177. package/dist/zonos-elements/p-ac7b93c9.js +0 -1
  178. package/dist/zonos-elements/p-da7e1143.system.entry.js +0 -1
  179. package/dist/zonos-elements/p-ddb27b4a.entry.js +0 -1
  180. package/dist/zonos-elements/p-fed19033.entry.js +0 -1
@@ -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-f1d45eac.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-66de1b16.js';
5
- import { b as stripeStore, t as trackConversionEvent } from './cart-4cd47a1b.js';
6
- import { s as storageStore } from './localization-79e08480.js';
5
+ import { b as stripeStore, t as trackConversionEvent } from './cart-76fb528f.js';
6
+ import { s as storageStore } from './localization-76ce3e29.js';
7
7
  import { l as logError } from './handleFetch-a844cac1.js';
8
- import { d as paypalStoreInitButtons, e as paypalStoreOnChange } from './paypal-67c86683.js';
8
+ import { d as paypalStoreInitButtons, e as paypalStoreOnChange } from './paypal-75c5c66d.js';
9
9
  import { l as log } from './VarianceTest-572cecf5.js';
10
10
  import './isDarkColor-8092a9fb.js';
11
11
  import './isContrastColor-f9e65e70.js';
@@ -1,19 +1,19 @@
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, I as cartStoreHasOneEligibleItem, J as stripeStoreApplyPromoCode, K as stripeStoreRemovePromoCode, b as stripeStore, C as stripeStoreReset, c as stripeStoreRetrievePayment, t as trackConversionEvent, L as stripeStoreResetPromoCode, M as stripeStoreMessageBasedOnStatus, N as storeCreditStore, O as storeCreditStoreReset, x as storeCreditStoreCoversFullAmount, r as cartStoreNextStep, P as stripeStoreTranslateAddressToLatin, Q as extractName, D as cartStoreOnChange, R as stripeStoreAsyncAddressUpdate, H as cartStoreUpdateSelectedShippingOption, S as cartStoreGetShippingTransitInfo, T as cartStoreGetMethod, U as sortServiceLevelOptionsByAmount } from './cart-4cd47a1b.js';
3
- import { t as translate, l as localizationStore, s as storageStore, c as localizationStoreOnChange } from './localization-79e08480.js';
4
- import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-1fc00db4.js';
2
+ import { d as cartStore, I as cartStoreHasOneEligibleItem, J as stripeStoreApplyPromoCode, K as stripeStoreRemovePromoCode, b as stripeStore, C as stripeStoreReset, c as stripeStoreRetrievePayment, t as trackConversionEvent, L as stripeStoreResetPromoCode, M as stripeStoreMessageBasedOnStatus, N as storeCreditStore, O as storeCreditStoreReset, x as storeCreditStoreCoversFullAmount, r as cartStoreNextStep, P as stripeStoreTranslateAddressToLatin, Q as extractName, D as cartStoreOnChange, R as stripeStoreAsyncAddressUpdate, H as cartStoreUpdateSelectedShippingOption, S as cartStoreGetShippingTransitInfo, T as cartStoreGetMethod, U as sortServiceLevelOptionsByAmount } from './cart-76fb528f.js';
3
+ import { t as translate, l as localizationStore, s as storageStore, c as localizationStoreOnChange } from './localization-76ce3e29.js';
4
+ import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-d27b0082.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-f1d45eac.js';
8
- import { D as DUTY_KEY, T as TAXES_KEY, h as hasInclusivePrice } from './hasInclusivePrice-7a3dc4c3.js';
9
- import { c as paypalStoreReset, a as paypalStore } from './paypal-67c86683.js';
8
+ import { D as DUTY_KEY, T as TAXES_KEY, h as hasInclusivePrice } from './hasInclusivePrice-275b1048.js';
9
+ import { c as paypalStoreReset, a as paypalStore } from './paypal-75c5c66d.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-66de1b16.js';
13
13
  import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
14
14
  import { s as submitGtag } from './submitGtag-543058f9.js';
15
15
  import { l as languages } from './ILanguage-cd6acb72.js';
16
- import { p as placeTestOrder } from './placeTestOrder-e81fff15.js';
16
+ import { p as placeTestOrder } from './placeTestOrder-22633bf2.js';
17
17
  import { i as isDarkColor } from './isDarkColor-8092a9fb.js';
18
18
  import { g as getContrastColor } from './getContrastColor-e14f95a7.js';
19
19
  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, 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, p as cartStoreSetCheckoutSession, q as stripeStorePrefetchLandedCost, r as cartStoreNextStep, u as stripeStoreUpdateCheckoutSessionBaseCurrency, v as stripeStoreHandleInventoryCheck, w as storeCreditStoreApplyCredit, x as storeCreditStoreCoversFullAmount, y as validateCheckoutSession, z as storeCreditStoreCreateOrder, A as stripeStoreConfirmPayment, B as stripeStoreHandleInventoryRefund, C as stripeStoreReset, D as cartStoreOnChange, E as stripeStoreOnChange, F as storeCreditStoreGetEffectiveAmount } from './cart-4cd47a1b.js';
3
- import { p as paypalStoreHasPaypalEnabled, a as paypalStore, b as paypalInitScript } from './paypal-67c86683.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-79e08480.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, 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, p as cartStoreSetCheckoutSession, q as stripeStorePrefetchLandedCost, r as cartStoreNextStep, u as stripeStoreUpdateCheckoutSessionBaseCurrency, v as stripeStoreHandleInventoryCheck, w as storeCreditStoreApplyCredit, x as storeCreditStoreCoversFullAmount, y as validateCheckoutSession, z as storeCreditStoreCreateOrder, A as stripeStoreConfirmPayment, B as stripeStoreHandleInventoryRefund, C as stripeStoreReset, D as cartStoreOnChange, E as stripeStoreOnChange, F as storeCreditStoreGetEffectiveAmount } from './cart-76fb528f.js';
3
+ import { p as paypalStoreHasPaypalEnabled, a as paypalStore, b as paypalInitScript } from './paypal-75c5c66d.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-76ce3e29.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-f1d45eac.js';
6
6
  import { b as buildCartItemsByTempCart } from './buildCartItemsByTempCart-a117f75d.js';
7
- import { h as handleFetch, g as getIsTestMode, l as logError, b as getAdditionalLogMetadata, j as jsonParse, s as sendErrorLog, a as getIsStagingMode, i as isCheckoutMobile } from './handleFetch-a844cac1.js';
7
+ import { h as handleFetch, g as getIsTestMode, l as logError, j as jsonParse, b as getAdditionalLogMetadata, s as sendErrorLog, a as getIsStagingMode, i as isCheckoutMobile } from './handleFetch-a844cac1.js';
8
8
  import { u as updateCheckoutSessionAttributes } from './updateCheckoutSessionAttributes-8f3f932e.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,6 +93,71 @@ const buildCartUrl = ({ cartId, checkoutSessionId, customerAddress1, customerAdd
93
93
  return `${hostedCheckoutUrl}?${urlParams.toString()}`;
94
94
  };
95
95
 
96
+ /**
97
+ * The query flag that BigCommerce carries back to `cart.php` after the
98
+ * shopper logs in. When present, Zonos-elements knows to resume the
99
+ * international checkout flow instead of letting BC's native cart UX
100
+ * take over.
101
+ */
102
+ const BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG = 'isInternationalCheckout';
103
+ /**
104
+ * Build the `from` query value handed to BigCommerce's `/login.php` so that
105
+ * after a successful login the shopper lands back on `cart.php` with the
106
+ * `isInternationalCheckout=true` flag set (plus any `zonosTestMode` /
107
+ * `zonosQaUrl` / `zonosQaUrlApi` that were on the current URL, so the
108
+ * preview build / API host / test credentials carry through the round trip).
109
+ */
110
+ const buildFromCartPath = () => {
111
+ const params = new URLSearchParams();
112
+ params.set(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG, 'true');
113
+ const currentParams = new URLSearchParams(window.location.search);
114
+ const zonosQaUrl = currentParams.get('zonosQaUrl');
115
+ if (zonosQaUrl) {
116
+ params.set('zonosQaUrl', zonosQaUrl);
117
+ }
118
+ const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
119
+ if (zonosQaUrlApi) {
120
+ params.set('zonosQaUrlApi', zonosQaUrlApi);
121
+ }
122
+ if (getIsTestMode()) {
123
+ params.set('zonosTestMode', '1');
124
+ }
125
+ return `cart.php?${params.toString()}`;
126
+ };
127
+ /**
128
+ * Build an absolute URL to BigCommerce's `/login.php` with the
129
+ * `from=cart.php?isInternationalCheckout=true` round-trip encoded so the
130
+ * shopper resumes Zonos international checkout after authenticating.
131
+ *
132
+ * Preserves `zonosTestMode` / `zonosQaUrl` / `zonosQaUrlApi` from the current
133
+ * URL across the redirect — the login round trip leaves BC's frontend, so
134
+ * without this the returning `cart.php` would drop back to the production
135
+ * build / API host.
136
+ */
137
+ const buildBigcommerceLoginUrl = ({ action } = {}) => {
138
+ const url = new URL('/login.php', window.location.origin);
139
+ if (action) {
140
+ url.searchParams.set('action', action);
141
+ }
142
+ const currentParams = new URLSearchParams(window.location.search);
143
+ // set zonosQaUrl from the current URL
144
+ const zonosQaUrl = currentParams.get('zonosQaUrl');
145
+ if (zonosQaUrl) {
146
+ url.searchParams.set('zonosQaUrl', zonosQaUrl);
147
+ }
148
+ // set zonosQaUrlApi from the current URL
149
+ const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
150
+ if (zonosQaUrlApi) {
151
+ url.searchParams.set('zonosQaUrlApi', zonosQaUrlApi);
152
+ }
153
+ // set zonosTestMode from the current URL
154
+ if (getIsTestMode()) {
155
+ url.searchParams.set('zonosTestMode', '1');
156
+ }
157
+ url.searchParams.set('from', buildFromCartPath());
158
+ return url.toString();
159
+ };
160
+
96
161
  /**
97
162
  * Build an absolute redirect URL used by the BigCommerce checkout flows to
98
163
  * navigate between the BC native `/checkout` page and the Zonos international
@@ -165,6 +230,12 @@ const fetchBigCommerceCheckout = async (checkoutId) => {
165
230
  return null;
166
231
  }
167
232
  };
233
+ /**
234
+ * Whether the BigCommerce shopper is already logged in. We key off the
235
+ * customer's numeric `id` since the storefront API populates it only for
236
+ * authenticated sessions (guest checkouts have an empty `customer` object).
237
+ */
238
+ const isBigCommerceCustomerLoggedIn = (checkout) => { var _a; return !!((_a = checkout === null || checkout === void 0 ? void 0 : checkout.customer) === null || _a === void 0 ? void 0 : _a.id); };
168
239
 
169
240
  const DEFAULT_RESULT = {
170
241
  customerGroupId: null,
@@ -174,7 +245,7 @@ const DEFAULT_RESULT = {
174
245
  * Performs the actual fetch logic to determine if the customer
175
246
  * belongs to a bypass group.
176
247
  */
177
- const fetchBypassOutcome = async () => {
248
+ const fetchBypassOutcome = async (preFetched) => {
178
249
  var _a, _b, _c, _d;
179
250
  // Only relevant for BigCommerce stores — permanent no-op on other platforms
180
251
  if (!window.Zonos.isBigCommerce) {
@@ -191,8 +262,11 @@ const fetchBypassOutcome = async () => {
191
262
  // Mark as inconclusive so a later caller retries after config loads.
192
263
  return { conclusive: false, result: DEFAULT_RESULT };
193
264
  }
194
- // Fetch customer group from BigCommerce Storefront API
195
- const checkoutId = await fetchCheckoutId();
265
+ // Fetch customer group from BigCommerce Storefront API — or reuse
266
+ // caller-supplied data when available.
267
+ const checkoutId = preFetched
268
+ ? preFetched.checkoutId
269
+ : await fetchCheckoutId();
196
270
  if (!checkoutId) {
197
271
  // No active cart yet — inconclusive. Common on fresh sessions where
198
272
  // `initBigCommerceBypassCheck` runs before the user has added anything
@@ -200,7 +274,9 @@ const fetchBypassOutcome = async () => {
200
274
  log('BigCommerce bypass check: no active cart yet, will retry on next call', 'info');
201
275
  return { conclusive: false, result: DEFAULT_RESULT };
202
276
  }
203
- const checkout = await fetchBigCommerceCheckout(checkoutId);
277
+ const checkout = preFetched
278
+ ? preFetched.checkout
279
+ : await fetchBigCommerceCheckout(checkoutId);
204
280
  if (!checkout) {
205
281
  // API call failed (network error, non-200, etc.) — inconclusive.
206
282
  // Caching this would permanently disable bypass for the session if
@@ -234,8 +310,8 @@ const fetchBypassOutcome = async () => {
234
310
  * cart or after settings finish loading).
235
311
  */
236
312
  let bypassCheckPromise = null;
237
- const startBypassCheck = () => {
238
- const outcomePromise = fetchBypassOutcome();
313
+ const startBypassCheck = (preFetched) => {
314
+ const outcomePromise = fetchBypassOutcome(preFetched);
239
315
  const resultPromise = outcomePromise.then(({ conclusive, result }) => {
240
316
  if (!conclusive && bypassCheckPromise === resultPromise) {
241
317
  // Invalidate cache so the next caller performs a fresh fetch.
@@ -281,11 +357,259 @@ const initBigCommerceBypassCheck = () => {
281
357
  */
282
358
  const checkBigCommerceBypassCustomerGroup = async (options = {}) => {
283
359
  if (options.forceRefresh || !bypassCheckPromise) {
284
- return startBypassCheck();
360
+ return startBypassCheck(options.preFetched);
285
361
  }
286
362
  return bypassCheckPromise;
287
363
  };
288
364
 
365
+ const EMPTY = { guestCheckoutType: null };
366
+ /**
367
+ * BigCommerce's `/checkouts/settings` values almost never change after a
368
+ * merchant's initial setup, so we persist the result in `localStorage` and
369
+ * reuse it across page loads up to this TTL. Short enough that if the
370
+ * merchant flips `guest_checkout_type` the change still propagates within
371
+ * an hour.
372
+ */
373
+ const CACHE_TTL_MS = 60 * 60 * 1000;
374
+ const CACHE_KEY = 'zonos--bc-checkout-settings';
375
+ const readFromCache = (storeHash) => {
376
+ try {
377
+ const raw = window.localStorage.getItem(CACHE_KEY);
378
+ if (!raw) {
379
+ return null;
380
+ }
381
+ const parsed = jsonParse(raw);
382
+ if (!parsed) {
383
+ return null;
384
+ }
385
+ // Different store on the same origin (e.g. zonosQaUrl preview) — ignore.
386
+ if (parsed.storeHash !== storeHash) {
387
+ return null;
388
+ }
389
+ if (parsed.expiresAt < Date.now()) {
390
+ return null;
391
+ }
392
+ return { guestCheckoutType: parsed.guestCheckoutType };
393
+ }
394
+ catch (_a) {
395
+ // localStorage access can throw in blocked-storage contexts (Safari
396
+ // private mode, cross-origin iframes) — treat as a cache miss so the
397
+ // network fallback runs.
398
+ return null;
399
+ }
400
+ };
401
+ const writeToCache = (storeHash, result) => {
402
+ try {
403
+ const payload = {
404
+ expiresAt: Date.now() + CACHE_TTL_MS,
405
+ guestCheckoutType: result.guestCheckoutType,
406
+ storeHash,
407
+ };
408
+ window.localStorage.setItem(CACHE_KEY, JSON.stringify(payload));
409
+ }
410
+ catch (_a) {
411
+ // localStorage can be disabled / quota-exceeded in some browser contexts
412
+ // (private mode, cross-origin iframes) — drop silently since caching
413
+ // is only an optimization.
414
+ }
415
+ };
416
+ /**
417
+ * Fetch the merchant's BigCommerce `/checkouts/settings` (via the demo-app
418
+ * proxy) so we can inspect `guest_checkout_type` from the storefront. The
419
+ * Store API is auth-gated, which is why we don't call it directly.
420
+ *
421
+ * Results are cached in `localStorage` for `CACHE_TTL_MS` so navigations
422
+ * inside the same store don't all pay the proxy round trip — the setting
423
+ * is merchant-level and rarely changes.
424
+ */
425
+ const fetchBigCommerceCheckoutSettings = async () => {
426
+ var _a;
427
+ if (!window.Zonos.isBigCommerce) {
428
+ return EMPTY;
429
+ }
430
+ const storeHash = (_a = zonosStore.checkoutSettings.bigCommerceConfig) === null || _a === void 0 ? void 0 : _a.storeHash;
431
+ if (!storeHash) {
432
+ log('BigCommerce checkout settings: no storeHash provided — skipping fetch', 'info');
433
+ return EMPTY;
434
+ }
435
+ const cached = readFromCache(storeHash);
436
+ if (cached) {
437
+ return cached;
438
+ }
439
+ const { errors, json } = await handleFetch('/api/bigcommerce/checkout-settings', {
440
+ body: { storeHash },
441
+ method: 'POST',
442
+ });
443
+ if (errors.length || !json) {
444
+ log('BigCommerce checkout settings: proxy call failed, falling back to guest-allowed behavior', 'info');
445
+ return EMPTY;
446
+ }
447
+ const result = {
448
+ guestCheckoutType: json.guestCheckoutType,
449
+ };
450
+ writeToCache(storeHash, result);
451
+ return result;
452
+ };
453
+
454
+ const SKIP = {
455
+ redirectUrl: null,
456
+ shouldForceLogin: false,
457
+ };
458
+ /**
459
+ * Session cache for the merchant-level "does BC require login?" answer.
460
+ * Hitting `/checkouts/settings` on every checkout open would add a visible
461
+ * round trip to the hot path, so we resolve it once and reuse — the setting
462
+ * is configured at the store level and very rarely changes.
463
+ *
464
+ * `null` means we haven't kicked off the fetch yet; the promise holds the
465
+ * eventual boolean so multiple concurrent callers deduplicate.
466
+ */
467
+ let storeRequiresLoginPromise = null;
468
+ const resolveStoreRequiresLogin = () => {
469
+ if (!storeRequiresLoginPromise) {
470
+ const pending = fetchBigCommerceCheckoutSettings()
471
+ .then(({ guestCheckoutType }) => {
472
+ if (!guestCheckoutType) {
473
+ // `null` here means either the proxy call failed (transient) or the
474
+ // storeHash wasn't known yet. Fail open for this call, but clear
475
+ // the cached promise so the next caller retries instead of
476
+ // permanently disabling force-login for the rest of the session.
477
+ if (storeRequiresLoginPromise === pending) {
478
+ storeRequiresLoginPromise = null;
479
+ }
480
+ return false;
481
+ }
482
+ return guestCheckoutType === 'no_guest_checkout';
483
+ })
484
+ .catch(() => {
485
+ // Defense-in-depth: `fetchBigCommerceCheckoutSettings` is expected to
486
+ // swallow its own errors, but if anything above does reject we fail
487
+ // open and clear the cached promise so the next caller can retry.
488
+ if (storeRequiresLoginPromise === pending) {
489
+ storeRequiresLoginPromise = null;
490
+ }
491
+ return false;
492
+ });
493
+ storeRequiresLoginPromise = pending;
494
+ }
495
+ return storeRequiresLoginPromise;
496
+ };
497
+ /**
498
+ * Kick off the `/checkouts/settings` fetch in the background on page load
499
+ * so the result is warm by the time the shopper opens checkout. Safe to
500
+ * call more than once — re-invocations reuse the in-flight/resolved
501
+ * promise.
502
+ */
503
+ const initBigCommerceForceLoginCheck = () => {
504
+ if (!window.Zonos.isBigCommerce) {
505
+ return;
506
+ }
507
+ void resolveStoreRequiresLogin();
508
+ };
509
+ /**
510
+ * Decide whether the current BigCommerce shopper must sign in before the
511
+ * Zonos international checkout is allowed to open.
512
+ *
513
+ * Required conditions (all must hold):
514
+ * 1. Running on a BigCommerce storefront.
515
+ * 2. BC merchant has `guest_checkout_type === 'no_guest_checkout'` in their
516
+ * live `/v3/checkouts/settings` response.
517
+ * 3. Shopper has an active cart.
518
+ * 4. Shopper is not already logged in to BigCommerce.
519
+ *
520
+ * Returning a `redirectUrl` is an instruction, not an action: callers drive
521
+ * the navigation themselves so they can short-circuit any UI state (loading
522
+ * overlays, dialog open flags) before `window.location.href` flips.
523
+ */
524
+ const checkBigCommerceForceLogin = async ({ preFetched, } = {}) => {
525
+ if (!window.Zonos.isBigCommerce) {
526
+ return SKIP;
527
+ }
528
+ const requiresLogin = await resolveStoreRequiresLogin();
529
+ if (!requiresLogin) {
530
+ return SKIP;
531
+ }
532
+ const checkoutId = preFetched
533
+ ? preFetched.checkoutId
534
+ : await fetchCheckoutId();
535
+ if (!checkoutId) {
536
+ // No active cart — nothing to protect. Force-login only matters once
537
+ // the shopper has a cart we're about to carry into Zonos checkout.
538
+ return SKIP;
539
+ }
540
+ const checkout = preFetched
541
+ ? preFetched.checkout
542
+ : await fetchBigCommerceCheckout(checkoutId);
543
+ if (!checkout) {
544
+ // Storefront API failure — fail open so a transient outage doesn't
545
+ // block the shopper. The merchant's BC checkout will still enforce
546
+ // login server-side as a last line of defense.
547
+ log('BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue', 'info');
548
+ return SKIP;
549
+ }
550
+ if (isBigCommerceCustomerLoggedIn(checkout)) {
551
+ return SKIP;
552
+ }
553
+ log('BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php', 'info');
554
+ return {
555
+ redirectUrl: buildBigcommerceLoginUrl(),
556
+ shouldForceLogin: true,
557
+ };
558
+ };
559
+
560
+ /**
561
+ * Mark we've already rewritten a given anchor so the MutationObserver
562
+ * doesn't loop on its own mutation.
563
+ */
564
+ const REWRITTEN_ATTR = 'data-zonos-login-from-rewritten';
565
+ const CREATE_ACCOUNT_SELECTOR = 'a[href*="login.php?action=create_account"]:not([' + REWRITTEN_ATTR + '])';
566
+ const rewriteCreateAccountLinks = () => {
567
+ const anchors = document.querySelectorAll(CREATE_ACCOUNT_SELECTOR);
568
+ if (!anchors.length) {
569
+ return;
570
+ }
571
+ const target = buildBigcommerceLoginUrl({ action: 'create_account' });
572
+ anchors.forEach(anchor => {
573
+ anchor.setAttribute('href', target);
574
+ anchor.setAttribute(REWRITTEN_ATTR, 'true');
575
+ });
576
+ };
577
+ /**
578
+ * On BigCommerce's `/login.php`, the default **Create account** button links
579
+ * to `login.php?action=create_account` without the `from=cart.php...`
580
+ * parameter that the shopper had when they arrived. Without this, completing
581
+ * signup would drop them on the account home page instead of resuming Zonos
582
+ * international checkout.
583
+ *
584
+ * This watcher finds any create-account anchor on the page (including ones
585
+ * that the BC theme renders later via Stencil bundle load) and rewrites the
586
+ * `href` so the account-creation round trip preserves the
587
+ * `isInternationalCheckout=true` flag as well as `zonosTestMode` /
588
+ * `zonosQaUrl`.
589
+ *
590
+ * Safe to call more than once — idempotent thanks to the `data-zonos-…`
591
+ * attribute on rewritten anchors.
592
+ */
593
+ const fixBigCommerceLoginCreateAccountLink = () => {
594
+ if (!window.Zonos.isBigCommerce) {
595
+ return;
596
+ }
597
+ if (!window.location.pathname.includes('/login.php')) {
598
+ return;
599
+ }
600
+ rewriteCreateAccountLinks();
601
+ // BC's login page often renders the auth form asynchronously, so the
602
+ // anchor may not exist yet when this runs. Observe for a short window,
603
+ // then stop so we don't leak a listener for the rest of the session.
604
+ const observer = new MutationObserver(() => {
605
+ rewriteCreateAccountLinks();
606
+ });
607
+ observer.observe(document.body, { childList: true, subtree: true });
608
+ // 10 seconds is plenty for the login form to mount; stopping the observer
609
+ // avoids churn from the rest of the page's normal DOM activity.
610
+ setTimeout(() => observer.disconnect(), 10000);
611
+ };
612
+
289
613
  const isDisabledCountry = (showLog = true) => {
290
614
  if (!localizationStore.localizationLoaded) {
291
615
  return true;
@@ -335,19 +659,27 @@ const FALLBACK_SHIP_TO_COUNTRY_SELECTOR = 'select[name="shippingAddress.countryC
335
659
  */
336
660
  const checkLoggedInUserShippingAddress = async ({ onInternationalCheckoutSelected, onLoggedInInternationalAddressDetected, }) => {
337
661
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
662
+ // Fetch the Storefront API data once up front and thread it through every
663
+ // decision below (bypass, shipping-address inspection, force-login). The
664
+ // function always needs the checkout for the address check, so reusing one
665
+ // fetch avoids the earlier 4x round-trip fan-out where bypass, address
666
+ // lookup, and force-login each fetched independently.
667
+ const checkoutId = await fetchCheckoutId();
668
+ if (!checkoutId) {
669
+ return 'noAction';
670
+ }
671
+ const checkout = await fetchBigCommerceCheckout(checkoutId);
672
+ const preFetched = { checkout, checkoutId };
338
673
  // Check if the customer belongs to a bypass group (e.g. resellers) before
339
674
  // redirecting them away from BigCommerce native checkout. This delegates to
340
675
  // the shared helper so the bypass decision has a single source of truth and
341
676
  // reuses the cached promise warmed by `initBigCommerceBypassCheck`.
342
- const { shouldBypass } = await checkBigCommerceBypassCustomerGroup();
677
+ const { shouldBypass } = await checkBigCommerceBypassCustomerGroup({
678
+ preFetched,
679
+ });
343
680
  if (shouldBypass) {
344
681
  return 'noAction';
345
682
  }
346
- const checkoutId = await fetchCheckoutId();
347
- if (!checkoutId) {
348
- return 'noAction';
349
- }
350
- const checkout = await fetchBigCommerceCheckout(checkoutId);
351
683
  const shippingAddress = (_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.consignments) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.shippingAddress;
352
684
  if (!(shippingAddress === null || shippingAddress === void 0 ? void 0 : shippingAddress.countryCode)) {
353
685
  return 'noAction';
@@ -370,6 +702,14 @@ const checkLoggedInUserShippingAddress = async ({ onInternationalCheckoutSelecte
370
702
  return 'optedOut';
371
703
  }
372
704
  }
705
+ // Force-login merchants must sign the guest shopper in before we leave
706
+ // BC's native checkout. Reuse the checkout we already fetched above so we
707
+ // don't double up on Storefront API round trips.
708
+ const forceLogin = await checkBigCommerceForceLogin({ preFetched });
709
+ if (forceLogin.shouldForceLogin && forceLogin.redirectUrl) {
710
+ window.location.href = forceLogin.redirectUrl;
711
+ return 'redirected';
712
+ }
373
713
  if (onInternationalCheckoutSelected) {
374
714
  await onInternationalCheckoutSelected();
375
715
  }
@@ -427,9 +767,17 @@ const watchImmediateBigcommerceDomesticCheckoutRedirect = ({ domesticRedirectedB
427
767
  // Only check bypass after confirming the country is shippable (i.e. user is
428
768
  // about to be redirected to Zonos international checkout). Force-refresh so
429
769
  // we re-fetch BigCommerce checkout data every time the ship-to country
430
- // changes — prevents stale customer-group data from a cached fetch.
770
+ // changes — prevents stale customer-group data from a cached fetch. Share
771
+ // one fetch between the bypass and force-login decisions so this poll
772
+ // tick does 2 Storefront API round trips instead of 4.
773
+ const checkoutId = await fetchCheckoutId();
774
+ const checkout = checkoutId
775
+ ? await fetchBigCommerceCheckout(checkoutId)
776
+ : null;
777
+ const preFetched = { checkout, checkoutId };
431
778
  const { shouldBypass } = await checkBigCommerceBypassCustomerGroup({
432
779
  forceRefresh: true,
780
+ preFetched,
433
781
  });
434
782
  if (shouldBypass) {
435
783
  // Logged-in customer is in a bypass group — keep them on BC native
@@ -437,6 +785,14 @@ const watchImmediateBigcommerceDomesticCheckoutRedirect = ({ domesticRedirectedB
437
785
  log('Bypass customer group detected on BC checkout, stopping interval', 'info');
438
786
  return true;
439
787
  }
788
+ // Same force-login gate as the logged-in-default-address path — we run
789
+ // it *after* the bypass check so reseller groups never see the login
790
+ // bounce, and *before* any UI/session state flips to the redirect.
791
+ const forceLogin = await checkBigCommerceForceLogin({ preFetched });
792
+ if (forceLogin.shouldForceLogin && forceLogin.redirectUrl) {
793
+ window.location.href = forceLogin.redirectUrl;
794
+ return true;
795
+ }
440
796
  if (onInternationalCheckoutSelected) {
441
797
  await onInternationalCheckoutSelected();
442
798
  }
@@ -1560,6 +1916,15 @@ const ZonosCheckout = class {
1560
1916
  window.location.href = buildBigcommerceRedirectUrl('/checkout');
1561
1917
  return;
1562
1918
  }
1919
+ // Merchants who disable BC guest checkout need the shopper
1920
+ // signed in before we open the Zonos international checkout.
1921
+ // Redirecting here keeps the dialog from flashing before the
1922
+ // login bounce.
1923
+ const forceLogin = await checkBigCommerceForceLogin();
1924
+ if (forceLogin.shouldForceLogin && forceLogin.redirectUrl) {
1925
+ window.location.href = forceLogin.redirectUrl;
1926
+ return;
1927
+ }
1563
1928
  }
1564
1929
  // start loading
1565
1930
  stripeStore.isFetchingSession = true;
@@ -1812,6 +2177,19 @@ const ZonosCheckout = class {
1812
2177
  // Start fetching BigCommerce customer group on page load so the bypass
1813
2178
  // result is ready by the time checkout opens or the BC watcher fires
1814
2179
  initBigCommerceBypassCheck();
2180
+ // Warm the BigCommerce `/checkouts/settings` fetch (merchant's
2181
+ // `guest_checkout_type`) so force-login gating resolves instantly when
2182
+ // the shopper clicks checkout — otherwise the first checkout open
2183
+ // would block on a proxy round trip.
2184
+ initBigCommerceForceLoginCheck();
2185
+ // On BC's `/login.php`, rewrite the "Create account" button href so
2186
+ // the post-signup round trip preserves the `from=cart.php?...` flag
2187
+ // that carries the shopper back into Zonos international checkout.
2188
+ fixBigCommerceLoginCreateAccountLink();
2189
+ // If BC redirected the shopper back here after login with the Zonos
2190
+ // resume flag, auto-open the international checkout. Strip the flag
2191
+ // from the URL so a refresh doesn't keep re-triggering the dialog.
2192
+ this.handleBigcommerceInternationalResumeFlag();
1815
2193
  // check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
1816
2194
  watchImmediateBigcommerceDomesticCheckoutRedirect({
1817
2195
  domesticRedirectedBtnSelector: domesticRedirectedBtnSelector,
@@ -1893,6 +2271,53 @@ const ZonosCheckout = class {
1893
2271
  clearInterval(interval);
1894
2272
  }, 10000);
1895
2273
  }
2274
+ /**
2275
+ * After BigCommerce's `/login.php` round trip, the shopper lands back on
2276
+ * `cart.php?isInternationalCheckout=true`. Detect the flag, strip it from
2277
+ * the URL (so refreshing doesn't re-open the dialog), then fire the
2278
+ * international-checkout trigger once three preconditions are all met:
2279
+ * 1. Hello localization finished loading (`localizationLoaded`).
2280
+ * 2. A country code is selected — otherwise `buildCartDetail` runs
2281
+ * without a `countryCode` / `currencyCode` and never builds a cart.
2282
+ * 3. The hidden trigger button has mounted.
2283
+ *
2284
+ * Without the first two gates we race Hello's own init and the click
2285
+ * fires against a half-initialized store, which is what happens when
2286
+ * the shopper refreshes back into cart.php straight from the login
2287
+ * round trip.
2288
+ */
2289
+ handleBigcommerceInternationalResumeFlag() {
2290
+ if (!window.Zonos.isBigCommerce) {
2291
+ return;
2292
+ }
2293
+ const url = new URL(window.location.href);
2294
+ if (url.searchParams.get(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG) !== 'true') {
2295
+ return;
2296
+ }
2297
+ url.searchParams.delete(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG);
2298
+ window.history.replaceState({}, '', url.toString());
2299
+ const start = Date.now();
2300
+ const interval = setInterval(() => {
2301
+ if (!localizationStore.localizationLoaded ||
2302
+ !localizationStore.selectedCountryCode) {
2303
+ if (Date.now() - start > 15000) {
2304
+ clearInterval(interval);
2305
+ log('BigCommerce international checkout resume flag: localization did not initialize within 15s', 'info');
2306
+ }
2307
+ return;
2308
+ }
2309
+ const btn = document.querySelector(`#${checkoutHiddenInternationalBtnSelector}`);
2310
+ if (btn) {
2311
+ clearInterval(interval);
2312
+ btn.dispatchEvent(createCustomEvent('click'));
2313
+ return;
2314
+ }
2315
+ if (Date.now() - start > 15000) {
2316
+ clearInterval(interval);
2317
+ log('BigCommerce international checkout resume flag: trigger button did not mount within 15s', 'info');
2318
+ }
2319
+ }, 200);
2320
+ }
1896
2321
  /**
1897
2322
  * For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
1898
2323
  */
@@ -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-4cd47a1b.js';
2
+ import { d as cartStore } from './cart-76fb528f.js';
3
3
  import { c as cleanHtmlMarkdown } from './cleanHtmlMarkdown-5f7856f2.js';
4
4
  import { f as zonosStoreFontFamily } from './zonosStore-f1d45eac.js';
5
5
  import { c as classes } from './classes-0d95c529.js';
6
6
  import { s as styles } from './styles-6fc2fad9.js';
7
- import './localization-79e08480.js';
7
+ import './localization-76ce3e29.js';
8
8
  import './handleFetch-a844cac1.js';
9
9
  import './VarianceTest-572cecf5.js';
10
10
  import './isDarkColor-8092a9fb.js';
@@ -1,18 +1,18 @@
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, L as stripeStoreResetPromoCode, C as stripeStoreReset, M as stripeStoreMessageBasedOnStatus, d as cartStore, r as cartStoreNextStep, D as cartStoreOnChange } from './cart-4cd47a1b.js';
3
- import { c as paypalStoreReset, a as paypalStore, b as paypalInitScript } from './paypal-67c86683.js';
4
- import { t as translate, s as storageStore, l as localizationStore, p as translationStoreOnChange } from './localization-79e08480.js';
2
+ import { b as stripeStore, c as stripeStoreRetrievePayment, t as trackConversionEvent, L as stripeStoreResetPromoCode, C as stripeStoreReset, M as stripeStoreMessageBasedOnStatus, d as cartStore, r as cartStoreNextStep, D as cartStoreOnChange } from './cart-76fb528f.js';
3
+ import { c as paypalStoreReset, a as paypalStore, b as paypalInitScript } from './paypal-75c5c66d.js';
4
+ import { t as translate, s as storageStore, l as localizationStore, p as translationStoreOnChange } from './localization-76ce3e29.js';
5
5
  import { z as zonosStore } from './zonosStore-f1d45eac.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-66de1b16.js';
9
9
  import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
10
10
  import { s as submitGtag } from './submitGtag-543058f9.js';
11
- import { i as isCollectMobile, a as isCollectTablet, e as collectStore } from './isCollectMobileTablet-9eb77c9a.js';
11
+ import { i as isCollectMobile, a as isCollectTablet, e as collectStore } from './isCollectMobileTablet-a7e5b909.js';
12
12
  import { c as classes } from './classes-0d95c529.js';
13
13
  import { l as languages } from './ILanguage-cd6acb72.js';
14
- import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-1fc00db4.js';
15
- import { p as placeTestOrder } from './placeTestOrder-e81fff15.js';
14
+ import { r as renderCheckoutCurrency } from './renderCheckoutCurrency-d27b0082.js';
15
+ import { p as placeTestOrder } from './placeTestOrder-22633bf2.js';
16
16
  import { r as renderFallback } from './renderFallback-b250f4e9.js';
17
17
  import './isDarkColor-8092a9fb.js';
18
18
  import './isContrastColor-f9e65e70.js';