@zonos/elements 1.3.44 → 1.3.46

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 (137) hide show
  1. package/dist/cjs/{cart-89b4f62d.js → cart-7a79bccc.js} +152 -49
  2. package/dist/cjs/{sendErrorLog-a966a8c1.js → createCustomEvent-2fe80338.js} +2 -22
  3. package/dist/cjs/index.cjs.js +12 -8
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-1a1882c4.js → paypal-eb07e9f5.js} +3 -3
  6. package/dist/cjs/zonos-address_8.cjs.entry.js +2 -2
  7. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +29 -21
  8. package/dist/cjs/zonos-checkout.cjs.entry.js +11 -11
  9. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  10. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-elements.cjs.js +1 -1
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-hello.cjs.entry.js +2 -3
  15. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.css +7 -0
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +16 -9
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +4 -0
  20. package/dist/collection/components/common/zonos-dialog/zonos-dialog.css +1 -0
  21. package/dist/collection/components/main/zonos-controller.js +4 -3
  22. package/dist/collection/components/store/checkout/stripe.js +4 -7
  23. package/dist/collection/components/store/hello/localization.js +1 -1
  24. package/dist/collection/components/utils/api/calculateLandedCost.js +1 -2
  25. package/dist/collection/components/utils/api/checkItemRestrictions.js +1 -2
  26. package/dist/collection/components/utils/api/getCountries.js +1 -1
  27. package/dist/collection/components/utils/api/getCountryLandedCost.js +1 -1
  28. package/dist/collection/components/utils/api/getExchangeRate.js +6 -2
  29. package/dist/collection/components/utils/api/getInclusivePricing.js +1 -2
  30. package/dist/collection/components/utils/api/getLocaleMessages.js +7 -2
  31. package/dist/collection/components/utils/api/getLocalization.js +3 -6
  32. package/dist/collection/components/utils/api/getShippingZones.js +1 -2
  33. package/dist/collection/components/utils/api/getZonosSettings.js +1 -2
  34. package/dist/collection/components/utils/api/paypalCaptureOrder.js +1 -1
  35. package/dist/collection/components/utils/api/paypalCreateOrder.js +1 -1
  36. package/dist/collection/components/utils/api/trackConversionEvent.js +1 -2
  37. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +3 -2
  38. package/dist/collection/components/utils/getNextFallbackApi.js +18 -0
  39. package/dist/collection/components/utils/handleFetch.js +75 -21
  40. package/dist/collection/components/utils/logging/sendErrorLog.js +19 -5
  41. package/dist/collection/components/utils/logging/sendLoadScriptLog.js +1 -1
  42. package/dist/collection/environment.js +13 -78
  43. package/dist/collection/scripts/_getZonosQaUrl.js +6 -2
  44. package/dist/collection/utils/formattedCloudflareApiUrl.js +43 -0
  45. package/dist/collection/utils/formattedUrl.js +80 -0
  46. package/dist/collection/utils/generateCloudflareDeployUrl.js +21 -0
  47. package/dist/collection/utils/getGraphQlShortId.js +1 -0
  48. package/dist/esm/{cart-9f40efd7.js → cart-2198741e.js} +153 -51
  49. package/dist/esm/{sendErrorLog-aea606c0.js → createCustomEvent-451d7879.js} +3 -22
  50. package/dist/esm/index.js +12 -8
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{paypal-f4bb6ce7.js → paypal-2890968d.js} +3 -3
  53. package/dist/esm/zonos-address_8.entry.js +2 -2
  54. package/dist/esm/zonos-cart-items_12.entry.js +21 -13
  55. package/dist/esm/zonos-checkout.entry.js +4 -4
  56. package/dist/esm/zonos-controller.entry.js +6 -6
  57. package/dist/esm/zonos-country-flag.entry.js +1 -1
  58. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  59. package/dist/esm/zonos-elements.js +1 -1
  60. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  61. package/dist/esm/zonos-hello.entry.js +2 -3
  62. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  63. package/dist/esm/zonos-notification_3.entry.js +2 -2
  64. package/dist/esm-es5/{cart-9f40efd7.js → cart-2198741e.js} +1 -1
  65. package/dist/esm-es5/createCustomEvent-451d7879.js +1 -0
  66. package/dist/esm-es5/index.js +1 -1
  67. package/dist/esm-es5/loader.js +1 -1
  68. package/dist/esm-es5/paypal-2890968d.js +17 -0
  69. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  70. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  71. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  72. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  73. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  74. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  75. package/dist/esm-es5/zonos-elements.js +1 -1
  76. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  77. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  78. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  79. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  80. package/dist/scripts/index.d.ts +3 -0
  81. package/dist/scripts/index.js +1 -1
  82. package/dist/scripts/loadZonos.js +1 -1
  83. package/dist/scripts/zonos.js +1 -1
  84. package/dist/types/components/utils/getNextFallbackApi.d.ts +10 -0
  85. package/dist/types/components/utils/handleFetch.d.ts +10 -1
  86. package/dist/types/environment.d.ts +4 -9
  87. package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -1
  88. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +20 -0
  89. package/dist/types/utils/formattedUrl.d.ts +9 -0
  90. package/dist/types/utils/generateCloudflareDeployUrl.d.ts +10 -0
  91. package/dist/types/utils/getGraphQlShortId.d.ts +1 -0
  92. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  93. package/dist/zonos-elements/index.esm.js +1 -1
  94. package/dist/zonos-elements/p-18f46c3f.entry.js +1 -0
  95. package/dist/zonos-elements/p-2b25ac5e.system.js +1 -0
  96. package/dist/zonos-elements/p-2f24a1f7.system.js +17 -0
  97. package/dist/zonos-elements/p-3b116246.system.entry.js +1 -0
  98. package/dist/zonos-elements/{p-578f42c1.entry.js → p-40e8f3bd.entry.js} +1 -1
  99. package/dist/zonos-elements/p-467cdce8.system.entry.js +1 -0
  100. package/dist/zonos-elements/p-52c2fb9d.entry.js +1 -0
  101. package/dist/zonos-elements/{p-5845029a.system.entry.js → p-65efc406.system.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-8618e185.entry.js → p-6b868590.entry.js} +1 -1
  103. package/dist/zonos-elements/{p-21d07dda.entry.js → p-791d240f.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-acf9a97e.system.entry.js → p-7b9ed9ed.system.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-7b8099ed.js → p-84e5636c.js} +1 -1
  106. package/dist/zonos-elements/{p-8630168f.system.entry.js → p-85b297d3.system.entry.js} +1 -1
  107. package/dist/zonos-elements/p-8b2486b7.system.entry.js +1 -0
  108. package/dist/zonos-elements/{p-aee29731.system.entry.js → p-a28492ca.system.entry.js} +1 -1
  109. package/dist/zonos-elements/{p-43d3cafd.system.js → p-ac01a4fe.system.js} +1 -1
  110. package/dist/zonos-elements/{p-4204ccf9.system.entry.js → p-b066612a.system.entry.js} +1 -1
  111. package/dist/zonos-elements/p-b06704a9.js +17 -0
  112. package/dist/zonos-elements/{p-37c9fdd2.system.entry.js → p-bfe85ef2.system.entry.js} +1 -1
  113. package/dist/zonos-elements/p-c3bb224b.entry.js +1 -0
  114. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  115. package/dist/zonos-elements/{p-09988f34.entry.js → p-cfbcfd4b.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-c7952400.entry.js → p-e43bbfe1.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-567b457b.entry.js → p-e69e429d.entry.js} +1 -1
  118. package/dist/zonos-elements/p-f12c159e.js +1 -0
  119. package/dist/zonos-elements/p-f9aa9bd8.system.js +1 -0
  120. package/dist/zonos-elements/{p-8bf1af28.entry.js → p-fb6c529a.entry.js} +1 -1
  121. package/dist/zonos-elements/p-ff10609a.system.entry.js +1 -0
  122. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  123. package/package.json +1 -1
  124. package/dist/esm-es5/paypal-f4bb6ce7.js +0 -17
  125. package/dist/esm-es5/sendErrorLog-aea606c0.js +0 -1
  126. package/dist/zonos-elements/p-0641784b.system.js +0 -1
  127. package/dist/zonos-elements/p-0bfe455c.system.entry.js +0 -1
  128. package/dist/zonos-elements/p-29f4cce5.system.js +0 -17
  129. package/dist/zonos-elements/p-2d01b8e6.system.entry.js +0 -1
  130. package/dist/zonos-elements/p-2e12d178.system.entry.js +0 -1
  131. package/dist/zonos-elements/p-3490d40f.js +0 -17
  132. package/dist/zonos-elements/p-6f759c76.system.js +0 -1
  133. package/dist/zonos-elements/p-744180f1.entry.js +0 -1
  134. package/dist/zonos-elements/p-76291114.entry.js +0 -1
  135. package/dist/zonos-elements/p-9aef3a35.entry.js +0 -1
  136. package/dist/zonos-elements/p-c10099bd.system.entry.js +0 -1
  137. package/dist/zonos-elements/p-d99e58f2.js +0 -1
@@ -7173,6 +7173,57 @@ const translate = (...[key, replacement]) => {
7173
7173
  return ((_b = translationStore.translatedChunks[key]) === null || _b === void 0 ? void 0 : _b.value) || key;
7174
7174
  };
7175
7175
 
7176
+ const fallbackApiType = ['vercel', 'cloudflare'];
7177
+ const MAIN_BASE_API_TYPE = fallbackApiType[0];
7178
+ const fallbackApiList = {
7179
+ cloudflare: "https://route.elements.zonos.com",
7180
+ vercel: "https://v1.route.js.zonos.com",
7181
+ };
7182
+ const MAIN_BASE_API = fallbackApiList[MAIN_BASE_API_TYPE];
7183
+ /**
7184
+ * Next available fallback api type
7185
+ */
7186
+ const getNextFallbackApiType = (currentApiType = MAIN_BASE_API_TYPE) => {
7187
+ const currentIndex = fallbackApiType.indexOf(currentApiType);
7188
+ const nextFallbackApiType = fallbackApiType[currentIndex + 1];
7189
+ if (!nextFallbackApiType) {
7190
+ return null;
7191
+ }
7192
+ return nextFallbackApiType;
7193
+ };
7194
+
7195
+ const sendErrorLog = async ({ endpoint, errors, metadata }) => {
7196
+ const userAgentData = 'userAgentData' in window.navigator
7197
+ ? // userAgentData is not yet supported in all browsers
7198
+ window.navigator.userAgentData
7199
+ : null;
7200
+ const errorObject = {
7201
+ endpoint,
7202
+ errors,
7203
+ metadata: Object.assign({ href: window.location.href, userAgent: userAgentData && userAgentData.brands.length > 0
7204
+ ? userAgentData
7205
+ : window.navigator.userAgent }, metadata),
7206
+ };
7207
+ try {
7208
+ // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
7209
+ void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
7210
+ body: JSON.stringify(errorObject),
7211
+ method: 'POST',
7212
+ });
7213
+ }
7214
+ catch (_err) {
7215
+ const nextFallbackApi = getNextFallbackApiType();
7216
+ if (!nextFallbackApi) {
7217
+ return;
7218
+ }
7219
+ // request to the fallback API if the first one fails
7220
+ void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
7221
+ body: JSON.stringify(errorObject),
7222
+ method: 'POST',
7223
+ });
7224
+ }
7225
+ };
7226
+
7176
7227
  var __rest = (undefined && undefined.__rest) || function (s, e) {
7177
7228
  var t = {};
7178
7229
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -7200,14 +7251,36 @@ const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false
7200
7251
  return null;
7201
7252
  }
7202
7253
  };
7203
- const handleRequest = async (url, options) => {
7254
+ const encodeString = (text) => {
7255
+ try {
7256
+ // encode the string, remove the "=" at the end of the encoded string
7257
+ const encodedString = btoa(text).replace(/=/g, '');
7258
+ return encodedString;
7259
+ }
7260
+ catch (error) {
7261
+ // return the reverse string if the encoding failed
7262
+ return text
7263
+ .replace(/[^A-Za-z0-9]/g, '')
7264
+ .split('')
7265
+ .reverse()
7266
+ .join('');
7267
+ }
7268
+ };
7269
+ const handleRequest = async ({ basePathType, options, path, }) => {
7204
7270
  let response;
7271
+ // fallback to the main base API if the passed in base path is not available
7272
+ const baseUrl = fallbackApiList[basePathType] || MAIN_BASE_API_TYPE;
7273
+ const url = baseUrl + path;
7274
+ // adding random encoded token to the url so that the request will be cached differently for each store
7275
+ const modifiedUrl = new URL(url);
7276
+ modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
7205
7277
  try {
7206
- response = await fetch(url, options);
7278
+ response = await fetch(modifiedUrl.toString(), options);
7207
7279
  }
7208
7280
  catch (e) {
7209
7281
  if (e instanceof Error) {
7210
7282
  return {
7283
+ baseUrl,
7211
7284
  errors: [{ message: e.message, type: 'unknown' }],
7212
7285
  json: null,
7213
7286
  response: null,
@@ -7216,6 +7289,7 @@ const handleRequest = async (url, options) => {
7216
7289
  }
7217
7290
  const message = 'Fail to fetch';
7218
7291
  return {
7292
+ baseUrl,
7219
7293
  errors: [{ message, type: 'unknown' }],
7220
7294
  json: null,
7221
7295
  response: null,
@@ -7231,6 +7305,7 @@ const handleRequest = async (url, options) => {
7231
7305
  if (response.ok) {
7232
7306
  const data = await getResponseBody({ response });
7233
7307
  return {
7308
+ baseUrl,
7234
7309
  errors: [],
7235
7310
  json: data,
7236
7311
  response,
@@ -7245,6 +7320,7 @@ const handleRequest = async (url, options) => {
7245
7320
  });
7246
7321
  const message = JSON.stringify(data);
7247
7322
  return {
7323
+ baseUrl,
7248
7324
  errors: [{ message, type: status }],
7249
7325
  json: null,
7250
7326
  response,
@@ -7254,6 +7330,7 @@ const handleRequest = async (url, options) => {
7254
7330
  catch (e) {
7255
7331
  const message = 'Unknown error';
7256
7332
  return {
7333
+ baseUrl,
7257
7334
  errors: [{ message: `${status}: ${message}`, type: status }],
7258
7335
  json: null,
7259
7336
  response: null,
@@ -7261,38 +7338,63 @@ const handleRequest = async (url, options) => {
7261
7338
  };
7262
7339
  }
7263
7340
  };
7264
- function encodeString(text) {
7265
- try {
7266
- // encode the string, remove the "=" at the end of the encoded string
7267
- const encodedString = btoa(text).replace(/=/g, '');
7268
- return encodedString;
7269
- }
7270
- catch (error) {
7271
- // return the reverse string if the encoding failed
7272
- return text
7273
- .replace(/[^A-Za-z0-9]/g, '')
7274
- .split('')
7275
- .reverse()
7276
- .join('');
7341
+ const handleRequestWithFallback = async ({ basePathType, options, path, }) => {
7342
+ const _a = await handleRequest({
7343
+ basePathType,
7344
+ options,
7345
+ path,
7346
+ }), { errors, response } = _a, rest = __rest(_a, ["errors", "response"]);
7347
+ const nextFallbackApiType = getNextFallbackApiType(basePathType);
7348
+ const unknownError = errors.find(({ type }) => type === 'unknown');
7349
+ const shouldCallFallback =
7350
+ // If next fallback is available, and the error is unknown (fail to fetch) or 404
7351
+ nextFallbackApiType && (!!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404);
7352
+ if (shouldCallFallback) {
7353
+ void sendErrorLog({
7354
+ endpoint: fallbackApiList[basePathType] + path,
7355
+ errors: errors.map(({ message }) => message),
7356
+ metadata: {
7357
+ currentBasePath: basePathType,
7358
+ nextFallbackApiType,
7359
+ status: response === null || response === void 0 ? void 0 : response.status,
7360
+ statusText: response === null || response === void 0 ? void 0 : response.statusText,
7361
+ },
7362
+ });
7363
+ logError.log(`=== "${path}" failed to fetch, trying next fallback ${nextFallbackApiType}`);
7364
+ return handleRequestWithFallback({
7365
+ basePathType: nextFallbackApiType,
7366
+ options,
7367
+ path,
7368
+ });
7277
7369
  }
7278
- }
7279
- const handleFetch = async (url, _opts) => {
7370
+ // No more fallbacks, just return the result
7371
+ return Object.assign({ errors, response }, rest);
7372
+ };
7373
+ /**
7374
+ * Fetch request and will request to fallback API when the first one fails
7375
+ * @param path Path name of the request (e.g. /api/something/com).
7376
+ * @param _opts fetch options
7377
+ */
7378
+ const handleFetch = async (path, _opts) => {
7280
7379
  const opts = __rest(_opts || {}, []);
7281
7380
  const body = opts.body ? JSON.stringify(opts.body) : undefined;
7282
7381
  const method = opts.method || 'GET';
7283
- // adding random encoded token to the url so that the request will be cached differently for each store
7284
- const modifiedUrl = new URL(url);
7285
- modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
7286
7382
  // headers content type
7287
7383
  const headers = Object.assign({ 'Content-Type': 'application/json', 'Zonos-Is-BigCommerce': window.Zonos.isBigCommerce.toString(), 'Zonos-Referer': window.location.hostname, 'Zonos-Version': window.Zonos.version, credentialtoken: window.Zonos.zonosApiKey || 'Empty credential token from zonos-elements' }, opts.headers);
7288
7384
  const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
7289
7385
  method });
7290
- return handleRequest(modifiedUrl.toString(), options);
7386
+ // This is for testing fallback API, set fallback API type to start with
7387
+ const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
7388
+ return handleRequestWithFallback({
7389
+ basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
7390
+ options,
7391
+ path,
7392
+ });
7291
7393
  };
7292
7394
 
7293
7395
  const getCountries = async () => {
7294
7396
  try {
7295
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/get-countries`, {
7397
+ const { errors, json } = await handleFetch('/api/zonos-elements/get-countries', {
7296
7398
  method: 'GET',
7297
7399
  });
7298
7400
  if (errors.length || !json) {
@@ -7310,7 +7412,7 @@ const getCountryLandedCost = async (countryCode) => {
7310
7412
  if (!countryCode) {
7311
7413
  return null;
7312
7414
  }
7313
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/country-landed-cost/${countryCode}`;
7415
+ const url = `/api/zonos-elements/country-landed-cost/${countryCode}`;
7314
7416
  const { errors, json } = await handleFetch(url);
7315
7417
  if (errors.length || !json) {
7316
7418
  logError.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
@@ -7339,8 +7441,12 @@ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCu
7339
7441
  if (sourceCurrency === targetCurrency && !isGuaranteed) {
7340
7442
  return defaultUsExchangeRate;
7341
7443
  }
7342
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
7343
- const { errors, json } = await handleFetch(url);
7444
+ const searchParams = new URLSearchParams();
7445
+ searchParams.set('sourceCurrency', sourceCurrency);
7446
+ searchParams.set('targetCurrency', targetCurrency);
7447
+ searchParams.set('isGuaranteed', String(isGuaranteed));
7448
+ searchParams.set('country', country || '');
7449
+ const { errors, json } = await handleFetch(`/api/zonos-elements/exchange-rates?${searchParams.toString()}`);
7344
7450
  if (errors.length || !json) {
7345
7451
  logError.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
7346
7452
  return defaultUsExchangeRate;
@@ -7360,8 +7466,7 @@ const getInclusivePricing = async (countryCode) => {
7360
7466
  if (!countryCode) {
7361
7467
  return null;
7362
7468
  }
7363
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/inclusive-prices/${countryCode}`;
7364
- const { errors, json } = await handleFetch(url);
7469
+ const { errors, json } = await handleFetch(`/api/zonos-elements/inclusive-prices/${countryCode}`);
7365
7470
  if (errors.length || !json) {
7366
7471
  logError.logError(`Error fetching country inclusive price setting: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
7367
7472
  return null;
@@ -7371,8 +7476,13 @@ const getInclusivePricing = async (countryCode) => {
7371
7476
 
7372
7477
  const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
7373
7478
  var _a;
7374
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/locale-messages?countryCode=${countryCode}&storeId=${storeId}&localeTo=${localeTo}`;
7375
- const { errors, json } = await handleFetch(url);
7479
+ const searchParams = new URLSearchParams();
7480
+ searchParams.set('countryCode', countryCode);
7481
+ searchParams.set('storeId', storeId.toString());
7482
+ if (localeTo) {
7483
+ searchParams.set('localeTo', localeTo);
7484
+ }
7485
+ const { errors, json } = await handleFetch(`/api/zonos-elements/locale-messages?${searchParams.toString()}`);
7376
7486
  if (errors.length || !json) {
7377
7487
  logError.logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
7378
7488
  return [];
@@ -7392,14 +7502,11 @@ const getLocalization = async () => {
7392
7502
  // load and use country from session storage when zCountry query param is not present
7393
7503
  const countryLoadedSession = window.sessionStorage.getItem('zonos--country');
7394
7504
  const zCountry = getZCountryUrlParam(currentUrl.searchParams) || countryLoadedSession;
7395
- const localizationUrl = new URL(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/localization`);
7505
+ const searchParams = new URLSearchParams();
7396
7506
  if (zCountry) {
7397
- localizationUrl.searchParams.set('zCountry', zCountry);
7507
+ searchParams.set('zCountry', zCountry);
7398
7508
  }
7399
- const fetchUrl = localizationUrl.href;
7400
- const { errors, json } = await handleFetch(fetchUrl, {
7401
- method: 'GET',
7402
- });
7509
+ const { errors, json } = await handleFetch(`/api/zonos-elements/localization?${searchParams.toString()}`);
7403
7510
  if (errors.length || !json) {
7404
7511
  return { country: null, locale: null };
7405
7512
  }
@@ -7415,8 +7522,7 @@ const getLocalization = async () => {
7415
7522
 
7416
7523
  const getShippingZones = async () => {
7417
7524
  var _a, _b;
7418
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/shipping-zones`;
7419
- const { errors, json } = await handleFetch(url);
7525
+ const { errors, json } = await handleFetch('/api/zonos-elements/shipping-zones');
7420
7526
  if (errors.length || !json) {
7421
7527
  logError.logError(`Error fetching shipping zones: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
7422
7528
  return null;
@@ -7823,7 +7929,7 @@ const updateCheckoutSessionLanguage = async () => {
7823
7929
  if (!cartStore.checkoutSessionId) {
7824
7930
  return null;
7825
7931
  }
7826
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/update-checkout-session-metadata`, {
7932
+ const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session-metadata', {
7827
7933
  body: {
7828
7934
  id: cartStore.checkoutSessionId,
7829
7935
  metadata: [
@@ -7935,13 +8041,13 @@ const triggerBuildLandedCost = async (buildLandedCost) => {
7935
8041
  checkoutSessionId: data.checkoutSessionId,
7936
8042
  contact: data.contact,
7937
8043
  shippingAddress: data.shippingAddress,
7938
- zonosApiRoute: "https://v1.route.js.zonos.com",
8044
+ zonosApiRoute: MAIN_BASE_API,
7939
8045
  });
7940
8046
  if (!landedCost || ((_a = landedCost.errors) === null || _a === void 0 ? void 0 : _a.length)) {
7941
8047
  throw new Error(`Failed to build landed cost: ${((_c = (_b = landedCost === null || landedCost === void 0 ? void 0 : landedCost.errors) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error'}`);
7942
8048
  }
7943
8049
  // Validate the landed cost object to make sure the returned value from buildLandedCost has a valid schema
7944
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/validate-landed-cost`, {
8050
+ const { errors, json } = await handleFetch('/api/zonos-elements/validate-landed-cost', {
7945
8051
  body: landedCost,
7946
8052
  headers: {
7947
8053
  'Content-Type': 'application/json',
@@ -7963,8 +8069,7 @@ const calculateLandedCost = async (abortController) => {
7963
8069
  return json;
7964
8070
  }
7965
8071
  // request to get landed cost info
7966
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/calculate-landed-cost`;
7967
- const { errors, json } = await handleFetch(url, {
8072
+ const { errors, json } = await handleFetch('/api/zonos-elements/calculate-landed-cost', {
7968
8073
  body: prepCalculateLandedCost(),
7969
8074
  method: 'POST',
7970
8075
  signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
@@ -8495,13 +8600,11 @@ const stripeStoreInitCheckoutSession = async () => {
8495
8600
  return false;
8496
8601
  }
8497
8602
  stripeStore.isFetchingSession = true;
8498
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/create-checkout-session`, {
8603
+ const { errors, json } = await handleFetch('/api/zonos-elements/create-checkout-session', {
8499
8604
  body: {
8500
8605
  currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
8501
8606
  itemsAmount: total,
8502
- metadata: [
8503
- { key: 'language', value: localizationStore.selectedLocale },
8504
- ],
8607
+ metadata: [{ key: 'language', value: localizationStore.selectedLocale }],
8505
8608
  presentmentCountryCode: localizationStore.selectedCountryCode || null,
8506
8609
  },
8507
8610
  method: 'POST',
@@ -8526,7 +8629,7 @@ const stripeStoreInitCheckoutSession = async () => {
8526
8629
  const stripeStoreUpdateCheckoutSession = async ({ currency, id, itemsAmount, landedCostId, presentmentCountryCode, }) => {
8527
8630
  // No need to set loading state here because this function will be called under the hood to update
8528
8631
  // landed cost id for the section.
8529
- const { errors, json } = await handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/update-checkout-session`, {
8632
+ const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session', {
8530
8633
  body: {
8531
8634
  currency,
8532
8635
  id,
@@ -8625,8 +8728,7 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
8625
8728
  if (!isAddressOutdated) {
8626
8729
  return;
8627
8730
  }
8628
- const routeUrl = "https://v1.route.js.zonos.com";
8629
- const { errors, json } = await handleFetch(`${routeUrl}/api/zonos-elements/validate-address`, {
8731
+ const { errors, json } = await handleFetch('/api/zonos-elements/validate-address', {
8630
8732
  body: requestBody,
8631
8733
  method: 'POST',
8632
8734
  });
@@ -9009,6 +9111,7 @@ exports.localizationStore = localizationStore;
9009
9111
  exports.localizationStoreOnUpdate = localizationStoreOnUpdate;
9010
9112
  exports.localizationStoreUpdateSelectedCountryCode = localizationStoreUpdateSelectedCountryCode;
9011
9113
  exports.localizationStoreUpdateSelectedLocale = localizationStoreUpdateSelectedLocale;
9114
+ exports.sendErrorLog = sendErrorLog;
9012
9115
  exports.setZCountryUrlParam = setZCountryUrlParam;
9013
9116
  exports.stripeStore = stripeStore;
9014
9117
  exports.stripeStoreCleanupDomesticShippingSession = stripeStoreCleanupDomesticShippingSession;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-89b4f62d.js');
3
+ const cart = require('./cart-7a79bccc.js');
4
4
  const zonosStore = require('./zonosStore-56401fdb.js');
5
5
 
6
6
  const trackConversionEvent = async (eventName, metadata) => {
@@ -15,7 +15,6 @@ const trackConversionEvent = async (eventName, metadata) => {
15
15
  !window.Zonos.zonosConversionTest) {
16
16
  return;
17
17
  }
18
- const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/track-conversion-event`;
19
18
  const countryCode = cart.localizationStore.selectedCountryCode;
20
19
  const organizationId = zonosStore.zonosStore.organizationId;
21
20
  const checkoutSessionId = cart.cartStore.checkoutSessionId;
@@ -30,7 +29,7 @@ const trackConversionEvent = async (eventName, metadata) => {
30
29
  metadata,
31
30
  organizationId,
32
31
  };
33
- await cart.handleFetch(url, {
32
+ await cart.handleFetch('/api/zonos-elements/track-conversion-event', {
34
33
  body,
35
34
  method: 'POST',
36
35
  });
@@ -48,25 +47,6 @@ const createCustomEvent = (eventName, detail) => {
48
47
  });
49
48
  };
50
49
 
51
- const sendErrorLog = async ({ endpoint, errors, metadata }) => {
52
- const userAgentData = 'userAgentData' in window.navigator
53
- ? // userAgentData is not yet supported in all browsers
54
- window.navigator.userAgentData
55
- : null;
56
- const errorObject = {
57
- endpoint,
58
- errors,
59
- metadata: Object.assign({ href: window.location.href, userAgent: userAgentData && userAgentData.brands.length > 0
60
- ? userAgentData
61
- : window.navigator.userAgent }, metadata),
62
- };
63
- void cart.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/log-error`, {
64
- body: errorObject,
65
- method: 'POST',
66
- });
67
- };
68
-
69
50
  exports.createCustomEvent = createCustomEvent;
70
51
  exports.getIsTestMode = getIsTestMode;
71
- exports.sendErrorLog = sendErrorLog;
72
52
  exports.trackConversionEvent = trackConversionEvent;
@@ -94,13 +94,17 @@ const getZonosQaUrl = () => {
94
94
  return null;
95
95
  }
96
96
  const qaUrl = extractZonosQaUrl(window.location.href);
97
- const cdnUrl = "https://v1.3.44.js.zonos.com";
97
+ const cdnUrl = "https://v1.3.46.js.zonos.com";
98
98
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
99
- if (!qaUrl && cdnUrl.includes('test.')) {
99
+ if (!qaUrl &&
100
+ (cdnUrl.includes('test.') ||
101
+ // Vercel git domain
102
+ cdnUrl.includes('test-'))) {
100
103
  return cdnUrl;
101
104
  }
102
105
  // when local demo app is running, it needs to use the local dev script unless the qaUrl is set
103
- if (!qaUrl && window.location.hostname === 'dev.demo.elements.zonos.com') {
106
+ if (!qaUrl &&
107
+ ['dev.demo.elements.zonos.com'].includes(window.location.hostname)) {
104
108
  return 'https://dev.elements.zonos.com';
105
109
  }
106
110
  if (!qaUrl) {
@@ -264,10 +268,10 @@ const zonosLoadUrl = (() => {
264
268
  }
265
269
  return null;
266
270
  })();
267
- const ZONOS_URL = "https://v1.3.44.js.zonos.com";
268
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.44";
269
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.44";
270
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.44";
271
+ const ZONOS_URL = "https://v1.3.46.js.zonos.com";
272
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.46";
273
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.46";
274
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.46";
271
275
  const MAIN_LOAD_CDN_TYPE = 'jsdelivr';
272
276
  const INTER_FONT_URL = 'https://rsms.me';
273
277
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
@@ -288,7 +292,7 @@ Zonos.isBigCommerce = false;
288
292
  */
289
293
  Zonos.isNpm = true;
290
294
  Zonos.zonosQaUrl = null;
291
- Zonos.version = `v${"1.3.44"}`;
295
+ Zonos.version = `v${"1.3.46"}`;
292
296
  Zonos.modeAlerted = false;
293
297
  Zonos.tempCartData = null;
294
298
  Zonos.paypal = null;
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-input.cjs",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-badge_2.cjs",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}],[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}]]],["zonos-card.cjs",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-v-stack.cjs",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-country-select_4.cjs",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"initialSelectedValue":[8,"initial-selected-value"],"selectedItem":[32]}]]],["zonos-notification_3.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-country-flag.cjs",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-button_3.cjs",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-language-select_2.cjs",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-address_8.cjs",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-cart-items_12.cjs",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"showErrorBanner":[32]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevels":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]], options);
11
+ return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"initialSelectedValue":[8,"initial-selected-value"],"selectedItem":[32]}]]],["zonos-badge_2.cjs",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-input.cjs",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-card.cjs",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-notification_3.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-country-flag.cjs",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-v-stack.cjs",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-button_3.cjs",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-language-select_2.cjs",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4.cjs",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-address_8.cjs",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-cart-items_12.cjs",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"showErrorBanner":[32]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevels":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-56401fdb.js');
4
- const cart = require('./cart-89b4f62d.js');
4
+ const cart = require('./cart-7a79bccc.js');
5
5
  const isDarkColor = require('./isDarkColor-4eb96a1e.js');
6
6
  const logError = require('./logError-4e2f2020.js');
7
7
 
@@ -209,7 +209,7 @@ function validateArguments(options, PromisePonyfill) {
209
209
  }
210
210
 
211
211
  const paypalCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) => {
212
- const { errors, json } = await cart.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/capture-paypal-order`, {
212
+ const { errors, json } = await cart.handleFetch('/api/zonos-elements/capture-paypal-order', {
213
213
  body: { checkoutSessionId, paypalMockResponse },
214
214
  method: 'POST',
215
215
  });
@@ -217,7 +217,7 @@ const paypalCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) =>
217
217
  };
218
218
 
219
219
  const paypalCreateOrder = async ({ checkoutSessionId, }) => {
220
- const { errors, json } = await cart.handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/create-paypal-order`, {
220
+ const { errors, json } = await cart.handleFetch('/api/zonos-elements/create-paypal-order', {
221
221
  body: { checkoutSessionId },
222
222
  method: 'POST',
223
223
  });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-89b4f62d.js');
6
+ const cart = require('./cart-7a79bccc.js');
7
7
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
8
8
  const logError = require('./logError-4e2f2020.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
@@ -515,7 +515,7 @@ ZonosCollapse.style = ZonosCollapseStyle0;
515
515
 
516
516
  const RemoveIcon = `<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>`;
517
517
 
518
- const zonosDialogCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--min-height, auto);height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10)}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";
518
+ const zonosDialogCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--min-height, auto);height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";
519
519
  const ZonosDialogStyle0 = zonosDialogCss;
520
520
 
521
521
  const ZonosDialog = class {