@zonos/elements 1.3.258 → 1.3.260

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 (177) hide show
  1. package/dist/cjs/{cart-c618fd5b.js → cart-d08c87e2.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-58a9f15d.js → hasInclusivePrice-c781c336.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-c9cb6683.js → invoice-e64f97c6.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-93a5194a.js → isCollectMobileTablet-9675485f.js} +2 -2
  6. package/dist/cjs/{localization-5994d4de.js → localization-a7fac4b4.js} +3 -0
  7. package/dist/cjs/{paypal-091e089e.js → paypal-73a542cb.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-b07f8edb.js → placeTestOrder-aefd31e8.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-7876a1d4.js → renderCheckoutCurrency-a374741a.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 +8 -8
  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 +6 -6
  30. package/dist/collection/components/store/hello/localization.js +3 -0
  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-76fb528f.js → cart-c490d252.js} +1 -1
  43. package/dist/esm/{hasInclusivePrice-275b1048.js → hasInclusivePrice-7a0ce66a.js} +1 -1
  44. package/dist/esm/index.js +7 -7
  45. package/dist/esm/{invoice-9efcb941.js → invoice-3ea5715b.js} +2 -2
  46. package/dist/esm/{isCollectMobileTablet-a7e5b909.js → isCollectMobileTablet-0dcbd45a.js} +2 -2
  47. package/dist/esm/{localization-76ce3e29.js → localization-542dbe20.js} +3 -0
  48. package/dist/esm/{paypal-75c5c66d.js → paypal-38ca5d21.js} +2 -2
  49. package/dist/esm/{placeTestOrder-22633bf2.js → placeTestOrder-d7001709.js} +2 -2
  50. package/dist/esm/{renderCheckoutCurrency-d27b0082.js → renderCheckoutCurrency-75f1bba3.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 +8 -8
  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-76fb528f.js → cart-c490d252.js} +1 -1
  70. package/dist/esm-es5/{hasInclusivePrice-275b1048.js → hasInclusivePrice-7a0ce66a.js} +1 -1
  71. package/dist/esm-es5/index.js +1 -1
  72. package/dist/esm-es5/{invoice-9efcb941.js → invoice-3ea5715b.js} +1 -1
  73. package/dist/esm-es5/{isCollectMobileTablet-a7e5b909.js → isCollectMobileTablet-0dcbd45a.js} +1 -1
  74. package/dist/esm-es5/{localization-76ce3e29.js → localization-542dbe20.js} +1 -1
  75. package/dist/esm-es5/{paypal-75c5c66d.js → paypal-38ca5d21.js} +2 -2
  76. package/dist/esm-es5/{placeTestOrder-22633bf2.js → placeTestOrder-d7001709.js} +1 -1
  77. package/dist/esm-es5/{renderCheckoutCurrency-d27b0082.js → renderCheckoutCurrency-75f1bba3.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/utils/api/getLocaleMessages.d.ts +1 -1
  102. package/dist/types/components/utils/checkout/bigcommerceStorefrontApi.d.ts +6 -0
  103. package/dist/types/components/utils/checkout/buildBigcommerceLoginUrl.d.ts +27 -0
  104. package/dist/types/components/utils/checkout/checkBigCommerceBypassCustomerGroup.d.ts +12 -0
  105. package/dist/types/components/utils/checkout/checkBigCommerceForceLogin.d.ts +50 -0
  106. package/dist/types/components/utils/checkout/fetchBigCommerceCheckoutSettings.d.ts +18 -0
  107. package/dist/types/components/utils/checkout/fixBigCommerceLoginCreateAccountLink.d.ts +17 -0
  108. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +6 -5
  109. package/dist/types/types/checkout/CheckoutConfig.d.ts +9 -0
  110. package/dist/types/types/checkout/api/BigCommerceCheckoutSettings.d.ts +12 -0
  111. package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -1
  112. package/dist/types/types/generated/graphql.frontend.types.ts +3 -1
  113. package/dist/types/types/generated/graphql.internal.types.d.ts +58 -9
  114. package/dist/types/types/generated/graphql.internal.types.ts +69 -9
  115. package/dist/types/types/index.d.ts +1 -0
  116. package/dist/zonos-elements/index.esm.js +1 -1
  117. package/dist/zonos-elements/{p-6d36b307.system.js → p-0699931c.system.js} +1 -1
  118. package/dist/zonos-elements/{p-29d16ad0.entry.js → p-0ad75f38.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-e6168c82.system.js → p-0ec4e307.system.js} +1 -1
  120. package/dist/zonos-elements/p-0f89fc76.system.entry.js +1 -0
  121. package/dist/zonos-elements/{p-4b138a6e.system.entry.js → p-0fc5a2cc.system.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-2ec799e4.system.js → p-196423ad.system.js} +1 -1
  123. package/dist/zonos-elements/{p-567abb43.system.js → p-20263609.system.js} +1 -1
  124. package/dist/zonos-elements/{p-a89096d6.system.entry.js → p-20842d8c.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-bdb3f7a2.js → p-24407504.js} +2 -2
  126. package/dist/zonos-elements/{p-1523f6a8.system.js → p-248bdea2.system.js} +1 -1
  127. package/dist/zonos-elements/{p-a4b6865d.system.entry.js → p-266a86d4.system.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-bba9af4c.entry.js → p-27f01d76.entry.js} +1 -1
  129. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  130. package/dist/zonos-elements/{p-b34f1336.system.entry.js → p-2ac0fcb8.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-5fa3d1c8.system.entry.js → p-2c9714e8.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-edb0306c.system.entry.js → p-365d4481.system.entry.js} +1 -1
  133. package/dist/zonos-elements/{p-7157a5a3.entry.js → p-3a198386.entry.js} +1 -1
  134. package/dist/zonos-elements/{p-1e9e284e.system.entry.js → p-3e7dbe9c.system.entry.js} +1 -1
  135. package/dist/zonos-elements/{p-99d92a84.entry.js → p-4416fe27.entry.js} +1 -1
  136. package/dist/zonos-elements/{p-e8a68ce7.system.js → p-47bde0ba.system.js} +1 -1
  137. package/dist/zonos-elements/p-4aa5f5db.entry.js +1 -0
  138. package/dist/zonos-elements/{p-afdb4445.entry.js → p-5be87ae0.entry.js} +1 -1
  139. package/dist/zonos-elements/p-6b7beb44.system.js +1 -0
  140. package/dist/zonos-elements/{p-e5f48239.system.entry.js → p-70e2f9f9.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-3ee8496e.js → p-7158a18b.js} +1 -1
  142. package/dist/zonos-elements/{p-867d05d7.system.js → p-720ae42c.system.js} +1 -1
  143. package/dist/zonos-elements/p-721fadd5.js +1 -0
  144. package/dist/zonos-elements/{p-24f41959.js → p-72adb40d.js} +1 -1
  145. package/dist/zonos-elements/p-7c5c5318.js +1 -0
  146. package/dist/zonos-elements/{p-9c97671b.system.entry.js → p-874ccf1c.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-0a9741f7.entry.js → p-87eef44c.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-6cf8fe49.system.entry.js → p-8d0bca3a.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-9a9c9441.system.entry.js → p-8d52ac69.system.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-791e13e7.entry.js → p-8dae0f0b.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-6e50f6f5.entry.js → p-8df3c6a0.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-5182e492.entry.js → p-9dc671f4.entry.js} +1 -1
  153. package/dist/zonos-elements/{p-2d854a75.entry.js → p-a3020bc9.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-a18adf27.js → p-a75b8ad7.js} +1 -1
  155. package/dist/zonos-elements/{p-bd938f80.js → p-a8bb461c.js} +1 -1
  156. package/dist/zonos-elements/{p-2b2b1c8c.system.entry.js → p-b21cf539.system.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-1ebb59a3.js → p-b5223840.js} +1 -1
  158. package/dist/zonos-elements/{p-10da499b.system.entry.js → p-bf4d2299.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-425f747b.entry.js → p-c09540bc.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-1661f938.entry.js → p-c308c5bc.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-9460919d.entry.js → p-cdf99051.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-788c6839.entry.js → p-d12fa775.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-055c8d6c.system.entry.js → p-d2ef0416.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-afca19b0.system.entry.js → p-d4f9e464.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-3600280d.system.js → p-d7a9be55.system.js} +1 -1
  166. package/dist/zonos-elements/{p-5262f6e8.entry.js → p-da5a35a6.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-8585c761.system.entry.js → p-df240101.system.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-14d35979.system.entry.js → p-df578aa9.system.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-9cff66a7.entry.js → p-e684e68f.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-a0f6910c.entry.js → p-f2a74e43.entry.js} +1 -1
  171. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  172. package/package.json +1 -1
  173. package/dist/zonos-elements/p-50b32476.system.entry.js +0 -1
  174. package/dist/zonos-elements/p-733f118d.entry.js +0 -1
  175. package/dist/zonos-elements/p-868a8667.js +0 -1
  176. package/dist/zonos-elements/p-c85e988d.system.js +0 -1
  177. package/dist/zonos-elements/p-ed03b7fd.js +0 -1
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const localization = require('./localization-5994d4de.js');
6
+ const localization = require('./localization-a7fac4b4.js');
7
7
  const zonosStore = require('./zonosStore-1c517e55.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
10
- const hasInclusivePrice = require('./hasInclusivePrice-58a9f15d.js');
10
+ const hasInclusivePrice = require('./hasInclusivePrice-c781c336.js');
11
11
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
12
12
  const TaxId = require('./TaxId-12acedde.js');
13
13
  require('./handleFetch-954f30e1.js');
@@ -143,7 +143,7 @@ const ZonosHelloDialog = class {
143
143
  };
144
144
  this.getDutyMessage = () => {
145
145
  // Domestic orders stay within the merchant's origin country, so no
146
- // duty is ever assessed — surface that instead of a de minimis threshold.
146
+ // duty is ever assessed — skip the de minimis message.
147
147
  if (this.isDomesticCountry()) {
148
148
  return null;
149
149
  }
@@ -167,7 +167,7 @@ const ZonosHelloDialog = class {
167
167
  this.getTaxMessage = () => {
168
168
  const { countryLandedCost } = localization.localizationStore;
169
169
  // Domestic orders stay within the merchant's origin country, so no
170
- // duty is ever assessed — surface that instead of a de minimis threshold.
170
+ // import tax is ever assessed — skip the de minimis message.
171
171
  if (this.isDomesticCountry()) {
172
172
  return null;
173
173
  }
@@ -383,25 +383,25 @@ const ZonosHelloDialog = class {
383
383
  // If deminimis is undefined or null, assume it's $0
384
384
  const taxDeMinimisMessage = this.getTaxMessage();
385
385
  const inclusivePriceMessage = this.getInclusivePriceMessage();
386
- return (index.h(index.Host, { key: '1278dbea844ec9e53b8224ede278281614be2fc6', class: "zonos--elements" }, index.h("div", { key: '5728be8b327198f0c09cf5865df43ae8bbe60beb', class: classes.classes([
386
+ return (index.h(index.Host, { key: '910b2b5600107a097fa4cdc77ec487e03fe6a8d2', class: "zonos--elements" }, index.h("div", { key: 'edf1d9b554807db1c973a1ccdb6e20a647c24204', class: classes.classes([
387
387
  'zonos--hello-dialog',
388
388
  animateLeft && 'zonos--hello-dialog-animate-from-left',
389
389
  animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
390
390
  !!this.mobileLocationOverride &&
391
391
  'zonos--hello-dialog-mobile-override',
392
392
  this.isOpen && 'zonos--hello-dialog-open',
393
- ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: 'cbaa0d35c446529f07bcca4d7e12980e61d9bd7b' }, index.h("div", { key: '7da2f46a06fb320f07300232e2c910ba572ee5ad', class: "zonos--hello-dialog-content" }, index.h("zonos-button", { key: 'ebe6f3cc03afdb1ffa5e8fb13c311dcd2249c002', class: "zonos--close-button", icon: index.h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), index.h("zonos-v-stack", { key: 'ccfe32e9dda067e0c95cd28a3e3ee283f2efbdff', spacing: 24 }, index.h("zonos-country-flag", { key: 'ead0ffe10deb11ef18ef39def2710faf43b286a7', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), index.h("zonos-v-stack", { key: '4927c2cb517003ccc55d57c0c7ab5cb55db5b369', class: "zonos--hello-dialog-header", spacing: 4 }, index.h("zonos-text", { key: '732277a98d48d4041eef395db5d06a5c4214fd4d', type: "boldSubheader" }, welcomeMessage), index.h("zonos-text", { key: '88a0fec8b49e5a998688e5be8eb444cde1c04295', innerHTML: defaultMessage, textColor: "gray-800" })), index.h("zonos-v-stack", { key: '9e004f4aedff3236736efc3287f4f94759f426a3', spacing: 8 }, this.restrictedItems.map(item => {
393
+ ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: 'f5316102d12d07e1a3c701ad641995413ee445b2' }, index.h("div", { key: 'c11cc7e8d11f733c82435a531d7d8595b0237eae', class: "zonos--hello-dialog-content" }, index.h("zonos-button", { key: 'a2aa2802331e9ed5c40d877fcb7ffb0cebd318c5', class: "zonos--close-button", icon: index.h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), index.h("zonos-v-stack", { key: 'f6df6e6562b8ddebb0e910d669a6a263114f6407', spacing: 24 }, index.h("zonos-country-flag", { key: '71c320b3364deee7c545284a2fc639cef3a3ba27', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), index.h("zonos-v-stack", { key: '9603247163d334db33fe00428190fafdd6ef6c42', class: "zonos--hello-dialog-header", spacing: 4 }, index.h("zonos-text", { key: 'aad7fd909092a9fad15ce88a3f43ad5115bca1f9', type: "boldSubheader" }, welcomeMessage), index.h("zonos-text", { key: 'c3c9c5d5f9e1000b2b6c6aebc73f18c6653f9de2', innerHTML: defaultMessage, textColor: "gray-800" })), index.h("zonos-v-stack", { key: 'c34b1b9debb507ce6f230bd13b493a14af12e880', spacing: 8 }, this.restrictedItems.map(item => {
394
394
  var _a;
395
395
  return item && (index.h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (index.h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
396
396
  }), (dutyDeMinimisMessage ||
397
397
  taxDeMinimisMessage ||
398
398
  inclusivePriceMessage ||
399
- !!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (index.h("zonos-card", { key: 'bb2f4d2442f1ef0926dcc3740d3b66e4ef0a3c53', spacing: "12px" }, index.h("zonos-v-stack", { key: 'a2459ed448da424b89298c24ef7df3629a7fca81', spacing: 12 }, this.renderHelloMessage({
399
+ !!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (index.h("zonos-card", { key: '5dc5af9af7263333433b8a0382a30ccf9f28056d', spacing: "12px" }, index.h("zonos-v-stack", { key: '725669eaca664abc90f5ec8181c3b81c05cc3b52', spacing: 12 }, this.renderHelloMessage({
400
400
  dutyDeMinimisMessage,
401
401
  inclusivePriceMessage,
402
402
  taxDeMinimisMessage,
403
403
  }), additionalInformation === null || additionalInformation === void 0 ? void 0 :
404
- additionalInformation.map(info => (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), index.h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), index.h("zonos-hello-dialog-footer", { key: '1480a6212aa6a620549962b2b58349592c2474c0', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (index.h("div", { key: 'af985242d03159913dc3e3dc832fdd6bbb48d905' }, index.h("zonos-country-select", { key: 'e98898e3cba56bc3299832345c9e47608acd6176', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (index.h("div", { key: '3fc35b6383376e25c8d810d1631b7ccbe5541843' }, index.h("zonos-language-select", { key: 'ed782d71214f8668f14c468171231428b55e712a', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
404
+ additionalInformation.map(info => (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), index.h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), index.h("zonos-hello-dialog-footer", { key: '077adfd58b2d7d95d5f352a09783089a1e91c99f', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (index.h("div", { key: '8c2dd5d73a649eebf1517a9b359d3ecc93b12620' }, index.h("zonos-country-select", { key: 'e2f64c73efe1e931808fdfe6aa5f8545d6f39c93', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (index.h("div", { key: '0b9ba684ac67fa652a34e6fbad8e966970f391ce' }, index.h("zonos-language-select", { key: '2e03e02459b0f31bc69376bc154ed8bb2d96ef56', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
405
405
  }
406
406
  static get assetsDirs() { return ["assets"]; }
407
407
  static get watchers() { return {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
6
  const debounce = require('./debounce-3e17b4e9.js');
7
- const localization = require('./localization-5994d4de.js');
7
+ const localization = require('./localization-a7fac4b4.js');
8
8
  const zonosStore = require('./zonosStore-1c517e55.js');
9
9
  const classes = require('./classes-b7918f56.js');
10
10
  const handleFetch = require('./handleFetch-954f30e1.js');
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-c618fd5b.js');
7
- const localization = require('./localization-5994d4de.js');
8
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
6
+ const cart = require('./cart-d08c87e2.js');
7
+ const localization = require('./localization-a7fac4b4.js');
8
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-a374741a.js');
9
9
  const classes = require('./classes-b7918f56.js');
10
- const invoice = require('./invoice-c9cb6683.js');
10
+ const invoice = require('./invoice-e64f97c6.js');
11
11
  const renderFallback = require('./renderFallback-bc20ee20.js');
12
12
  require('./zonosStore-1c517e55.js');
13
13
  require('./VarianceTest-bec00ea8.js');
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-c618fd5b.js');
7
- const paypal = require('./paypal-091e089e.js');
8
- const localization = require('./localization-5994d4de.js');
6
+ const cart = require('./cart-d08c87e2.js');
7
+ const paypal = require('./paypal-73a542cb.js');
8
+ const localization = require('./localization-a7fac4b4.js');
9
9
  const zonosStore = require('./zonosStore-1c517e55.js');
10
10
  const handleFetch = require('./handleFetch-954f30e1.js');
11
11
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
@@ -15,9 +15,9 @@ const submitGtag = require('./submitGtag-9ac5a42e.js');
15
15
  const isInvoiceMobileTablet = require('./isInvoiceMobileTablet-dde41e4e.js');
16
16
  const classes = require('./classes-b7918f56.js');
17
17
  const ILanguage = require('./ILanguage-98b04442.js');
18
- const invoice = require('./invoice-c9cb6683.js');
19
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
20
- const placeTestOrder = require('./placeTestOrder-b07f8edb.js');
18
+ const invoice = require('./invoice-e64f97c6.js');
19
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-a374741a.js');
20
+ const placeTestOrder = require('./placeTestOrder-aefd31e8.js');
21
21
  const renderFallback = require('./renderFallback-bc20ee20.js');
22
22
  require('./isDarkColor-bfe6d1eb.js');
23
23
  require('./isContrastColor-6a17f408.js');
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-c618fd5b.js');
7
- const invoice = require('./invoice-c9cb6683.js');
8
- const paypal = require('./paypal-091e089e.js');
9
- const localization = require('./localization-5994d4de.js');
6
+ const cart = require('./cart-d08c87e2.js');
7
+ const invoice = require('./invoice-e64f97c6.js');
8
+ const paypal = require('./paypal-73a542cb.js');
9
+ const localization = require('./localization-a7fac4b4.js');
10
10
  const zonosStore = require('./zonosStore-1c517e55.js');
11
11
  const buildCartItemsByTempCart = require('./buildCartItemsByTempCart-edddbf4b.js');
12
12
  const handleFetch = require('./handleFetch-954f30e1.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const localization = require('./localization-5994d4de.js');
6
+ const localization = require('./localization-a7fac4b4.js');
7
7
  const zonosStore = require('./zonosStore-1c517e55.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-954f30e1.js');
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-c618fd5b.js');
7
- const localization = require('./localization-5994d4de.js');
6
+ const cart = require('./cart-d08c87e2.js');
7
+ const localization = require('./localization-a7fac4b4.js');
8
8
  const zonosStore = require('./zonosStore-1c517e55.js');
9
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
9
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-a374741a.js');
10
10
  const getBorderRadius = require('./getBorderRadius-db55a464.js');
11
11
  require('./VarianceTest-bec00ea8.js');
12
12
  require('./handleFetch-954f30e1.js');
@@ -13,8 +13,11 @@ import { selectVarianceTest } from "../../utils/api/selectVarianceTest";
13
13
  import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
14
14
  import { updateCheckoutSessionAttributes } from "../../utils/api/updateCheckoutSessionAttributes";
15
15
  import { buildCartUrl } from "../../utils/buildCartUrl";
16
+ import { BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG } from "../../utils/checkout/buildBigcommerceLoginUrl";
16
17
  import { buildBigcommerceRedirectUrl } from "../../utils/checkout/buildBigcommerceRedirectUrl";
17
18
  import { checkBigCommerceBypassCustomerGroup, initBigCommerceBypassCheck, } from "../../utils/checkout/checkBigCommerceBypassCustomerGroup";
19
+ import { checkBigCommerceForceLogin, initBigCommerceForceLoginCheck, } from "../../utils/checkout/checkBigCommerceForceLogin";
20
+ import { fixBigCommerceLoginCreateAccountLink } from "../../utils/checkout/fixBigCommerceLoginCreateAccountLink";
18
21
  import { getAbandonedCartRenewTokenValue } from "../../utils/checkout/getAbandonedCartRenewTokenValue";
19
22
  import { getIsStagingMode } from "../../utils/checkout/getIsStagingMode";
20
23
  import { getIsTestMode } from "../../utils/checkout/getIsTestMode";
@@ -790,6 +793,15 @@ export class ZonosCheckout {
790
793
  window.location.href = buildBigcommerceRedirectUrl('/checkout');
791
794
  return;
792
795
  }
796
+ // Merchants who disable BC guest checkout need the shopper
797
+ // signed in before we open the Zonos international checkout.
798
+ // Redirecting here keeps the dialog from flashing before the
799
+ // login bounce.
800
+ const forceLogin = await checkBigCommerceForceLogin();
801
+ if (forceLogin.shouldForceLogin && forceLogin.redirectUrl) {
802
+ window.location.href = forceLogin.redirectUrl;
803
+ return;
804
+ }
793
805
  }
794
806
  // start loading
795
807
  stripeStore.isFetchingSession = true;
@@ -1042,6 +1054,19 @@ export class ZonosCheckout {
1042
1054
  // Start fetching BigCommerce customer group on page load so the bypass
1043
1055
  // result is ready by the time checkout opens or the BC watcher fires
1044
1056
  initBigCommerceBypassCheck();
1057
+ // Warm the BigCommerce `/checkouts/settings` fetch (merchant's
1058
+ // `guest_checkout_type`) so force-login gating resolves instantly when
1059
+ // the shopper clicks checkout — otherwise the first checkout open
1060
+ // would block on a proxy round trip.
1061
+ initBigCommerceForceLoginCheck();
1062
+ // On BC's `/login.php`, rewrite the "Create account" button href so
1063
+ // the post-signup round trip preserves the `from=cart.php?...` flag
1064
+ // that carries the shopper back into Zonos international checkout.
1065
+ fixBigCommerceLoginCreateAccountLink();
1066
+ // If BC redirected the shopper back here after login with the Zonos
1067
+ // resume flag, auto-open the international checkout. Strip the flag
1068
+ // from the URL so a refresh doesn't keep re-triggering the dialog.
1069
+ this.handleBigcommerceInternationalResumeFlag();
1045
1070
  // check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
1046
1071
  watchImmediateBigcommerceDomesticCheckoutRedirect({
1047
1072
  domesticRedirectedBtnSelector: domesticRedirectedBtnSelector,
@@ -1123,6 +1148,53 @@ export class ZonosCheckout {
1123
1148
  clearInterval(interval);
1124
1149
  }, 10000);
1125
1150
  }
1151
+ /**
1152
+ * After BigCommerce's `/login.php` round trip, the shopper lands back on
1153
+ * `cart.php?isInternationalCheckout=true`. Detect the flag, strip it from
1154
+ * the URL (so refreshing doesn't re-open the dialog), then fire the
1155
+ * international-checkout trigger once three preconditions are all met:
1156
+ * 1. Hello localization finished loading (`localizationLoaded`).
1157
+ * 2. A country code is selected — otherwise `buildCartDetail` runs
1158
+ * without a `countryCode` / `currencyCode` and never builds a cart.
1159
+ * 3. The hidden trigger button has mounted.
1160
+ *
1161
+ * Without the first two gates we race Hello's own init and the click
1162
+ * fires against a half-initialized store, which is what happens when
1163
+ * the shopper refreshes back into cart.php straight from the login
1164
+ * round trip.
1165
+ */
1166
+ handleBigcommerceInternationalResumeFlag() {
1167
+ if (!window.Zonos.isBigCommerce) {
1168
+ return;
1169
+ }
1170
+ const url = new URL(window.location.href);
1171
+ if (url.searchParams.get(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG) !== 'true') {
1172
+ return;
1173
+ }
1174
+ url.searchParams.delete(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG);
1175
+ window.history.replaceState({}, '', url.toString());
1176
+ const start = Date.now();
1177
+ const interval = setInterval(() => {
1178
+ if (!localizationStore.localizationLoaded ||
1179
+ !localizationStore.selectedCountryCode) {
1180
+ if (Date.now() - start > 15000) {
1181
+ clearInterval(interval);
1182
+ log('BigCommerce international checkout resume flag: localization did not initialize within 15s', 'info');
1183
+ }
1184
+ return;
1185
+ }
1186
+ const btn = document.querySelector(`#${checkoutHiddenInternationalBtnSelector}`);
1187
+ if (btn) {
1188
+ clearInterval(interval);
1189
+ btn.dispatchEvent(createCustomEvent('click'));
1190
+ return;
1191
+ }
1192
+ if (Date.now() - start > 15000) {
1193
+ clearInterval(interval);
1194
+ log('BigCommerce international checkout resume flag: trigger button did not mount within 15s', 'info');
1195
+ }
1196
+ }, 200);
1197
+ }
1126
1198
  /**
1127
1199
  * For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
1128
1200
  */
@@ -105,7 +105,7 @@ export class ZonosHelloDialog {
105
105
  };
106
106
  this.getDutyMessage = () => {
107
107
  // Domestic orders stay within the merchant's origin country, so no
108
- // duty is ever assessed — surface that instead of a de minimis threshold.
108
+ // duty is ever assessed — skip the de minimis message.
109
109
  if (this.isDomesticCountry()) {
110
110
  return null;
111
111
  }
@@ -129,7 +129,7 @@ export class ZonosHelloDialog {
129
129
  this.getTaxMessage = () => {
130
130
  const { countryLandedCost } = localizationStore;
131
131
  // Domestic orders stay within the merchant's origin country, so no
132
- // duty is ever assessed — surface that instead of a de minimis threshold.
132
+ // import tax is ever assessed — skip the de minimis message.
133
133
  if (this.isDomesticCountry()) {
134
134
  return null;
135
135
  }
@@ -345,25 +345,25 @@ export class ZonosHelloDialog {
345
345
  // If deminimis is undefined or null, assume it's $0
346
346
  const taxDeMinimisMessage = this.getTaxMessage();
347
347
  const inclusivePriceMessage = this.getInclusivePriceMessage();
348
- return (h(Host, { key: '1278dbea844ec9e53b8224ede278281614be2fc6', class: "zonos--elements" }, h("div", { key: '5728be8b327198f0c09cf5865df43ae8bbe60beb', class: classes([
348
+ return (h(Host, { key: '910b2b5600107a097fa4cdc77ec487e03fe6a8d2', class: "zonos--elements" }, h("div", { key: 'edf1d9b554807db1c973a1ccdb6e20a647c24204', class: classes([
349
349
  'zonos--hello-dialog',
350
350
  animateLeft && 'zonos--hello-dialog-animate-from-left',
351
351
  animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
352
352
  !!this.mobileLocationOverride &&
353
353
  'zonos--hello-dialog-mobile-override',
354
354
  this.isOpen && 'zonos--hello-dialog-open',
355
- ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'cbaa0d35c446529f07bcca4d7e12980e61d9bd7b' }, h("div", { key: '7da2f46a06fb320f07300232e2c910ba572ee5ad', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: 'ebe6f3cc03afdb1ffa5e8fb13c311dcd2249c002', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: 'ccfe32e9dda067e0c95cd28a3e3ee283f2efbdff', spacing: 24 }, h("zonos-country-flag", { key: 'ead0ffe10deb11ef18ef39def2710faf43b286a7', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: '4927c2cb517003ccc55d57c0c7ab5cb55db5b369', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: '732277a98d48d4041eef395db5d06a5c4214fd4d', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: '88a0fec8b49e5a998688e5be8eb444cde1c04295', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: '9e004f4aedff3236736efc3287f4f94759f426a3', spacing: 8 }, this.restrictedItems.map(item => {
355
+ ]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'f5316102d12d07e1a3c701ad641995413ee445b2' }, h("div", { key: 'c11cc7e8d11f733c82435a531d7d8595b0237eae', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: 'a2aa2802331e9ed5c40d877fcb7ffb0cebd318c5', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: 'f6df6e6562b8ddebb0e910d669a6a263114f6407', spacing: 24 }, h("zonos-country-flag", { key: '71c320b3364deee7c545284a2fc639cef3a3ba27', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: '9603247163d334db33fe00428190fafdd6ef6c42', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: 'aad7fd909092a9fad15ce88a3f43ad5115bca1f9', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: 'c3c9c5d5f9e1000b2b6c6aebc73f18c6653f9de2', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: 'c34b1b9debb507ce6f230bd13b493a14af12e880', spacing: 8 }, this.restrictedItems.map(item => {
356
356
  var _a;
357
357
  return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
358
358
  }), (dutyDeMinimisMessage ||
359
359
  taxDeMinimisMessage ||
360
360
  inclusivePriceMessage ||
361
- !!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (h("zonos-card", { key: 'bb2f4d2442f1ef0926dcc3740d3b66e4ef0a3c53', spacing: "12px" }, h("zonos-v-stack", { key: 'a2459ed448da424b89298c24ef7df3629a7fca81', spacing: 12 }, this.renderHelloMessage({
361
+ !!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (h("zonos-card", { key: '5dc5af9af7263333433b8a0382a30ccf9f28056d', spacing: "12px" }, h("zonos-v-stack", { key: '725669eaca664abc90f5ec8181c3b81c05cc3b52', spacing: 12 }, this.renderHelloMessage({
362
362
  dutyDeMinimisMessage,
363
363
  inclusivePriceMessage,
364
364
  taxDeMinimisMessage,
365
365
  }), additionalInformation === null || additionalInformation === void 0 ? void 0 :
366
- additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '1480a6212aa6a620549962b2b58349592c2474c0', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: 'af985242d03159913dc3e3dc832fdd6bbb48d905' }, h("zonos-country-select", { key: 'e98898e3cba56bc3299832345c9e47608acd6176', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '3fc35b6383376e25c8d810d1631b7ccbe5541843' }, h("zonos-language-select", { key: 'ed782d71214f8668f14c468171231428b55e712a', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
366
+ additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '077adfd58b2d7d95d5f352a09783089a1e91c99f', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '8c2dd5d73a649eebf1517a9b359d3ecc93b12620' }, h("zonos-country-select", { key: 'e2f64c73efe1e931808fdfe6aa5f8545d6f39c93', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '0b9ba684ac67fa652a34e6fbad8e966970f391ce' }, h("zonos-language-select", { key: '2e03e02459b0f31bc69376bc154ed8bb2d96ef56', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
367
367
  }
368
368
  static get is() { return "zonos-hello-dialog"; }
369
369
  static get encapsulation() { return "shadow"; }
@@ -213,6 +213,9 @@ const localizationStoreUpdateSelectedCountryCode = ({ isInitializing, newSelecte
213
213
  localizationStore.countryLandedCost = null;
214
214
  localizationStore.inclusivePricingConfigurations = [];
215
215
  currencyDisplay();
216
+ if (!isInitializing) {
217
+ void getCustomMessages();
218
+ }
216
219
  // Clear session so the next visit falls back to geolocation, but keep
217
220
  // the current shopper's explicit selection visible in the URL (so a
218
221
  // same-tab reload still honors it) and on the hello element.
@@ -50,3 +50,9 @@ export const fetchBigCommerceCheckout = async (checkoutId) => {
50
50
  return null;
51
51
  }
52
52
  };
53
+ /**
54
+ * Whether the BigCommerce shopper is already logged in. We key off the
55
+ * customer's numeric `id` since the storefront API populates it only for
56
+ * authenticated sessions (guest checkouts have an empty `customer` object).
57
+ */
58
+ export const isBigCommerceCustomerLoggedIn = (checkout) => { var _a; return !!((_a = checkout === null || checkout === void 0 ? void 0 : checkout.customer) === null || _a === void 0 ? void 0 : _a.id); };
@@ -0,0 +1,65 @@
1
+ import { getIsTestMode } from "./getIsTestMode";
2
+ /**
3
+ * The query flag that BigCommerce carries back to `cart.php` after the
4
+ * shopper logs in. When present, Zonos-elements knows to resume the
5
+ * international checkout flow instead of letting BC's native cart UX
6
+ * take over.
7
+ */
8
+ export const BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG = 'isInternationalCheckout';
9
+ /**
10
+ * Build the `from` query value handed to BigCommerce's `/login.php` so that
11
+ * after a successful login the shopper lands back on `cart.php` with the
12
+ * `isInternationalCheckout=true` flag set (plus any `zonosTestMode` /
13
+ * `zonosQaUrl` / `zonosQaUrlApi` that were on the current URL, so the
14
+ * preview build / API host / test credentials carry through the round trip).
15
+ */
16
+ const buildFromCartPath = () => {
17
+ const params = new URLSearchParams();
18
+ params.set(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG, 'true');
19
+ const currentParams = new URLSearchParams(window.location.search);
20
+ const zonosQaUrl = currentParams.get('zonosQaUrl');
21
+ if (zonosQaUrl) {
22
+ params.set('zonosQaUrl', zonosQaUrl);
23
+ }
24
+ const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
25
+ if (zonosQaUrlApi) {
26
+ params.set('zonosQaUrlApi', zonosQaUrlApi);
27
+ }
28
+ if (getIsTestMode()) {
29
+ params.set('zonosTestMode', '1');
30
+ }
31
+ return `cart.php?${params.toString()}`;
32
+ };
33
+ /**
34
+ * Build an absolute URL to BigCommerce's `/login.php` with the
35
+ * `from=cart.php?isInternationalCheckout=true` round-trip encoded so the
36
+ * shopper resumes Zonos international checkout after authenticating.
37
+ *
38
+ * Preserves `zonosTestMode` / `zonosQaUrl` / `zonosQaUrlApi` from the current
39
+ * URL across the redirect — the login round trip leaves BC's frontend, so
40
+ * without this the returning `cart.php` would drop back to the production
41
+ * build / API host.
42
+ */
43
+ export const buildBigcommerceLoginUrl = ({ action } = {}) => {
44
+ const url = new URL('/login.php', window.location.origin);
45
+ if (action) {
46
+ url.searchParams.set('action', action);
47
+ }
48
+ const currentParams = new URLSearchParams(window.location.search);
49
+ // set zonosQaUrl from the current URL
50
+ const zonosQaUrl = currentParams.get('zonosQaUrl');
51
+ if (zonosQaUrl) {
52
+ url.searchParams.set('zonosQaUrl', zonosQaUrl);
53
+ }
54
+ // set zonosQaUrlApi from the current URL
55
+ const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
56
+ if (zonosQaUrlApi) {
57
+ url.searchParams.set('zonosQaUrlApi', zonosQaUrlApi);
58
+ }
59
+ // set zonosTestMode from the current URL
60
+ if (getIsTestMode()) {
61
+ url.searchParams.set('zonosTestMode', '1');
62
+ }
63
+ url.searchParams.set('from', buildFromCartPath());
64
+ return url.toString();
65
+ };
@@ -9,7 +9,7 @@ const DEFAULT_RESULT = {
9
9
  * Performs the actual fetch logic to determine if the customer
10
10
  * belongs to a bypass group.
11
11
  */
12
- const fetchBypassOutcome = async () => {
12
+ const fetchBypassOutcome = async (preFetched) => {
13
13
  var _a, _b, _c, _d;
14
14
  // Only relevant for BigCommerce stores — permanent no-op on other platforms
15
15
  if (!window.Zonos.isBigCommerce) {
@@ -26,8 +26,11 @@ const fetchBypassOutcome = async () => {
26
26
  // Mark as inconclusive so a later caller retries after config loads.
27
27
  return { conclusive: false, result: DEFAULT_RESULT };
28
28
  }
29
- // Fetch customer group from BigCommerce Storefront API
30
- const checkoutId = await fetchCheckoutId();
29
+ // Fetch customer group from BigCommerce Storefront API — or reuse
30
+ // caller-supplied data when available.
31
+ const checkoutId = preFetched
32
+ ? preFetched.checkoutId
33
+ : await fetchCheckoutId();
31
34
  if (!checkoutId) {
32
35
  // No active cart yet — inconclusive. Common on fresh sessions where
33
36
  // `initBigCommerceBypassCheck` runs before the user has added anything
@@ -35,7 +38,9 @@ const fetchBypassOutcome = async () => {
35
38
  log('BigCommerce bypass check: no active cart yet, will retry on next call', 'info');
36
39
  return { conclusive: false, result: DEFAULT_RESULT };
37
40
  }
38
- const checkout = await fetchBigCommerceCheckout(checkoutId);
41
+ const checkout = preFetched
42
+ ? preFetched.checkout
43
+ : await fetchBigCommerceCheckout(checkoutId);
39
44
  if (!checkout) {
40
45
  // API call failed (network error, non-200, etc.) — inconclusive.
41
46
  // Caching this would permanently disable bypass for the session if
@@ -69,8 +74,8 @@ const fetchBypassOutcome = async () => {
69
74
  * cart or after settings finish loading).
70
75
  */
71
76
  let bypassCheckPromise = null;
72
- const startBypassCheck = () => {
73
- const outcomePromise = fetchBypassOutcome();
77
+ const startBypassCheck = (preFetched) => {
78
+ const outcomePromise = fetchBypassOutcome(preFetched);
74
79
  const resultPromise = outcomePromise.then(({ conclusive, result }) => {
75
80
  if (!conclusive && bypassCheckPromise === resultPromise) {
76
81
  // Invalidate cache so the next caller performs a fresh fetch.
@@ -116,7 +121,7 @@ export const initBigCommerceBypassCheck = () => {
116
121
  */
117
122
  export const checkBigCommerceBypassCustomerGroup = async (options = {}) => {
118
123
  if (options.forceRefresh || !bypassCheckPromise) {
119
- return startBypassCheck();
124
+ return startBypassCheck(options.preFetched);
120
125
  }
121
126
  return bypassCheckPromise;
122
127
  };
@@ -0,0 +1,116 @@
1
+ import { fetchBigCommerceCheckout, fetchCheckoutId, isBigCommerceCustomerLoggedIn, } from "./bigcommerceStorefrontApi";
2
+ import { buildBigcommerceLoginUrl } from "./buildBigcommerceLoginUrl";
3
+ import { fetchBigCommerceCheckoutSettings } from "./fetchBigCommerceCheckoutSettings";
4
+ import { log } from "../logging/log";
5
+ const SKIP = {
6
+ redirectUrl: null,
7
+ shouldForceLogin: false,
8
+ };
9
+ /**
10
+ * Session cache for the merchant-level "does BC require login?" answer.
11
+ * Hitting `/checkouts/settings` on every checkout open would add a visible
12
+ * round trip to the hot path, so we resolve it once and reuse — the setting
13
+ * is configured at the store level and very rarely changes.
14
+ *
15
+ * `null` means we haven't kicked off the fetch yet; the promise holds the
16
+ * eventual boolean so multiple concurrent callers deduplicate.
17
+ */
18
+ let storeRequiresLoginPromise = null;
19
+ const resolveStoreRequiresLogin = () => {
20
+ if (!storeRequiresLoginPromise) {
21
+ const pending = fetchBigCommerceCheckoutSettings()
22
+ .then(({ guestCheckoutType }) => {
23
+ if (!guestCheckoutType) {
24
+ // `null` here means either the proxy call failed (transient) or the
25
+ // storeHash wasn't known yet. Fail open for this call, but clear
26
+ // the cached promise so the next caller retries instead of
27
+ // permanently disabling force-login for the rest of the session.
28
+ if (storeRequiresLoginPromise === pending) {
29
+ storeRequiresLoginPromise = null;
30
+ }
31
+ return false;
32
+ }
33
+ return guestCheckoutType === 'no_guest_checkout';
34
+ })
35
+ .catch(() => {
36
+ // Defense-in-depth: `fetchBigCommerceCheckoutSettings` is expected to
37
+ // swallow its own errors, but if anything above does reject we fail
38
+ // open and clear the cached promise so the next caller can retry.
39
+ if (storeRequiresLoginPromise === pending) {
40
+ storeRequiresLoginPromise = null;
41
+ }
42
+ return false;
43
+ });
44
+ storeRequiresLoginPromise = pending;
45
+ }
46
+ return storeRequiresLoginPromise;
47
+ };
48
+ /**
49
+ * Kick off the `/checkouts/settings` fetch in the background on page load
50
+ * so the result is warm by the time the shopper opens checkout. Safe to
51
+ * call more than once — re-invocations reuse the in-flight/resolved
52
+ * promise.
53
+ */
54
+ export const initBigCommerceForceLoginCheck = () => {
55
+ if (!window.Zonos.isBigCommerce) {
56
+ return;
57
+ }
58
+ void resolveStoreRequiresLogin();
59
+ };
60
+ /**
61
+ * Decide whether the current BigCommerce shopper must sign in before the
62
+ * Zonos international checkout is allowed to open.
63
+ *
64
+ * Required conditions (all must hold):
65
+ * 1. Running on a BigCommerce storefront.
66
+ * 2. BC merchant has `guest_checkout_type === 'no_guest_checkout'` in their
67
+ * live `/v3/checkouts/settings` response.
68
+ * 3. Shopper has an active cart.
69
+ * 4. Shopper is not already logged in to BigCommerce.
70
+ *
71
+ * Returning a `redirectUrl` is an instruction, not an action: callers drive
72
+ * the navigation themselves so they can short-circuit any UI state (loading
73
+ * overlays, dialog open flags) before `window.location.href` flips.
74
+ */
75
+ export const checkBigCommerceForceLogin = async ({ preFetched, } = {}) => {
76
+ if (!window.Zonos.isBigCommerce) {
77
+ return SKIP;
78
+ }
79
+ const requiresLogin = await resolveStoreRequiresLogin();
80
+ if (!requiresLogin) {
81
+ return SKIP;
82
+ }
83
+ const checkoutId = preFetched
84
+ ? preFetched.checkoutId
85
+ : await fetchCheckoutId();
86
+ if (!checkoutId) {
87
+ // No active cart — nothing to protect. Force-login only matters once
88
+ // the shopper has a cart we're about to carry into Zonos checkout.
89
+ return SKIP;
90
+ }
91
+ const checkout = preFetched
92
+ ? preFetched.checkout
93
+ : await fetchBigCommerceCheckout(checkoutId);
94
+ if (!checkout) {
95
+ // Storefront API failure — fail open so a transient outage doesn't
96
+ // block the shopper. The merchant's BC checkout will still enforce
97
+ // login server-side as a last line of defense.
98
+ log('BigCommerce force-login check: failed to fetch checkout data, allowing flow to continue', 'info');
99
+ return SKIP;
100
+ }
101
+ if (isBigCommerceCustomerLoggedIn(checkout)) {
102
+ return SKIP;
103
+ }
104
+ log('BigCommerce force-login check: guest shopper on no-guest-checkout store, redirecting to /login.php', 'info');
105
+ return {
106
+ redirectUrl: buildBigcommerceLoginUrl(),
107
+ shouldForceLogin: true,
108
+ };
109
+ };
110
+ /**
111
+ * Test-only — resets the module-level cache so each test case starts
112
+ * against a clean state.
113
+ */
114
+ export const _resetBigCommerceForceLoginCacheForTesting = () => {
115
+ storeRequiresLoginPromise = null;
116
+ };