@zonos/elements 1.3.276 → 1.3.278

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 (122) hide show
  1. package/dist/cjs/{cart-65e8da66.js → cart-e8bc11a3.js} +7 -2
  2. package/dist/cjs/{collect-37c177ab.js → collect-e6485168.js} +1 -1
  3. package/dist/cjs/index.cjs.js +32 -9
  4. package/dist/cjs/{invoice-96f5c802.js → invoice-dff7ec81.js} +1 -1
  5. package/dist/cjs/{paypal-1952f6ec.js → paypal-77bd640c.js} +1 -1
  6. package/dist/cjs/{placeTestOrder-30191a8f.js → placeTestOrder-7767d119.js} +1 -1
  7. package/dist/cjs/{renderCheckoutCurrency-fd35b4ef.js → renderCheckoutCurrency-66377cf5.js} +1 -1
  8. package/dist/cjs/zonos-address-display_8.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-address_4.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +4 -4
  13. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +5 -5
  16. package/dist/cjs/zonos-collect.cjs.entry.js +3 -3
  17. package/dist/cjs/zonos-controller.cjs.entry.js +16 -3
  18. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
  19. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +5 -5
  20. package/dist/cjs/zonos-invoice.cjs.entry.js +3 -3
  21. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +2 -2
  22. package/dist/collection/components/main/zonos-controller.js +15 -2
  23. package/dist/collection/components/store/checkout/stripe.js +7 -2
  24. package/dist/collection/scripts/_loadStripe.js +20 -2
  25. package/dist/collection/scripts/_zonosBase.js +5 -0
  26. package/dist/esm/{cart-402dcde5.js → cart-8b8dc79f.js} +7 -2
  27. package/dist/esm/{collect-b88fe4ca.js → collect-f4965586.js} +1 -1
  28. package/dist/esm/index.js +32 -9
  29. package/dist/esm/{invoice-5eb27944.js → invoice-b7a1fb14.js} +1 -1
  30. package/dist/esm/{paypal-2d4c9d01.js → paypal-da551105.js} +1 -1
  31. package/dist/esm/{placeTestOrder-2ba7c3f2.js → placeTestOrder-4309b170.js} +1 -1
  32. package/dist/esm/{renderCheckoutCurrency-ef71083e.js → renderCheckoutCurrency-0ed221ac.js} +1 -1
  33. package/dist/esm/zonos-address-display_8.entry.js +1 -1
  34. package/dist/esm/zonos-address_4.entry.js +1 -1
  35. package/dist/esm/zonos-airwallex-payment.entry.js +2 -2
  36. package/dist/esm/zonos-card_5.entry.js +2 -2
  37. package/dist/esm/zonos-cart-items_12.entry.js +4 -4
  38. package/dist/esm/zonos-checkout.entry.js +2 -2
  39. package/dist/esm/zonos-collect-cart-items_3.entry.js +1 -1
  40. package/dist/esm/zonos-collect-finish_6.entry.js +5 -5
  41. package/dist/esm/zonos-collect.entry.js +3 -3
  42. package/dist/esm/zonos-controller.entry.js +16 -3
  43. package/dist/esm/zonos-invoice-cart-items_2.entry.js +3 -3
  44. package/dist/esm/zonos-invoice-finish_5.entry.js +5 -5
  45. package/dist/esm/zonos-invoice.entry.js +3 -3
  46. package/dist/esm/zonos-policy-consent_2.entry.js +2 -2
  47. package/dist/esm-es5/cart-8b8dc79f.js +1 -0
  48. package/dist/esm-es5/{collect-b88fe4ca.js → collect-f4965586.js} +1 -1
  49. package/dist/esm-es5/index.js +1 -1
  50. package/dist/esm-es5/{invoice-5eb27944.js → invoice-b7a1fb14.js} +1 -1
  51. package/dist/esm-es5/{paypal-2d4c9d01.js → paypal-da551105.js} +1 -1
  52. package/dist/esm-es5/{placeTestOrder-2ba7c3f2.js → placeTestOrder-4309b170.js} +1 -1
  53. package/dist/esm-es5/{renderCheckoutCurrency-ef71083e.js → renderCheckoutCurrency-0ed221ac.js} +1 -1
  54. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  55. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  56. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  57. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  58. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  59. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  60. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  61. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  62. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  63. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  64. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  65. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  66. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  67. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  68. package/dist/scripts/index.d.ts +14 -0
  69. package/dist/scripts/index.js +1 -1
  70. package/dist/scripts/loadZonos.js +1 -1
  71. package/dist/scripts/zonos.js +1 -1
  72. package/dist/types/scripts/_zonosBase.d.ts +12 -0
  73. package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +2 -0
  74. package/dist/zonos-elements/index.esm.js +1 -1
  75. package/dist/zonos-elements/{p-f2d50796.system.js → p-02065a08.system.js} +1 -1
  76. package/dist/zonos-elements/{p-3feff726.entry.js → p-0402af0d.entry.js} +1 -1
  77. package/dist/zonos-elements/{p-864525b4.system.entry.js → p-12a08423.system.entry.js} +1 -1
  78. package/dist/zonos-elements/{p-18135660.entry.js → p-21d925d7.entry.js} +1 -1
  79. package/dist/zonos-elements/p-2654556b.js +1 -0
  80. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  81. package/dist/zonos-elements/{p-4a1c9fa1.entry.js → p-2aecc055.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-2ea73ca2.system.js → p-32278945.system.js} +1 -1
  83. package/dist/zonos-elements/{p-45535a81.js → p-32704baa.js} +1 -1
  84. package/dist/zonos-elements/{p-6ad0f720.system.js → p-3f380c8f.system.js} +2 -2
  85. package/dist/zonos-elements/{p-c750a2e0.system.entry.js → p-43815edd.system.entry.js} +1 -1
  86. package/dist/zonos-elements/p-45e1c33b.entry.js +1 -0
  87. package/dist/zonos-elements/{p-ac9b9f7d.entry.js → p-5827c868.entry.js} +1 -1
  88. package/dist/zonos-elements/{p-48627415.system.entry.js → p-5afea02c.system.entry.js} +1 -1
  89. package/dist/zonos-elements/{p-67dac4e5.system.entry.js → p-5bc43687.system.entry.js} +1 -1
  90. package/dist/zonos-elements/{p-a3bc7e97.js → p-5c76ef2a.js} +1 -1
  91. package/dist/zonos-elements/{p-2e0d813f.system.js → p-5e09c22d.system.js} +1 -1
  92. package/dist/zonos-elements/{p-58b56c69.entry.js → p-6b4ef7e0.entry.js} +1 -1
  93. package/dist/zonos-elements/{p-10715fee.system.entry.js → p-6fae9835.system.entry.js} +1 -1
  94. package/dist/zonos-elements/{p-f2768c92.system.js → p-7365e22c.system.js} +1 -1
  95. package/dist/zonos-elements/{p-82341c15.entry.js → p-73d3fa61.entry.js} +1 -1
  96. package/dist/zonos-elements/{p-b1c86a5b.js → p-74ebd766.js} +1 -1
  97. package/dist/zonos-elements/{p-3cfa4880.js → p-7522ec43.js} +1 -1
  98. package/dist/zonos-elements/{p-89befc63.system.entry.js → p-7614ea6f.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-4d29dcc8.entry.js → p-77fa437c.entry.js} +1 -1
  100. package/dist/zonos-elements/{p-a7050d1e.system.entry.js → p-7e8aba66.system.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-1e4dcd29.entry.js → p-8b42245d.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-b7e4f1f5.entry.js → p-8bd37d3b.entry.js} +1 -1
  103. package/dist/zonos-elements/{p-77ac8bfe.entry.js → p-8d87e748.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-144a380d.entry.js → p-9beb2624.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-a02ff788.js → p-a8c79850.js} +1 -1
  106. package/dist/zonos-elements/{p-ac1b60c8.system.entry.js → p-abf61f6f.system.entry.js} +1 -1
  107. package/dist/zonos-elements/{p-4a6f9c5e.system.entry.js → p-ac59f5c1.system.entry.js} +1 -1
  108. package/dist/zonos-elements/{p-55195dab.entry.js → p-b36205f4.entry.js} +1 -1
  109. package/dist/zonos-elements/p-bf0148ae.system.js +1 -0
  110. package/dist/zonos-elements/{p-0b321037.system.entry.js → p-cd41b16b.system.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-628fe742.system.entry.js → p-d7cb9ef6.system.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-534057ad.system.entry.js → p-d93991c3.system.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-684e27da.system.js → p-e6165cc2.system.js} +1 -1
  114. package/dist/zonos-elements/{p-42ba4da5.system.entry.js → p-eb9369b9.system.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-5ce88ef3.system.entry.js → p-ed676ad1.system.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-521cbeea.entry.js → p-f44a3338.entry.js} +1 -1
  117. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  118. package/package.json +1 -1
  119. package/dist/esm-es5/cart-402dcde5.js +0 -1
  120. package/dist/zonos-elements/p-4b06044f.js +0 -1
  121. package/dist/zonos-elements/p-5e3b0ef4.entry.js +0 -1
  122. package/dist/zonos-elements/p-6f324051.system.js +0 -1
@@ -1385,9 +1385,14 @@ const stripeCalculateLandedCost = async () => {
1385
1385
  // Reset cart items to non-restricted state and restricted item list
1386
1386
  cartStoreResetCartItems();
1387
1387
  const { checkoutSessionWorkflow, errors, itemCreateWorkflow, landedCostCalculateWorkflow, partyCreateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
1388
- // update the error message with customized error message that rule is applying to and disabled shippment rating if there is any
1388
+ // Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
1389
+ // constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
1389
1390
  cartStore.customQuotingError =
1390
- ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => { var _a; return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM'; })) === null || _a === void 0 ? void 0 : _a.message) || null;
1391
+ ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => {
1392
+ var _a, _b;
1393
+ return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM' ||
1394
+ ((_b = error.extensions) === null || _b === void 0 ? void 0 : _b.source) === 'COUNTRY_CONSTRAINT';
1395
+ })) === null || _a === void 0 ? void 0 : _a.message) || null;
1391
1396
  cartStore.shippingData = sortServiceLevelOptionsByAmount((shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || []);
1392
1397
  // check and update cart items with restrictions
1393
1398
  cartStoreCheckItemRestrictions(itemCreateWorkflow);
@@ -4,7 +4,7 @@ const zonosStore = require('./zonosStore-fee716c9.js');
4
4
  const localization = require('./localization-90650d7d.js');
5
5
  const handleFetch = require('./handleFetch-954f30e1.js');
6
6
  const VarianceTest = require('./VarianceTest-bec00ea8.js');
7
- const cart = require('./cart-65e8da66.js');
7
+ const cart = require('./cart-e8bc11a3.js');
8
8
 
9
9
  // src/constant/common.ts
10
10
  function _array_like_to_array(arr, len) {
@@ -133,7 +133,7 @@ const getZonosQaUrl = () => {
133
133
  return null;
134
134
  }
135
135
  const qaUrl = extractZonosQaUrl(window.location.href);
136
- const cdnUrl = "https://v1.3.276.js.zonos.com";
136
+ const cdnUrl = "https://v1.3.278.js.zonos.com";
137
137
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
138
138
  if (!qaUrl &&
139
139
  (cdnUrl.includes('test.') ||
@@ -280,7 +280,20 @@ const initStripe = (maybeStripe, args, startTime) => {
280
280
 
281
281
  // Execute our own script injection after a tick to give users time to do their
282
282
  // own script injection.
283
- const stripePromise = Promise.resolve().then(() => zonosStripeLoadScript(null));
283
+ const hasCheckoutCartCallback = () => {
284
+ var _a, _b;
285
+ return typeof window !== 'undefined' &&
286
+ (typeof ((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.createCartId) === 'function' ||
287
+ typeof ((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.buildCartDetail) === 'function');
288
+ };
289
+ const stripePromise = Promise.resolve().then(() => {
290
+ // Skip eagerly loading Stripe when no checkout cart callback is configured
291
+ // (e.g. a Hello-only integration). Stripe is loaded on demand instead.
292
+ if (!hasCheckoutCartCallback()) {
293
+ return null;
294
+ }
295
+ return zonosStripeLoadScript(null);
296
+ });
284
297
  let loadCalled = false;
285
298
  stripePromise.catch((err) => {
286
299
  if (!loadCalled) {
@@ -289,9 +302,14 @@ stripePromise.catch((err) => {
289
302
  }
290
303
  });
291
304
  const zonosLoadStripe = async (...args) => {
305
+ var _a;
292
306
  loadCalled = true;
293
307
  const startTime = Date.now();
294
- return stripePromise.then(maybeStripe => initStripe(maybeStripe, args, startTime));
308
+ // Fall back to loading Stripe on demand if the eager preload was skipped
309
+ // (callbacks set after the microtask, or Collect/Invoice flows that don't
310
+ // use cart callbacks). `zonosStripeLoadScript` is idempotent.
311
+ const maybeStripe = (_a = (await stripePromise)) !== null && _a !== void 0 ? _a : (await zonosStripeLoadScript(null));
312
+ return initStripe(maybeStripe, args, startTime);
295
313
  };
296
314
 
297
315
  const TEMP_CART_ID_QUERY_PARAM = 'tempCartUUID';
@@ -381,10 +399,10 @@ const zonosLoadUrl = (() => {
381
399
  return null;
382
400
  })();
383
401
  const startLoadTime = Date.now();
384
- const ZONOS_URL = "https://v1.3.276.js.zonos.com";
385
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.276";
386
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.276";
387
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.276";
402
+ const ZONOS_URL = "https://v1.3.278.js.zonos.com";
403
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.278";
404
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.278";
405
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.278";
388
406
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
389
407
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
390
408
  class Zonos {
@@ -402,7 +420,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
402
420
  ? new URLSearchParams(window.location.search).get('iframeLogType')
403
421
  : null;
404
422
  Zonos.isBigCommerce = false;
405
- Zonos.releaseDate = "1782615830331";
423
+ Zonos.releaseDate = "1783025257357";
406
424
  Zonos.isLegacyCheckout = false;
407
425
  Zonos.googleAnalyticId = null;
408
426
  Zonos.googleAnalyticReady = false;
@@ -427,7 +445,7 @@ Zonos.isNpm = true;
427
445
  Zonos.zonosQaUrl = null;
428
446
  Zonos.zonosQaUrlApi = null;
429
447
  Zonos.trackEventLogs = [];
430
- Zonos.version = `v${"1.3.276"}`;
448
+ Zonos.version = `v${"1.3.278"}`;
431
449
  Zonos.modeAlerted = false;
432
450
  Zonos.cartData = null;
433
451
  Zonos.paypal = null;
@@ -440,6 +458,11 @@ Zonos.logIntervalId = null;
440
458
  Zonos.init = async (params) => {
441
459
  const { appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, } = params;
442
460
  _a.cartId = getCartIdFromQueryParam();
461
+ // Expose the checkout cart callbacks on the global so Stripe loading can be
462
+ // gated on whether at least one of them is configured.
463
+ _a.createCartId = checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.createCartId;
464
+ // eslint-disable-next-line deprecation/deprecation -- intentionally mirror the (deprecated) callback so Stripe loading can be gated on it
465
+ _a.buildCartDetail = checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.buildCartDetail;
443
466
  if (_a.doneInit) {
444
467
  // do nothing if zonos is already initialized
445
468
  return;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-fee716c9.js');
4
- const cart = require('./cart-65e8da66.js');
4
+ const cart = require('./cart-e8bc11a3.js');
5
5
  const localization = require('./localization-90650d7d.js');
6
6
  const handleFetch = require('./handleFetch-954f30e1.js');
7
7
  const VarianceTest = require('./VarianceTest-bec00ea8.js');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-fee716c9.js');
4
- const cart = require('./cart-65e8da66.js');
4
+ const cart = require('./cart-e8bc11a3.js');
5
5
  const localization = require('./localization-90650d7d.js');
6
6
  const handleFetch = require('./handleFetch-954f30e1.js');
7
7
  const isContrastColor = require('./isContrastColor-ef24b7aa.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-65e8da66.js');
3
+ const cart = require('./cart-e8bc11a3.js');
4
4
  const localization = require('./localization-90650d7d.js');
5
5
  const handleFetch = require('./handleFetch-954f30e1.js');
6
6
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-65e8da66.js');
3
+ const cart = require('./cart-e8bc11a3.js');
4
4
  const localization = require('./localization-90650d7d.js');
5
5
 
6
6
  const getDisplayCurrency = () => {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-b1f95d96.js');
6
6
  const localization = require('./localization-90650d7d.js');
7
7
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
8
- const cart = require('./cart-65e8da66.js');
8
+ const cart = require('./cart-e8bc11a3.js');
9
9
  const classes = require('./classes-b7918f56.js');
10
10
  const getBorderRadius = require('./getBorderRadius-4da24d7c.js');
11
11
  const zonosStore = require('./zonosStore-fee716c9.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
6
  const throttle = require('./throttle-34f7abf1.js');
7
- const cart = require('./cart-65e8da66.js');
7
+ const cart = require('./cart-e8bc11a3.js');
8
8
  const localization = require('./localization-90650d7d.js');
9
9
  const zonosStore = require('./zonosStore-fee716c9.js');
10
10
  const handleFetch = require('./handleFetch-954f30e1.js');
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const collect = require('./collect-37c177ab.js');
7
- const cart = require('./cart-65e8da66.js');
6
+ const collect = require('./collect-e6485168.js');
7
+ const cart = require('./cart-e8bc11a3.js');
8
8
  const localization = require('./localization-90650d7d.js');
9
9
  const zonosStore = require('./zonosStore-fee716c9.js');
10
10
  const VarianceTest = require('./VarianceTest-bec00ea8.js');
@@ -6,10 +6,10 @@ const index = require('./index-b1f95d96.js');
6
6
  const zonosStore = require('./zonosStore-fee716c9.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-4da24d7c.js');
9
- const cart = require('./cart-65e8da66.js');
9
+ const cart = require('./cart-e8bc11a3.js');
10
10
  const localization = require('./localization-90650d7d.js');
11
11
  const handleFetch = require('./handleFetch-954f30e1.js');
12
- const paypal = require('./paypal-1952f6ec.js');
12
+ const paypal = require('./paypal-77bd640c.js');
13
13
  const VarianceTest = require('./VarianceTest-bec00ea8.js');
14
14
  require('./isDarkColor-ebc74b4d.js');
15
15
  require('./TaxId-12acedde.js');
@@ -3,20 +3,20 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-65e8da66.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
7
  const localization = require('./localization-90650d7d.js');
8
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-fd35b4ef.js');
8
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-66377cf5.js');
9
9
  const cleanHtmlMarkdown = require('./cleanHtmlMarkdown-57147de7.js');
10
10
  const classes = require('./classes-b7918f56.js');
11
11
  const zonosStore = require('./zonosStore-fee716c9.js');
12
12
  const hasInclusivePrice = require('./hasInclusivePrice-798ce42d.js');
13
- const paypal = require('./paypal-1952f6ec.js');
13
+ const paypal = require('./paypal-77bd640c.js');
14
14
  const handleFetch = require('./handleFetch-954f30e1.js');
15
15
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
16
16
  const getBorderRadius = require('./getBorderRadius-4da24d7c.js');
17
17
  const VarianceTest = require('./VarianceTest-bec00ea8.js');
18
18
  const ILanguage = require('./ILanguage-98b04442.js');
19
- const placeTestOrder = require('./placeTestOrder-30191a8f.js');
19
+ const placeTestOrder = require('./placeTestOrder-7767d119.js');
20
20
  const isDarkColor = require('./isDarkColor-ebc74b4d.js');
21
21
  const getContrastColor = require('./getContrastColor-2fb235b8.js');
22
22
  const isColorVariable = require('./isColorVariable-525dbfa7.js');
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-65e8da66.js');
7
- const paypal = require('./paypal-1952f6ec.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
+ const paypal = require('./paypal-77bd640c.js');
8
8
  const localization = require('./localization-90650d7d.js');
9
9
  const zonosStore = require('./zonosStore-fee716c9.js');
10
10
  const buildCartItemsByTempCart = require('./buildCartItemsByTempCart-edddbf4b.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 cart = require('./cart-65e8da66.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
7
  const cleanHtmlMarkdown = require('./cleanHtmlMarkdown-57147de7.js');
8
8
  const zonosStore = require('./zonosStore-fee716c9.js');
9
9
  const classes = require('./classes-b7918f56.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 collect = require('./collect-37c177ab.js');
7
- const cart = require('./cart-65e8da66.js');
8
- const paypal = require('./paypal-1952f6ec.js');
6
+ const collect = require('./collect-e6485168.js');
7
+ const cart = require('./cart-e8bc11a3.js');
8
+ const paypal = require('./paypal-77bd640c.js');
9
9
  const localization = require('./localization-90650d7d.js');
10
10
  const zonosStore = require('./zonosStore-fee716c9.js');
11
11
  const handleFetch = require('./handleFetch-954f30e1.js');
@@ -15,8 +15,8 @@ const VarianceTest = require('./VarianceTest-bec00ea8.js');
15
15
  const isCollectMobileTablet = require('./isCollectMobileTablet-884d4280.js');
16
16
  const classes = require('./classes-b7918f56.js');
17
17
  const ILanguage = require('./ILanguage-98b04442.js');
18
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-fd35b4ef.js');
19
- const placeTestOrder = require('./placeTestOrder-30191a8f.js');
18
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-66377cf5.js');
19
+ const placeTestOrder = require('./placeTestOrder-7767d119.js');
20
20
  const renderFallback = require('./renderFallback-bc20ee20.js');
21
21
  require('./isDarkColor-ebc74b4d.js');
22
22
  require('./TaxId-12acedde.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 collect = require('./collect-37c177ab.js');
7
- const cart = require('./cart-65e8da66.js');
8
- const paypal = require('./paypal-1952f6ec.js');
6
+ const collect = require('./collect-e6485168.js');
7
+ const cart = require('./cart-e8bc11a3.js');
8
+ const paypal = require('./paypal-77bd640c.js');
9
9
  const localization = require('./localization-90650d7d.js');
10
10
  const zonosStore = require('./zonosStore-fee716c9.js');
11
11
  const buildCartItemsByTempCart = require('./buildCartItemsByTempCart-edddbf4b.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 cart = require('./cart-65e8da66.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
7
  const localization = require('./localization-90650d7d.js');
8
8
  const zonosStore = require('./zonosStore-fee716c9.js');
9
9
  const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
@@ -722,7 +722,7 @@ const ZonosController = class {
722
722
  zonosStore.zonosStore.zonosApiKey = this.zonosApiKey;
723
723
  // running with scope async function to avoid blocking the main thread
724
724
  (async () => {
725
- var _a, _b, _c, _d;
725
+ var _a, _b, _c, _d, _e, _f;
726
726
  const { errors, json, zonosMode } = await getZonosSettings();
727
727
  if (((_b = (_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toString()) === '403') {
728
728
  VarianceTest.log('Failed to load zonos settings. This domain may not have access', 'warn');
@@ -791,6 +791,19 @@ const ZonosController = class {
791
791
  VarianceTest.log('zonos controller loaded');
792
792
  return;
793
793
  }
794
+ const hasCartCallback =
795
+ // eslint-disable-next-line deprecation/deprecation -- gating Stripe load also honors the legacy callback
796
+ typeof ((_e = zonosStore.zonosStore.checkoutSettings) === null || _e === void 0 ? void 0 : _e.buildCartDetail) === 'function' ||
797
+ typeof ((_f = zonosStore.zonosStore.checkoutSettings) === null || _f === void 0 ? void 0 : _f.createCartId) === 'function';
798
+ // Checkout also runs without merchant cart callbacks when a cart is
799
+ // prefetched (e.g. `tempCartUUID` -> `cartData`) or when resuming a
800
+ // payment via the Stripe client secret. Stripe must still load for those.
801
+ const clientSecret = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || sessionStorage.getItem('zonos--client-secret');
802
+ const hasPrefetchedCheckoutContext = !!(window.Zonos.cartId && window.Zonos.cartData) || !!clientSecret;
803
+ if (!hasCartCallback && !hasPrefetchedCheckoutContext) {
804
+ VarianceTest.log(`Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present`, 'warn');
805
+ return;
806
+ }
794
807
  // send publishable key out to load stripe
795
808
  this.stripeInitEvent.emit({
796
809
  publishableKey: publishableKey.token,
@@ -850,7 +863,7 @@ const ZonosController = class {
850
863
  zonosStore.zonosStore.organizationName = organizationName;
851
864
  }
852
865
  render() {
853
- return index.h(index.Host, { key: '172f5c893940145cc2eb84c721783bc64332d3dc', class: "zonos--elements" });
866
+ return index.h(index.Host, { key: '925af89a63419b44e6372de48c66e0898d039ae0', class: "zonos--elements" });
854
867
  }
855
868
  };
856
869
  ZonosController.style = ZonosControllerStyle0;
@@ -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-65e8da66.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
7
  const localization = require('./localization-90650d7d.js');
8
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-fd35b4ef.js');
8
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-66377cf5.js');
9
9
  const classes = require('./classes-b7918f56.js');
10
- const invoice = require('./invoice-96f5c802.js');
10
+ const invoice = require('./invoice-dff7ec81.js');
11
11
  const renderFallback = require('./renderFallback-bc20ee20.js');
12
12
  require('./zonosStore-fee716c9.js');
13
13
  require('./VarianceTest-bec00ea8.js');
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1f95d96.js');
6
- const cart = require('./cart-65e8da66.js');
7
- const paypal = require('./paypal-1952f6ec.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
+ const paypal = require('./paypal-77bd640c.js');
8
8
  const localization = require('./localization-90650d7d.js');
9
9
  const zonosStore = require('./zonosStore-fee716c9.js');
10
10
  const handleFetch = require('./handleFetch-954f30e1.js');
@@ -14,9 +14,9 @@ const VarianceTest = require('./VarianceTest-bec00ea8.js');
14
14
  const isInvoiceMobileTablet = require('./isInvoiceMobileTablet-dde41e4e.js');
15
15
  const classes = require('./classes-b7918f56.js');
16
16
  const ILanguage = require('./ILanguage-98b04442.js');
17
- const invoice = require('./invoice-96f5c802.js');
18
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-fd35b4ef.js');
19
- const placeTestOrder = require('./placeTestOrder-30191a8f.js');
17
+ const invoice = require('./invoice-dff7ec81.js');
18
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-66377cf5.js');
19
+ const placeTestOrder = require('./placeTestOrder-7767d119.js');
20
20
  const renderFallback = require('./renderFallback-bc20ee20.js');
21
21
  require('./isDarkColor-ebc74b4d.js');
22
22
  require('./TaxId-12acedde.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-65e8da66.js');
7
- const invoice = require('./invoice-96f5c802.js');
8
- const paypal = require('./paypal-1952f6ec.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
+ const invoice = require('./invoice-dff7ec81.js');
8
+ const paypal = require('./paypal-77bd640c.js');
9
9
  const localization = require('./localization-90650d7d.js');
10
10
  const zonosStore = require('./zonosStore-fee716c9.js');
11
11
  const buildCartItemsByTempCart = require('./buildCartItemsByTempCart-edddbf4b.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-65e8da66.js');
6
+ const cart = require('./cart-e8bc11a3.js');
7
7
  const localization = require('./localization-90650d7d.js');
8
8
  const zonosStore = require('./zonosStore-fee716c9.js');
9
- const renderCheckoutCurrency = require('./renderCheckoutCurrency-fd35b4ef.js');
9
+ const renderCheckoutCurrency = require('./renderCheckoutCurrency-66377cf5.js');
10
10
  const getBorderRadius = require('./getBorderRadius-4da24d7c.js');
11
11
  require('./VarianceTest-bec00ea8.js');
12
12
  require('./handleFetch-954f30e1.js');
@@ -207,7 +207,7 @@ export class ZonosController {
207
207
  zonosStore.zonosApiKey = this.zonosApiKey;
208
208
  // running with scope async function to avoid blocking the main thread
209
209
  (async () => {
210
- var _a, _b, _c, _d;
210
+ var _a, _b, _c, _d, _e, _f;
211
211
  const { errors, json, zonosMode } = await getZonosSettings();
212
212
  if (((_b = (_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toString()) === '403') {
213
213
  log('Failed to load zonos settings. This domain may not have access', 'warn');
@@ -276,6 +276,19 @@ export class ZonosController {
276
276
  log('zonos controller loaded');
277
277
  return;
278
278
  }
279
+ const hasCartCallback =
280
+ // eslint-disable-next-line deprecation/deprecation -- gating Stripe load also honors the legacy callback
281
+ typeof ((_e = zonosStore.checkoutSettings) === null || _e === void 0 ? void 0 : _e.buildCartDetail) === 'function' ||
282
+ typeof ((_f = zonosStore.checkoutSettings) === null || _f === void 0 ? void 0 : _f.createCartId) === 'function';
283
+ // Checkout also runs without merchant cart callbacks when a cart is
284
+ // prefetched (e.g. `tempCartUUID` -> `cartData`) or when resuming a
285
+ // payment via the Stripe client secret. Stripe must still load for those.
286
+ const clientSecret = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || sessionStorage.getItem('zonos--client-secret');
287
+ const hasPrefetchedCheckoutContext = !!(window.Zonos.cartId && window.Zonos.cartData) || !!clientSecret;
288
+ if (!hasCartCallback && !hasPrefetchedCheckoutContext) {
289
+ log(`Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present`, 'warn');
290
+ return;
291
+ }
279
292
  // send publishable key out to load stripe
280
293
  this.stripeInitEvent.emit({
281
294
  publishableKey: publishableKey.token,
@@ -335,7 +348,7 @@ export class ZonosController {
335
348
  zonosStore.organizationName = organizationName;
336
349
  }
337
350
  render() {
338
- return h(Host, { key: '172f5c893940145cc2eb84c721783bc64332d3dc', class: "zonos--elements" });
351
+ return h(Host, { key: '925af89a63419b44e6372de48c66e0898d039ae0', class: "zonos--elements" });
339
352
  }
340
353
  static get is() { return "zonos-controller"; }
341
354
  static get encapsulation() { return "shadow"; }
@@ -482,9 +482,14 @@ const stripeCalculateLandedCost = async () => {
482
482
  // Reset cart items to non-restricted state and restricted item list
483
483
  cartStoreResetCartItems();
484
484
  const { checkoutSessionWorkflow, errors, itemCreateWorkflow, landedCostCalculateWorkflow, partyCreateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
485
- // update the error message with customized error message that rule is applying to and disabled shippment rating if there is any
485
+ // Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
486
+ // constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
486
487
  cartStore.customQuotingError =
487
- ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => { var _a; return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM'; })) === null || _a === void 0 ? void 0 : _a.message) || null;
488
+ ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => {
489
+ var _a, _b;
490
+ return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM' ||
491
+ ((_b = error.extensions) === null || _b === void 0 ? void 0 : _b.source) === 'COUNTRY_CONSTRAINT';
492
+ })) === null || _a === void 0 ? void 0 : _a.message) || null;
488
493
  cartStore.shippingData = sortServiceLevelOptionsByAmount((shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || []);
489
494
  // check and update cart items with restrictions
490
495
  cartStoreCheckItemRestrictions(itemCreateWorkflow);
@@ -1,7 +1,20 @@
1
1
  // Execute our own script injection after a tick to give users time to do their
2
2
  import { initStripe, zonosStripeLoadScript, } from "./_stripe";
3
3
  // own script injection.
4
- const stripePromise = Promise.resolve().then(() => zonosStripeLoadScript(null));
4
+ const hasCheckoutCartCallback = () => {
5
+ var _a, _b;
6
+ return typeof window !== 'undefined' &&
7
+ (typeof ((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.createCartId) === 'function' ||
8
+ typeof ((_b = window.Zonos) === null || _b === void 0 ? void 0 : _b.buildCartDetail) === 'function');
9
+ };
10
+ const stripePromise = Promise.resolve().then(() => {
11
+ // Skip eagerly loading Stripe when no checkout cart callback is configured
12
+ // (e.g. a Hello-only integration). Stripe is loaded on demand instead.
13
+ if (!hasCheckoutCartCallback()) {
14
+ return null;
15
+ }
16
+ return zonosStripeLoadScript(null);
17
+ });
5
18
  let loadCalled = false;
6
19
  stripePromise.catch((err) => {
7
20
  if (!loadCalled) {
@@ -10,7 +23,12 @@ stripePromise.catch((err) => {
10
23
  }
11
24
  });
12
25
  export const zonosLoadStripe = async (...args) => {
26
+ var _a;
13
27
  loadCalled = true;
14
28
  const startTime = Date.now();
15
- return stripePromise.then(maybeStripe => initStripe(maybeStripe, args, startTime));
29
+ // Fall back to loading Stripe on demand if the eager preload was skipped
30
+ // (callbacks set after the microtask, or Collect/Invoice flows that don't
31
+ // use cart callbacks). `zonosStripeLoadScript` is idempotent.
32
+ const maybeStripe = (_a = (await stripePromise)) !== null && _a !== void 0 ? _a : (await zonosStripeLoadScript(null));
33
+ return initStripe(maybeStripe, args, startTime);
16
34
  };
@@ -87,6 +87,11 @@ Zonos.logIntervalId = null;
87
87
  Zonos.init = async (params) => {
88
88
  const { appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, } = params;
89
89
  _a.cartId = getCartIdFromQueryParam();
90
+ // Expose the checkout cart callbacks on the global so Stripe loading can be
91
+ // gated on whether at least one of them is configured.
92
+ _a.createCartId = checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.createCartId;
93
+ // eslint-disable-next-line deprecation/deprecation -- intentionally mirror the (deprecated) callback so Stripe loading can be gated on it
94
+ _a.buildCartDetail = checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.buildCartDetail;
90
95
  if (_a.doneInit) {
91
96
  // do nothing if zonos is already initialized
92
97
  return;
@@ -1383,9 +1383,14 @@ const stripeCalculateLandedCost = async () => {
1383
1383
  // Reset cart items to non-restricted state and restricted item list
1384
1384
  cartStoreResetCartItems();
1385
1385
  const { checkoutSessionWorkflow, errors, itemCreateWorkflow, landedCostCalculateWorkflow, partyCreateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
1386
- // update the error message with customized error message that rule is applying to and disabled shippment rating if there is any
1386
+ // Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
1387
+ // constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
1387
1388
  cartStore.customQuotingError =
1388
- ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => { var _a; return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM'; })) === null || _a === void 0 ? void 0 : _a.message) || null;
1389
+ ((_a = errors === null || errors === void 0 ? void 0 : errors.find(error => {
1390
+ var _a, _b;
1391
+ return ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.ruleMessageType) === 'CUSTOM' ||
1392
+ ((_b = error.extensions) === null || _b === void 0 ? void 0 : _b.source) === 'COUNTRY_CONSTRAINT';
1393
+ })) === null || _a === void 0 ? void 0 : _a.message) || null;
1389
1394
  cartStore.shippingData = sortServiceLevelOptionsByAmount((shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || []);
1390
1395
  // check and update cart items with restrictions
1391
1396
  cartStoreCheckItemRestrictions(itemCreateWorkflow);
@@ -2,7 +2,7 @@ import { c as createStore, z as zonosStore } from './zonosStore-b7d3f9b0.js';
2
2
  import { t as translate, l as localizationStore, s as storageStore } from './localization-d49867ed.js';
3
3
  import { l as logError$1, h as handleFetch, s as sendErrorLog } from './handleFetch-a844cac1.js';
4
4
  import { l as log, b as allLogs } from './VarianceTest-572cecf5.js';
5
- import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-402dcde5.js';
5
+ import { b as stripeStore, K as stripeStoreBuildAddressForPartyCreate, d as cartStore, L as cartStoreUpdateSelectedShippingOption } from './cart-8b8dc79f.js';
6
6
 
7
7
  // src/constant/common.ts
8
8
  function _array_like_to_array(arr, len) {