@zonos/elements 1.3.90 → 1.3.92

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 (87) hide show
  1. package/dist/cjs/{cart-e15290ab.js → cart-d456e0b8.js} +28 -11
  2. package/dist/cjs/{createCustomEvent-3da45800.js → createCustomEvent-94c259c7.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{paypal-47b71e3b.js → paypal-5c5f8d32.js} +1 -5
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +17 -18
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +19 -12
  8. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  15. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +11 -8
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +1 -5
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +18 -10
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
  19. package/dist/collection/components/store/checkout/cart.js +15 -10
  20. package/dist/collection/components/utils/hello/getZCountryUrlParam.js +14 -2
  21. package/dist/esm/{cart-08c2a740.js → cart-1083aa3b.js} +29 -12
  22. package/dist/esm/{createCustomEvent-a8a9fe09.js → createCustomEvent-a45228e7.js} +1 -1
  23. package/dist/esm/index.js +7 -7
  24. package/dist/esm/{paypal-4a21792c.js → paypal-a2399ed3.js} +2 -5
  25. package/dist/esm/zonos-address_7.entry.js +1 -1
  26. package/dist/esm/zonos-cart-items_12.entry.js +17 -18
  27. package/dist/esm/zonos-checkout.entry.js +19 -12
  28. package/dist/esm/zonos-controller.entry.js +1 -1
  29. package/dist/esm/zonos-country-flag.entry.js +1 -1
  30. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  31. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  32. package/dist/esm/zonos-hello.entry.js +1 -1
  33. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  34. package/dist/esm/zonos-notification_3.entry.js +2 -2
  35. package/dist/esm-es5/{cart-08c2a740.js → cart-1083aa3b.js} +1 -1
  36. package/dist/esm-es5/{createCustomEvent-a8a9fe09.js → createCustomEvent-a45228e7.js} +1 -1
  37. package/dist/esm-es5/index.js +1 -1
  38. package/dist/esm-es5/{paypal-4a21792c.js → paypal-a2399ed3.js} +2 -2
  39. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  40. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  41. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  42. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  43. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  44. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  45. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  46. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  47. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  48. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  49. package/dist/scripts/index.js +1 -1
  50. package/dist/scripts/loadZonos.js +1 -1
  51. package/dist/scripts/zonos.js +1 -1
  52. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  53. package/dist/zonos-elements/index.esm.js +1 -1
  54. package/dist/zonos-elements/{p-4f13a851.entry.js → p-1560ee37.entry.js} +1 -1
  55. package/dist/zonos-elements/{p-fc2191b7.system.entry.js → p-1f1aaf73.system.entry.js} +1 -1
  56. package/dist/zonos-elements/p-340408f2.system.entry.js +1 -0
  57. package/dist/zonos-elements/{p-db4c833d.js → p-362bd7de.js} +2 -2
  58. package/dist/zonos-elements/{p-2aeb1f26.entry.js → p-3d6a7efd.entry.js} +1 -1
  59. package/dist/zonos-elements/p-403b3460.entry.js +1 -0
  60. package/dist/zonos-elements/{p-49010cea.system.entry.js → p-460cc134.system.entry.js} +1 -1
  61. package/dist/zonos-elements/{p-c1f0aeb4.system.js → p-4854c65b.system.js} +1 -1
  62. package/dist/zonos-elements/{p-76015899.system.entry.js → p-4e3d23ad.system.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-dbd51a62.system.entry.js → p-52fdf52d.system.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-05b75d37.system.js → p-57aa09e7.system.js} +1 -1
  65. package/dist/zonos-elements/{p-3951ac01.entry.js → p-7995965e.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-5f0c4397.system.js → p-8aad6abd.system.js} +2 -2
  67. package/dist/zonos-elements/{p-7c8ad901.js → p-8dc1342e.js} +1 -1
  68. package/dist/zonos-elements/{p-6d5d31ac.entry.js → p-8e4348e9.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-3214b2df.js → p-95b4ea5e.js} +1 -1
  70. package/dist/zonos-elements/{p-9c7da870.system.js → p-b53f9c25.system.js} +1 -1
  71. package/dist/zonos-elements/{p-f5e29ed6.system.entry.js → p-ba0aef88.system.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-531973ca.entry.js → p-c39c3ed6.entry.js} +1 -1
  73. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  74. package/dist/zonos-elements/{p-3ac3a8be.entry.js → p-cf28a962.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-0033c20b.system.entry.js → p-d8a3b001.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-aab5ccde.entry.js → p-dbe8a5de.entry.js} +1 -1
  77. package/dist/zonos-elements/{p-12f25739.system.entry.js → p-ded2ae47.system.entry.js} +1 -1
  78. package/dist/zonos-elements/{p-4a417566.system.entry.js → p-e8c3387c.system.entry.js} +1 -1
  79. package/dist/zonos-elements/p-e9ee2062.entry.js +1 -0
  80. package/dist/zonos-elements/p-ed276123.system.entry.js +1 -0
  81. package/dist/zonos-elements/{p-9773abc9.entry.js → p-f13738a1.entry.js} +1 -1
  82. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/zonos-elements/p-48b151ae.entry.js +0 -1
  85. package/dist/zonos-elements/p-8bbe007f.system.entry.js +0 -1
  86. package/dist/zonos-elements/p-c28824a0.system.entry.js +0 -1
  87. package/dist/zonos-elements/p-f49ca64f.entry.js +0 -1
@@ -8111,11 +8111,23 @@ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
8111
8111
  return json.locale_countryCodesPage;
8112
8112
  };
8113
8113
 
8114
+ const validateCountryCode = (countryCode) => {
8115
+ // Check that the country is two characters and is upper case
8116
+ if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
8117
+ return countryCode;
8118
+ }
8119
+ return null;
8120
+ };
8114
8121
  const getZCountryUrlParam = (urlParams) => {
8115
8122
  const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
8116
- const zCountry = urlSearchParams.get('zCountry');
8123
+ const getCountryParam = (param) => {
8124
+ const country = urlSearchParams.get(param);
8125
+ // Check that the country is two characters and is upper case
8126
+ return validateCountryCode(country);
8127
+ };
8128
+ const zCountry = getCountryParam('zCountry');
8117
8129
  // Fallback to legacy 'country'
8118
- const fallback = urlSearchParams.get('country');
8130
+ const fallback = getCountryParam('country');
8119
8131
  return zCountry || fallback;
8120
8132
  };
8121
8133
 
@@ -9826,7 +9838,7 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
9826
9838
  cartStore.externalConfirmationPageURL = externalConfirmationPageURL;
9827
9839
  }
9828
9840
  };
9829
- const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, }) => {
9841
+ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, shouldInitSessionOnFailure, }) => {
9830
9842
  var _a;
9831
9843
  if (landedCostId && cartStore.selectedLandedCost) {
9832
9844
  // update cart total right away if we have landed cost id to avoid order total flickering
@@ -9840,7 +9852,7 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
9840
9852
  }
9841
9853
  // update checkout session
9842
9854
  if (!cartStore.checkoutSessionId) {
9843
- handleFetch.logError('Could not update cart total without checkout session id');
9855
+ handleFetch.log('Could not update cart total without checkout session id', 'info');
9844
9856
  return false;
9845
9857
  }
9846
9858
  const { errors, json } = await stripeStoreUpdateCheckoutSession({
@@ -9854,13 +9866,16 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
9854
9866
  });
9855
9867
  if (errors.length > 0 || !json) {
9856
9868
  // do nothing if we can't get checkout session
9857
- handleFetch.logError('Error occurs when updating checkout session');
9858
- cartStoreUpdateToErrorState({
9859
- messages: [
9860
- translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists"),
9861
- ],
9862
- title: translate('Error updating Checkout'),
9863
- });
9869
+ handleFetch.logError('Error occurs when updating checkout session.');
9870
+ if (shouldInitSessionOnFailure) {
9871
+ handleFetch.log('Initiating checkout session on failure', 'info');
9872
+ const success = await stripeStoreInitCheckoutSession();
9873
+ handleFetch.log(`stripeStoreInitCheckoutSession: ${success}`);
9874
+ if (!success) {
9875
+ return false;
9876
+ }
9877
+ return true;
9878
+ }
9864
9879
  return false;
9865
9880
  }
9866
9881
  if (!landedCostId) {
@@ -9978,6 +9993,8 @@ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
9978
9993
  currency: currency,
9979
9994
  dutiesTaxesFeesEstimate: 0,
9980
9995
  itemsAmount: total,
9996
+ // attempt to init session on failure to update checkout session
9997
+ shouldInitSessionOnFailure: true,
9981
9998
  });
9982
9999
  stripeStore.isFetchingSession = false;
9983
10000
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-e15290ab.js');
3
+ const cart = require('./cart-d456e0b8.js');
4
4
  const zonosStore = require('./zonosStore-a4395972.js');
5
5
  const handleFetch = require('./handleFetch-45e76490.js');
6
6
 
@@ -97,7 +97,7 @@ const getZonosQaUrl = () => {
97
97
  return null;
98
98
  }
99
99
  const qaUrl = extractZonosQaUrl(window.location.href);
100
- const cdnUrl = "https://v1.3.90.js.zonos.com";
100
+ const cdnUrl = "https://v1.3.92.js.zonos.com";
101
101
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
102
102
  if (!qaUrl &&
103
103
  (cdnUrl.includes('test.') ||
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
281
281
  }
282
282
  return null;
283
283
  })();
284
- const ZONOS_URL = "https://v1.3.90.js.zonos.com";
285
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.90";
286
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.90";
287
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.90";
284
+ const ZONOS_URL = "https://v1.3.92.js.zonos.com";
285
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.92";
286
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.92";
287
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.92";
288
288
  const INTER_FONT_URL = 'https://rsms.me';
289
289
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
290
290
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -299,7 +299,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
299
299
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
300
300
  Zonos._paypalMockResponse = null;
301
301
  Zonos.isBigCommerce = false;
302
- Zonos.releaseDate = "1728926225081";
302
+ Zonos.releaseDate = "1728934623320";
303
303
  Zonos.isLegacyCheckout = false;
304
304
  /**
305
305
  * By default, the package will load from npm
@@ -307,7 +307,7 @@ Zonos.isLegacyCheckout = false;
307
307
  Zonos.isNpm = true;
308
308
  Zonos.zonosQaUrl = null;
309
309
  Zonos.zonosQaUrlApi = null;
310
- Zonos.version = `v${"1.3.90"}`;
310
+ Zonos.version = `v${"1.3.92"}`;
311
311
  Zonos.modeAlerted = false;
312
312
  Zonos.cartData = null;
313
313
  Zonos.paypal = null;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-a4395972.js');
4
- const cart = require('./cart-e15290ab.js');
4
+ const cart = require('./cart-d456e0b8.js');
5
5
  const handleFetch = require('./handleFetch-45e76490.js');
6
6
  const isDarkColor = require('./isDarkColor-5efc8367.js');
7
7
 
@@ -448,14 +448,10 @@ const paypalStoreInitButtons = (props) => {
448
448
  .filter(Boolean);
449
449
  return paypalStore.paypalButtons;
450
450
  };
451
- const paypalStoreHasPaypalEnabled = () => {
452
- return !!paypalStore.paypalButtons.length;
453
- };
454
451
 
455
452
  exports.isContrastColor = isContrastColor;
456
453
  exports.paypalInitScript = paypalInitScript;
457
454
  exports.paypalStore = paypalStore;
458
- exports.paypalStoreHasPaypalEnabled = paypalStoreHasPaypalEnabled;
459
455
  exports.paypalStoreInitButtons = paypalStoreInitButtons;
460
456
  exports.paypalStoreReset = paypalStoreReset;
461
457
  exports.submitGtag = submitGtag;
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
8
8
  const handleFetch = require('./handleFetch-45e76490.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-47b71e3b.js');
8
+ const paypal = require('./paypal-5c5f8d32.js');
9
9
  const zonosStore = require('./zonosStore-a4395972.js');
10
- const createCustomEvent = require('./createCustomEvent-3da45800.js');
10
+ const createCustomEvent = require('./createCustomEvent-94c259c7.js');
11
11
  const getBorderRadius = require('./getBorderRadius-5a64574c.js');
12
12
  const handleFetch = require('./handleFetch-45e76490.js');
13
13
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
@@ -1288,12 +1288,15 @@ const ZonosCheckoutFinish = class {
1288
1288
  };
1289
1289
  // TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
1290
1290
  this.getPullOrder = async (attempts = 0) => {
1291
- var _a, _b, _c;
1291
+ var _a, _b;
1292
1292
  const { baseUrl, order } = await this.pullOrder();
1293
- const legacyOrderNumberExist = !!((_c = (_b = (_a = this.order) === null || _a === void 0 ? void 0 : _a.references) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _c === void 0 ? void 0 : _c.value);
1294
- // legacy customers are still using the old order number so we need to wait for legacy order number to attach to dgs order before redirecting
1295
- if ((order && attempts >= 5) || legacyOrderNumberExist) {
1296
- if (!legacyOrderNumberExist) {
1293
+ const { isLegacyCheckout } = window.Zonos;
1294
+ const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
1295
+ if ((order && !isLegacyCheckout) ||
1296
+ (!order && attempts >= 5) ||
1297
+ foundLegacyOrderNumber) {
1298
+ if (isLegacyCheckout && !foundLegacyOrderNumber) {
1299
+ // We pushed this one through without the legacy order number, so we should log this
1297
1300
  const checkoutSessionId = cart.cartStore.checkoutSessionId;
1298
1301
  void handleFetch.sendErrorLog({
1299
1302
  endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
@@ -1310,7 +1313,7 @@ const ZonosCheckoutFinish = class {
1310
1313
  this.order = order;
1311
1314
  this.handleSuccessBehavior();
1312
1315
  }
1313
- else if ((!order || !legacyOrderNumberExist) && attempts < 5) {
1316
+ else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
1314
1317
  // Wait for 1 second before the next attempt
1315
1318
  await new Promise(resolve => setTimeout(resolve, 1000));
1316
1319
  await this.getPullOrder(attempts + 1);
@@ -1446,11 +1449,11 @@ const ZonosCheckoutFinish = class {
1446
1449
  var _a, _b;
1447
1450
  const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
1448
1451
  const isTestMode = createCustomEvent.getIsTestMode();
1449
- return (index.h(index.Host, { key: '3c6c69c59622b7b2731f9bc6eb1cc8a7f3491572', class: "zonos--checkout-finish zonos--elements", style: {
1452
+ return (index.h(index.Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
1450
1453
  '--border-radius': getBorderRadius.getBorderRadius({
1451
1454
  overrideBorderStyle: this.borderRadius,
1452
1455
  }),
1453
- } }, this.isLoading && (index.h("div", { key: '45ce0e608dca725237abc09295656c8b6471d26c', class: "loading-wrapper" }, index.h("zonos-spinner", { key: 'fd1a193d34ecf41af9bb6eff082c192c6a8d46db' }))), !this.isLoading && (index.h("div", { key: '64f652a419330967f13b9d01a172fcc52f6dfd5b', class: "zonos--finish-details" }, index.h("div", { key: '945cb9e55b418de79921c1995604572e6e009459', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: '241bd7034c5ab5e83e4cedd526a181120a743ad0', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (index.h("div", { key: '959595c1be3f65aa6cd2e00e4398c5bb4df702b6', class: "zonos--order-number" }, "Order #", orderId)), index.h("zonos-text", { key: 'a23dce69391c3abf49eb512e715af454c971977e', textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { key: 'ce87734e2d46e8a044bc0ded7a6ed6a4a705685d', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cart.cartStore.step === 'finish' && (index.h("div", { key: 'a46cee8819c83fb76a54dbe049ee2452b7fc150a', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '514fdff77f5aff9f4b9657a0579ab843833af7b0', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: '59630cf7504c1ef9d24854d041b063bbfdc3a1a4', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
1456
+ } }, this.isLoading && (index.h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, index.h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (index.h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, index.h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (index.h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (index.h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), index.h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (index.h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), index.h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (index.h(index.Fragment, null, message, index.h("br", null))))), index.h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cart.cartStore.step === 'finish' && (index.h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, index.h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), index.h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
1454
1457
  }
1455
1458
  static get assetsDirs() { return ["assets"]; }
1456
1459
  };
@@ -1562,12 +1565,8 @@ const ZonosCheckoutPayment = class {
1562
1565
  this.showErrorBanner = !this.handleValidate();
1563
1566
  }
1564
1567
  const isTestMode = createCustomEvent.getIsTestMode();
1565
- const hasPaypalEnabled = paypal.paypalStoreHasPaypalEnabled();
1566
1568
  const isPaypalTabSelected = ((_a = cart.stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type) === 'external_paypal';
1567
1569
  return (index.h(index.Host, { class: "zonos--checkout-payment zonos--elements" }, index.h("div", { class: "zonos--group" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Payment method')), this.showErrorBanner && (index.h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, cart.translate('Missing required fields. Make sure all fields are completed.'))), cart.stripeStore.hasPaymentError && (index.h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, cart.translate("We couldn't complete your payment. Please verify the payment details and try again."))), paypal.paypalStore.paypalErrorMessage && (index.h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, paypal.paypalStore.paypalErrorMessage)), index.h("zonos-payment", null), index.h("div", { class: "zonos--group-btn" }, !isPaypalTabSelected && (index.h("zonos-button", { backgroundColor: this.submitBtnColor, loading: this.continueLoading, onClick: () => {
1568
- if (!hasPaypalEnabled) {
1569
- return;
1570
- }
1571
1570
  this.continueClickHandler();
1572
1571
  }, size: "lg",
1573
1572
  // use primary type when on mobile mode
@@ -2211,7 +2210,7 @@ const ZonosShipping = class {
2211
2210
  ...this.serviceLevelsDAP,
2212
2211
  ...this.serviceLevelsOther,
2213
2212
  ];
2214
- const selectedServiceLevel = allServiceLevels.find(item => { var _a; return item.value === ((_a = cart.cartStore.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.id); }) || null;
2213
+ const selectedServiceLevel = allServiceLevels.find(item => { var _a; return item.shipmentRatingId === ((_a = cart.cartStore.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.id); }) || null;
2215
2214
  if (selectedServiceLevel) {
2216
2215
  // keep the selected shipping method
2217
2216
  this.selectedShippingMethod = selectedServiceLevel;
@@ -2239,13 +2238,13 @@ const ZonosShipping = class {
2239
2238
  if (this.showErrorBanner) {
2240
2239
  this.showErrorBanner = !this.handleValidate();
2241
2240
  }
2242
- return (index.h(index.Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, index.h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, index.h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (index.h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !allServiceLevels.length ? (index.h("zonos-banner", { bannerTitle: cart.translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (index.h("div", { class: "zonos--shipping-options-wrapper" }, index.h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
2241
+ return (index.h(index.Host, { key: '9c866cd1545c3a695b449113a8dbe40560e5fe26', class: "zonos--shipping zonos--elements" }, index.h("div", { key: '7d683e7d7b2c3e25758240ac2299eac06b7f4a51', class: "zonos--group" }, index.h("zonos-text", { key: '5710e5185b2628e7793e59251073fdd8cb8cfd2e', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (index.h("zonos-banner", { key: 'afdd98898cb3305d90bfe06832a0b9f672183b47', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: '07543d3f7aec9494311d3cdb38306661d5789f4a', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !allServiceLevels.length ? (index.h("zonos-banner", { bannerTitle: cart.translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (index.h("div", { class: "zonos--shipping-options-wrapper" }, index.h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
2243
2242
  !!this.serviceLevelsDAP.length && (index.h("button", { class: classes.classes([
2244
2243
  'zonos--shipping-options-collapse-trigger',
2245
2244
  this.collapsedDAPOptions && 'collapsed',
2246
2245
  ]), onClick: () => {
2247
2246
  this.collapsedDAPOptions = !this.collapsedDAPOptions;
2248
- } }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${cart.translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), index.h("zonos-icon", { content: ChevronUpIcon })))), index.h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, index.h("div", { class: "zonos--dap-wrapper" }, index.h("zonos-banner", { bannerTitle: cart.translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, cart.translate('You may incur additional fees from the shipping carrier by not prepaying.')), index.h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), index.h("div", { key: '2dded1f7168a16ed6432ea0b147b8ec78fd774a6', class: "zonos--group-btn" }, index.h("zonos-button", { key: '54c05db9336209c34a7c7c518bbdf859e97b51f1', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
2247
+ } }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${cart.translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), index.h("zonos-icon", { content: ChevronUpIcon })))), index.h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, index.h("div", { class: "zonos--dap-wrapper" }, index.h("zonos-banner", { bannerTitle: cart.translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, cart.translate('You may incur additional fees from the shipping carrier by not prepaying.')), index.h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), index.h("div", { key: '7dc61c1435b40731463279f5824b60cf67e1470d', class: "zonos--group-btn" }, index.h("zonos-button", { key: 'eea4d432ad5cfb7001fcd0c7b795b2ee3ebbbac5', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
2249
2248
  // use primary type when on mobile mode
2250
2249
  variant: this.submitBtnType }, cart.translate('Go to payment'))))));
2251
2250
  }
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-e15290ab.js');
7
- const paypal = require('./paypal-47b71e3b.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
+ const paypal = require('./paypal-5c5f8d32.js');
8
8
  const zonosStore = require('./zonosStore-a4395972.js');
9
- const createCustomEvent = require('./createCustomEvent-3da45800.js');
9
+ const createCustomEvent = require('./createCustomEvent-94c259c7.js');
10
10
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
11
11
  const handleFetch = require('./handleFetch-45e76490.js');
12
12
  const classes = require('./classes-b7918f56.js');
@@ -435,18 +435,25 @@ const ZonosCheckout = class {
435
435
  */
436
436
  useLegacyQueryParams() {
437
437
  const urlParams = new URLSearchParams(window.location.search);
438
+ const getParam = (param) => {
439
+ const value = urlParams.get(param);
440
+ if (!value || value === 'undefined') {
441
+ return null;
442
+ }
443
+ return value;
444
+ };
438
445
  const legacyShippingInfo = {
439
446
  country:
440
447
  // fallback to selected country code if country is not provided
441
- urlParams.get('country') || cart.localizationStore.selectedCountryCode,
442
- customerAddress1: urlParams.get('customerAddress1'),
443
- customerAddress2: urlParams.get('customerAddress2'),
444
- customerCity: urlParams.get('customerCity'),
445
- customerEmail: urlParams.get('customerEmail'),
446
- customerName: urlParams.get('customerName'),
447
- customerPhone: urlParams.get('customerPhone'),
448
- customerState: urlParams.get('customerState'),
449
- customerZip: urlParams.get('customerZip'),
448
+ cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode,
449
+ customerAddress1: getParam('customerAddress1'),
450
+ customerAddress2: getParam('customerAddress2'),
451
+ customerCity: getParam('customerCity'),
452
+ customerEmail: getParam('customerEmail'),
453
+ customerName: getParam('customerName'),
454
+ customerPhone: getParam('customerPhone'),
455
+ customerState: getParam('customerState'),
456
+ customerZip: getParam('customerZip'),
450
457
  };
451
458
  // if one of the value is null, no need to preset the default address
452
459
  if (!legacyShippingInfo.customerAddress1 ||
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const handleFetch = require('./handleFetch-45e76490.js');
9
9
  require('./isDarkColor-5efc8367.js');
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  require('./handleFetch-45e76490.js');
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-5efc8367.js');
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-a4395972.js');
7
- const cart = require('./cart-e15290ab.js');
7
+ const cart = require('./cart-d456e0b8.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const handleFetch = require('./handleFetch-45e76490.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
@@ -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-e15290ab.js');
6
+ const cart = require('./cart-d456e0b8.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-45e76490.js');
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-a4395972.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const cart = require('./cart-e15290ab.js');
8
+ const cart = require('./cart-d456e0b8.js');
9
9
  const handleFetch = require('./handleFetch-45e76490.js');
10
- const paypal = require('./paypal-47b71e3b.js');
10
+ const paypal = require('./paypal-5c5f8d32.js');
11
11
  require('./isDarkColor-5efc8367.js');
12
12
  require('./getBorderRadius-5a64574c.js');
13
13
 
@@ -93,12 +93,15 @@ export class ZonosCheckoutFinish {
93
93
  };
94
94
  // TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
95
95
  this.getPullOrder = async (attempts = 0) => {
96
- var _a, _b, _c;
96
+ var _a, _b;
97
97
  const { baseUrl, order } = await this.pullOrder();
98
- const legacyOrderNumberExist = !!((_c = (_b = (_a = this.order) === null || _a === void 0 ? void 0 : _a.references) === null || _b === void 0 ? void 0 : _b.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _c === void 0 ? void 0 : _c.value);
99
- // legacy customers are still using the old order number so we need to wait for legacy order number to attach to dgs order before redirecting
100
- if ((order && attempts >= 5) || legacyOrderNumberExist) {
101
- if (!legacyOrderNumberExist) {
98
+ const { isLegacyCheckout } = window.Zonos;
99
+ const foundLegacyOrderNumber = !!((_b = (_a = order === null || order === void 0 ? void 0 : order.references) === null || _a === void 0 ? void 0 : _a.find(entry => (entry === null || entry === void 0 ? void 0 : entry.key) === 'zonosOrderNumber')) === null || _b === void 0 ? void 0 : _b.value);
100
+ if ((order && !isLegacyCheckout) ||
101
+ (!order && attempts >= 5) ||
102
+ foundLegacyOrderNumber) {
103
+ if (isLegacyCheckout && !foundLegacyOrderNumber) {
104
+ // We pushed this one through without the legacy order number, so we should log this
102
105
  const checkoutSessionId = cartStore.checkoutSessionId;
103
106
  void sendErrorLog({
104
107
  endpoint: `${baseUrl}/api/zonos-elements/get-order?checkoutSessionId=${checkoutSessionId}&orderId=${order === null || order === void 0 ? void 0 : order.id}`,
@@ -115,7 +118,7 @@ export class ZonosCheckoutFinish {
115
118
  this.order = order;
116
119
  this.handleSuccessBehavior();
117
120
  }
118
- else if ((!order || !legacyOrderNumberExist) && attempts < 5) {
121
+ else if ((!order || !foundLegacyOrderNumber) && attempts < 5) {
119
122
  // Wait for 1 second before the next attempt
120
123
  await new Promise(resolve => setTimeout(resolve, 1000));
121
124
  await this.getPullOrder(attempts + 1);
@@ -251,11 +254,11 @@ export class ZonosCheckoutFinish {
251
254
  var _a, _b;
252
255
  const orderId = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.accountOrderNumber) || getGraphQlShortId((_b = this.order) === null || _b === void 0 ? void 0 : _b.id);
253
256
  const isTestMode = getIsTestMode();
254
- return (h(Host, { key: '3c6c69c59622b7b2731f9bc6eb1cc8a7f3491572', class: "zonos--checkout-finish zonos--elements", style: {
257
+ return (h(Host, { key: '87ced5680c0d1bab551332541d74e8e32fd7ed43', class: "zonos--checkout-finish zonos--elements", style: {
255
258
  '--border-radius': getBorderRadius({
256
259
  overrideBorderStyle: this.borderRadius,
257
260
  }),
258
- } }, this.isLoading && (h("div", { key: '45ce0e608dca725237abc09295656c8b6471d26c', class: "loading-wrapper" }, h("zonos-spinner", { key: 'fd1a193d34ecf41af9bb6eff082c192c6a8d46db' }))), !this.isLoading && (h("div", { key: '64f652a419330967f13b9d01a172fcc52f6dfd5b', class: "zonos--finish-details" }, h("div", { key: '945cb9e55b418de79921c1995604572e6e009459', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '241bd7034c5ab5e83e4cedd526a181120a743ad0', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: '959595c1be3f65aa6cd2e00e4398c5bb4df702b6', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'a23dce69391c3abf49eb512e715af454c971977e', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: 'ce87734e2d46e8a044bc0ded7a6ed6a4a705685d', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: 'a46cee8819c83fb76a54dbe049ee2452b7fc150a', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '514fdff77f5aff9f4b9657a0579ab843833af7b0', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '59630cf7504c1ef9d24854d041b063bbfdc3a1a4', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
261
+ } }, this.isLoading && (h("div", { key: '8063a0e619af1958afc99e4a9aa8bdfeb3f3f896', class: "loading-wrapper" }, h("zonos-spinner", { key: '28d4219090e3c9cb0c8a48fa369ace28f74aa938' }))), !this.isLoading && (h("div", { key: '094b79103e3a26e57c0d81a1153682649dce693e', class: "zonos--finish-details" }, h("div", { key: 'c3a6fe214d5ac5cd58ec533c75e146e573b5da25', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'c9e1b5c7ed5be8b6adbd00e5b3896e023271976e', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), orderId && (h("div", { key: '8f32ef78f8e584e43988a12bc94f0d52c0348eba', class: "zonos--order-number" }, "Order #", orderId)), h("zonos-text", { key: 'b9aebf9fdfc17d141367deb110440272fed7a6d9', textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), h("zonos-button", { key: '25fb15e1e2fb08e2911c787060215f8e1d7c33c6', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText)), isTestMode && cartStore.step === 'finish' && (h("div", { key: 'd39ae7b5a0889278e0f6a3594ad69dfa0de2159a', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '09e0dfa830577c1eec035f34342528a73bffe944', backgroundColor: "gray-0", buttonColor: "gray-1200", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'eedb6a440713fe5f14a05a747284a2703af1a639', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
259
262
  }
260
263
  static get is() { return "zonos-checkout-finish"; }
261
264
  static get encapsulation() { return "shadow"; }
@@ -1,6 +1,6 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { cartStore } from "../../../store/checkout/cart";
3
- import { paypalStore, paypalStoreHasPaypalEnabled, } from "../../../store/checkout/paypal";
3
+ import { paypalStore } from "../../../store/checkout/paypal";
4
4
  import { stripeStore } from "../../../store/checkout/stripe";
5
5
  import { translate } from "../../../store/translationStore";
6
6
  import { getIsTestMode } from "../../../utils/checkout/getIsTestMode";
@@ -51,12 +51,8 @@ export class ZonosCheckoutPayment {
51
51
  this.showErrorBanner = !this.handleValidate();
52
52
  }
53
53
  const isTestMode = getIsTestMode();
54
- const hasPaypalEnabled = paypalStoreHasPaypalEnabled();
55
54
  const isPaypalTabSelected = ((_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type) === 'external_paypal';
56
55
  return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), stripeStore.hasPaymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), paypalStore.paypalErrorMessage && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, paypalStore.paypalErrorMessage)), h("zonos-payment", null), h("div", { class: "zonos--group-btn" }, !isPaypalTabSelected && (h("zonos-button", { backgroundColor: this.submitBtnColor, loading: this.continueLoading, onClick: () => {
57
- if (!hasPaypalEnabled) {
58
- return;
59
- }
60
56
  this.continueClickHandler();
61
57
  }, size: "lg",
62
58
  // use primary type when on mobile mode
@@ -15,6 +15,7 @@ import { watchBigcommerceDomesticCheckout } from "../../utils/checkout/watchBigc
15
15
  import { classes } from "../../utils/classes";
16
16
  import { createCustomEvent } from "../../utils/createCustomEvent";
17
17
  import { getBorderRadius } from "../../utils/getBorderRadius";
18
+ import { getZCountryUrlParam } from "../../utils/hello/getZCountryUrlParam";
18
19
  import { isDarkColor } from "../../utils/isDarkColor";
19
20
  import { allLogs, log } from "../../utils/logging/log";
20
21
  import { logError } from "../../utils/logging/logError";
@@ -23,7 +24,7 @@ import { mergeConfig } from "../../utils/mergeConfig";
23
24
  import { submitGtag } from "../../utils/submitGtag";
24
25
  import { setupCartData } from "../../../scripts/cart/_setupCartData";
25
26
  import { checkoutHiddenBtnSelector, domesticRedirectedBtnSelector, } from "../../../types/checkout/CheckoutConfig";
26
- /** These assets neet to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
27
+ /** These assets need to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
27
28
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
28
29
  import MessageIcon from "./assets/MessageIcon.svg";
29
30
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
@@ -281,18 +282,25 @@ export class ZonosCheckout {
281
282
  */
282
283
  useLegacyQueryParams() {
283
284
  const urlParams = new URLSearchParams(window.location.search);
285
+ const getParam = (param) => {
286
+ const value = urlParams.get(param);
287
+ if (!value || value === 'undefined') {
288
+ return null;
289
+ }
290
+ return value;
291
+ };
284
292
  const legacyShippingInfo = {
285
293
  country:
286
294
  // fallback to selected country code if country is not provided
287
- urlParams.get('country') || localizationStore.selectedCountryCode,
288
- customerAddress1: urlParams.get('customerAddress1'),
289
- customerAddress2: urlParams.get('customerAddress2'),
290
- customerCity: urlParams.get('customerCity'),
291
- customerEmail: urlParams.get('customerEmail'),
292
- customerName: urlParams.get('customerName'),
293
- customerPhone: urlParams.get('customerPhone'),
294
- customerState: urlParams.get('customerState'),
295
- customerZip: urlParams.get('customerZip'),
295
+ getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode,
296
+ customerAddress1: getParam('customerAddress1'),
297
+ customerAddress2: getParam('customerAddress2'),
298
+ customerCity: getParam('customerCity'),
299
+ customerEmail: getParam('customerEmail'),
300
+ customerName: getParam('customerName'),
301
+ customerPhone: getParam('customerPhone'),
302
+ customerState: getParam('customerState'),
303
+ customerZip: getParam('customerZip'),
296
304
  };
297
305
  // if one of the value is null, no need to preset the default address
298
306
  if (!legacyShippingInfo.customerAddress1 ||
@@ -118,7 +118,7 @@ export class ZonosShipping {
118
118
  ...this.serviceLevelsDAP,
119
119
  ...this.serviceLevelsOther,
120
120
  ];
121
- const selectedServiceLevel = allServiceLevels.find(item => { var _a; return item.value === ((_a = cartStore.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.id); }) || null;
121
+ const selectedServiceLevel = allServiceLevels.find(item => { var _a; return item.shipmentRatingId === ((_a = cartStore.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.id); }) || null;
122
122
  if (selectedServiceLevel) {
123
123
  // keep the selected shipping method
124
124
  this.selectedShippingMethod = selectedServiceLevel;
@@ -146,13 +146,13 @@ export class ZonosShipping {
146
146
  if (this.showErrorBanner) {
147
147
  this.showErrorBanner = !this.handleValidate();
148
148
  }
149
- return (h(Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !allServiceLevels.length ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
149
+ return (h(Host, { key: '9c866cd1545c3a695b449113a8dbe40560e5fe26', class: "zonos--shipping zonos--elements" }, h("div", { key: '7d683e7d7b2c3e25758240ac2299eac06b7f4a51', class: "zonos--group" }, h("zonos-text", { key: '5710e5185b2628e7793e59251073fdd8cb8cfd2e', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (h("zonos-banner", { key: 'afdd98898cb3305d90bfe06832a0b9f672183b47', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: '07543d3f7aec9494311d3cdb38306661d5789f4a', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !allServiceLevels.length ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
150
150
  !!this.serviceLevelsDAP.length && (h("button", { class: classes([
151
151
  'zonos--shipping-options-collapse-trigger',
152
152
  this.collapsedDAPOptions && 'collapsed',
153
153
  ]), onClick: () => {
154
154
  this.collapsedDAPOptions = !this.collapsedDAPOptions;
155
- } }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), h("div", { key: '2dded1f7168a16ed6432ea0b147b8ec78fd774a6', class: "zonos--group-btn" }, h("zonos-button", { key: '54c05db9336209c34a7c7c518bbdf859e97b51f1', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
155
+ } }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), h("div", { key: '7dc61c1435b40731463279f5824b60cf67e1470d', class: "zonos--group-btn" }, h("zonos-button", { key: 'eea4d432ad5cfb7001fcd0c7b795b2ee3ebbbac5', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
156
156
  // use primary type when on mobile mode
157
157
  variant: this.submitBtnType }, translate('Go to payment'))))));
158
158
  }