@zonos/elements 1.3.68 → 1.3.70

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 (149) hide show
  1. package/dist/cjs/{cart-8a585d9b.js → cart-11d066b2.js} +165 -56
  2. package/dist/cjs/{createCustomEvent-1ad96183.js → createCustomEvent-68af46cb.js} +1 -1
  3. package/dist/cjs/index.cjs.js +8 -8
  4. package/dist/cjs/{paypal-81274880.js → paypal-aa0570f4.js} +1 -1
  5. package/dist/cjs/zonos-address_8.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-badge_13.cjs.entry.js +14 -16
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +14 -10
  8. package/dist/cjs/zonos-controller.cjs.entry.js +5 -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/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -1
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +1 -1
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +11 -7
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +10 -12
  19. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +1 -1
  20. package/dist/collection/components/store/checkout/cart.js +31 -29
  21. package/dist/collection/components/store/checkout/stripe.js +9 -9
  22. package/dist/collection/components/store/translationStore/strings.arabic.js +6 -0
  23. package/dist/collection/components/store/translationStore/strings.base.js +6 -0
  24. package/dist/collection/components/store/translationStore/strings.chinese.js +6 -0
  25. package/dist/collection/components/store/translationStore/strings.danish.js +6 -0
  26. package/dist/collection/components/store/translationStore/strings.dutch.js +6 -0
  27. package/dist/collection/components/store/translationStore/strings.french.js +6 -0
  28. package/dist/collection/components/store/translationStore/strings.german.js +6 -0
  29. package/dist/collection/components/store/translationStore/strings.hebrew.js +6 -0
  30. package/dist/collection/components/store/translationStore/strings.indonesian.js +6 -0
  31. package/dist/collection/components/store/translationStore/strings.italian.js +6 -0
  32. package/dist/collection/components/store/translationStore/strings.japanese.js +6 -0
  33. package/dist/collection/components/store/translationStore/strings.korean.js +6 -0
  34. package/dist/collection/components/store/translationStore/strings.norwegian.js +6 -0
  35. package/dist/collection/components/store/translationStore/strings.polish.js +6 -0
  36. package/dist/collection/components/store/translationStore/strings.portuguese.js +6 -0
  37. package/dist/collection/components/store/translationStore/strings.russian.js +6 -0
  38. package/dist/collection/components/store/translationStore/strings.spanish.js +6 -0
  39. package/dist/collection/components/store/translationStore/strings.swedish.js +6 -0
  40. package/dist/collection/components/store/translationStore/strings.turkish.js +6 -0
  41. package/dist/collection/components/store/translationStore/strings.vietnamese.js +6 -0
  42. package/dist/collection/components/store/translationStore.js +3 -3
  43. package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +2 -1
  44. package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +3 -3
  45. package/dist/collection/components/utils/hello/initHello.js +4 -0
  46. package/dist/collection/scripts/_zonosBase.js +1 -1
  47. package/dist/collection/types/generated/graphql.customer.types.js +13 -0
  48. package/dist/esm/{cart-53bd48de.js → cart-7f82d6bf.js} +165 -56
  49. package/dist/esm/{createCustomEvent-0376082a.js → createCustomEvent-3a894453.js} +1 -1
  50. package/dist/esm/index.js +8 -8
  51. package/dist/esm/{paypal-09ebeb63.js → paypal-91a34d75.js} +1 -1
  52. package/dist/esm/zonos-address_8.entry.js +1 -1
  53. package/dist/esm/zonos-badge_13.entry.js +14 -16
  54. package/dist/esm/zonos-checkout.entry.js +14 -10
  55. package/dist/esm/zonos-controller.entry.js +5 -1
  56. package/dist/esm/zonos-country-flag.entry.js +1 -1
  57. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  58. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  59. package/dist/esm/zonos-hello.entry.js +1 -1
  60. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  61. package/dist/esm/zonos-notification_3.entry.js +2 -2
  62. package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -1
  63. package/dist/esm-es5/cart-7f82d6bf.js +1 -0
  64. package/dist/esm-es5/{createCustomEvent-0376082a.js → createCustomEvent-3a894453.js} +1 -1
  65. package/dist/esm-es5/index.js +1 -1
  66. package/dist/esm-es5/{paypal-09ebeb63.js → paypal-91a34d75.js} +1 -1
  67. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  68. package/dist/esm-es5/zonos-badge_13.entry.js +1 -1
  69. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  70. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  71. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  72. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  73. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  74. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  75. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  76. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  77. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  78. package/dist/scripts/index.d.ts +14 -10
  79. package/dist/scripts/index.js +1 -1
  80. package/dist/scripts/loadZonos.js +1 -1
  81. package/dist/scripts/zonos.js +1 -1
  82. package/dist/types/components/store/checkout/cart.d.ts +4 -5
  83. package/dist/types/components/store/checkout/stripe.d.ts +2 -2
  84. package/dist/types/components/store/translationStore/strings.arabic.d.ts +6 -0
  85. package/dist/types/components/store/translationStore/strings.base.d.ts +6 -0
  86. package/dist/types/components/store/translationStore/strings.chinese.d.ts +6 -0
  87. package/dist/types/components/store/translationStore/strings.danish.d.ts +6 -0
  88. package/dist/types/components/store/translationStore/strings.dutch.d.ts +6 -0
  89. package/dist/types/components/store/translationStore/strings.french.d.ts +6 -0
  90. package/dist/types/components/store/translationStore/strings.german.d.ts +6 -0
  91. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +6 -0
  92. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +6 -0
  93. package/dist/types/components/store/translationStore/strings.italian.d.ts +6 -0
  94. package/dist/types/components/store/translationStore/strings.japanese.d.ts +6 -0
  95. package/dist/types/components/store/translationStore/strings.korean.d.ts +6 -0
  96. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +6 -0
  97. package/dist/types/components/store/translationStore/strings.polish.d.ts +6 -0
  98. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +6 -0
  99. package/dist/types/components/store/translationStore/strings.russian.d.ts +6 -0
  100. package/dist/types/components/store/translationStore/strings.spanish.d.ts +6 -0
  101. package/dist/types/components/store/translationStore/strings.swedish.d.ts +6 -0
  102. package/dist/types/components/store/translationStore/strings.turkish.d.ts +6 -0
  103. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +6 -0
  104. package/dist/types/components/store/translationStore.d.ts +4 -3
  105. package/dist/types/types/generated/graphql.customer.types.d.ts +47 -37
  106. package/dist/types/types/generated/graphql.customer.types.ts +57 -40
  107. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  108. package/dist/zonos-elements/index.esm.js +1 -1
  109. package/dist/zonos-elements/{p-f3d02a32.js → p-11c9a75c.js} +1 -1
  110. package/dist/zonos-elements/{p-9a868fb6.entry.js → p-12fa5286.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-a58cb682.system.entry.js → p-2264efbe.system.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-05478b55.js → p-229f7399.js} +1 -1
  113. package/dist/zonos-elements/{p-d9c86ca5.system.entry.js → p-351f3207.system.entry.js} +1 -1
  114. package/dist/zonos-elements/p-3b904bf5.js +1 -0
  115. package/dist/zonos-elements/{p-bf8ae6bb.entry.js → p-3f0eb9df.entry.js} +1 -1
  116. package/dist/zonos-elements/p-43a5653e.system.entry.js +1 -0
  117. package/dist/zonos-elements/p-45dcfef2.system.js +1 -0
  118. package/dist/zonos-elements/{p-54bacb24.system.js → p-52c9d64e.system.js} +1 -1
  119. package/dist/zonos-elements/{p-3b1a5f38.entry.js → p-68e27f6d.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-917aced6.system.entry.js → p-70794698.system.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-b3eed5e5.system.js → p-7348fcb1.system.js} +1 -1
  122. package/dist/zonos-elements/{p-e2e28c07.system.entry.js → p-76faa16f.system.entry.js} +1 -1
  123. package/dist/zonos-elements/p-77b8c1b6.entry.js +1 -0
  124. package/dist/zonos-elements/p-7a4fc640.entry.js +1 -0
  125. package/dist/zonos-elements/{p-12ade4bb.system.entry.js → p-88a79bdb.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-9a5a403b.system.entry.js → p-96702555.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-0f90a98b.entry.js → p-a048ee0a.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-ef0913d2.system.entry.js → p-b2b52158.system.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-4a4ce63c.entry.js → p-c71c9fbd.entry.js} +1 -1
  130. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  131. package/dist/zonos-elements/{p-f8acfefd.system.entry.js → p-c93473ba.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-11bcfa61.system.entry.js → p-cc779ac1.system.entry.js} +1 -1
  133. package/dist/zonos-elements/p-d491eab9.system.entry.js +1 -0
  134. package/dist/zonos-elements/{p-6f087aaf.entry.js → p-d559e191.entry.js} +1 -1
  135. package/dist/zonos-elements/p-da400c8f.entry.js +1 -0
  136. package/dist/zonos-elements/{p-e7347556.entry.js → p-ddd3099b.entry.js} +1 -1
  137. package/dist/zonos-elements/p-fce17550.entry.js +1 -0
  138. package/dist/zonos-elements/{p-1d4b6884.system.js → p-fff15925.system.js} +1 -1
  139. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  140. package/package.json +1 -1
  141. package/dist/esm-es5/cart-53bd48de.js +0 -1
  142. package/dist/zonos-elements/p-12e3af70.system.entry.js +0 -1
  143. package/dist/zonos-elements/p-4baa8211.entry.js +0 -1
  144. package/dist/zonos-elements/p-5b0470ad.entry.js +0 -1
  145. package/dist/zonos-elements/p-aaa4693a.system.js +0 -1
  146. package/dist/zonos-elements/p-cfe17508.js +0 -1
  147. package/dist/zonos-elements/p-e3b0a988.entry.js +0 -1
  148. package/dist/zonos-elements/p-f4a27b43.entry.js +0 -1
  149. package/dist/zonos-elements/p-ff905aef.system.entry.js +0 -1
@@ -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-8a585d9b.js');
9
- const paypal = require('./paypal-81274880.js');
10
- const createCustomEvent = require('./createCustomEvent-1ad96183.js');
8
+ const cart = require('./cart-11d066b2.js');
9
+ const paypal = require('./paypal-aa0570f4.js');
10
+ const createCustomEvent = require('./createCustomEvent-68af46cb.js');
11
11
  const getBorderRadius = require('./getBorderRadius-5a64574c.js');
12
12
  const handleFetch = require('./handleFetch-661a8225.js');
13
13
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
@@ -179,7 +179,7 @@ const ZonosCartSubtotal = class {
179
179
  if (!cart.cartStore.selectedShippingOption) {
180
180
  return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.translate('Shipping')), index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.translate('No shipping method selected'))));
181
181
  }
182
- return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.cartStore.selectedShippingOption.displayName), cart.cartStore.selectedShippingOptionTransitTime && (index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.cartStore.selectedShippingOptionTransitTime, ' ', cart.translate('business days')))));
182
+ return (index.h(index.Fragment, null, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.cartStore.selectedShippingOption.displayName), cart.cartStore.selectedShippingOptionTransitTime && (index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.cartStore.selectedShippingOptionTransitTime))));
183
183
  };
184
184
  return (index.h(index.Host, { class: "zonos--cart-subtotal zonos--elements" }, index.h("table", { class: "zonos--cart-table" }, index.h("tr", { class: "zonos--row zonos--cart-subtotal" }, index.h("td", { class: "zonos--column" }), index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { type: "semiBoldLabel" }, cart.translate('Cart subtotal'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("zonos-text", { type: "semiBoldLabel" }, cart.currencyFormat({
185
185
  amount: subtotal,
@@ -1101,24 +1101,22 @@ const ZonosShipping = class {
1101
1101
  };
1102
1102
  this.initServiceLevels = () => {
1103
1103
  var _a;
1104
- const serviceLevels = ((_a = cart.cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.map((item) => {
1104
+ const serviceLevels = ((_a = cart.cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.flatMap(item => {
1105
1105
  var _a;
1106
- const { expectedDate, maxTransit, minTransit } = cart.cartStoreGetShippingTransitInfo(item);
1107
- const sublabel = expectedDate
1108
- ? `${cart.translate('Expected delivery')} ${expectedDate}`
1109
- : '';
1110
- const caption = minTransit && maxTransit
1111
- ? `(${minTransit}-${maxTransit} ${cart.translate('business days')})`
1112
- : '';
1106
+ const transitData = cart.cartStoreGetShippingTransitInfo(item);
1107
+ if (!transitData) {
1108
+ return [];
1109
+ }
1110
+ const { maxTransit, minTransit, unit } = transitData;
1111
+ const sublabel = minTransit && maxTransit ? `${minTransit}-${maxTransit} ${unit}` : '';
1113
1112
  const foundShipmentRating = (_a = cart.cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(landedCostItem => { var _a; return ((_a = landedCostItem.landedCost) === null || _a === void 0 ? void 0 : _a.shipmentRating.id) === item.id; });
1114
1113
  if (!foundShipmentRating) {
1115
1114
  // exclude shipping method if there is no matching landed cost data
1116
- return null;
1115
+ return [];
1117
1116
  }
1118
1117
  const shippingAmount = foundShipmentRating.subtotals.shipping;
1119
1118
  return {
1120
1119
  amount: shippingAmount,
1121
- caption,
1122
1120
  label: item.displayName,
1123
1121
  price: cart.currencyFormat({
1124
1122
  amount: shippingAmount,
@@ -1127,7 +1125,7 @@ const ZonosShipping = class {
1127
1125
  sublabel,
1128
1126
  value: item.id,
1129
1127
  };
1130
- }).filter(Boolean)) || [];
1128
+ })) || [];
1131
1129
  // sort service level by price
1132
1130
  this.serviceLevels = sortServiceLevelOptions(serviceLevels);
1133
1131
  };
@@ -1161,7 +1159,7 @@ const ZonosShipping = class {
1161
1159
  if (this.showErrorBanner) {
1162
1160
  this.showErrorBanner = !this.handleValidate();
1163
1161
  }
1164
- return (index.h(index.Host, { key: 'a00e5aa3844a5df009db0b2364d56700f37c2d20', class: "zonos--shipping zonos--elements" }, index.h("div", { key: 'b9037a08517557f2a5eb7d85fde9d8b551c196a5', class: "zonos--group" }, index.h("zonos-text", { key: '68fa391e9df29791eacff17af55d319bd5faafcf', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (index.h("zonos-banner", { key: '9bf0e9b1131c4412e5883c1706ae3152e7cdb13b', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: '32dcef256412bb41d6a05b579d0d2ce38b8bdf6a', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.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.'), intent: "error" })) : (index.h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), index.h("div", { key: '47dda4f3f44377fba5ae58dd704e9858b6b9c606', class: "zonos--group-btn" }, index.h("zonos-button", { key: 'ca4dca0f3f14926af5864fb935cb758f54238a00', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
1162
+ return (index.h(index.Host, { key: '44917386c8ec8a19f8eacb9d4e76b479adc2cd54', class: "zonos--shipping zonos--elements" }, index.h("div", { key: '9de59b5b3e7c8fe2f8b1e9a83c1ef6119106c2ca', class: "zonos--group" }, index.h("zonos-text", { key: '7ef2d5c73659c625e60197c3789ff8517a1f0d57', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (index.h("zonos-banner", { key: '9242f584733edb0af000a403a5f578e2859d5bd8', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: '1436b0da67bb61146af2bfbd72d9aea613114e69', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.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.'), intent: "error" })) : (index.h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), index.h("div", { key: '856d1e0d7ce8d85617774edd4e2bcc7e78cf29c7', class: "zonos--group-btn" }, index.h("zonos-button", { key: 'f89c93131977958205f60aa651a6eac19d9c102e', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
1165
1163
  // use primary type when on mobile mode
1166
1164
  variant: this.submitBtnType }, cart.translate('Go to payment'))))));
1167
1165
  }
@@ -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-8a585d9b.js');
7
- const paypal = require('./paypal-81274880.js');
6
+ const cart = require('./cart-11d066b2.js');
7
+ const paypal = require('./paypal-aa0570f4.js');
8
8
  const zonosStore = require('./zonosStore-a4395972.js');
9
- const createCustomEvent = require('./createCustomEvent-1ad96183.js');
9
+ const createCustomEvent = require('./createCustomEvent-68af46cb.js');
10
10
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
11
11
  const handleFetch = require('./handleFetch-661a8225.js');
12
12
  const classes = require('./classes-b7918f56.js');
@@ -182,7 +182,7 @@ const ZonosCheckout = class {
182
182
  var _a, _b, _c, _d;
183
183
  const theme = ((_a = this.appearanceSettingsOverride) === null || _a === void 0 ? void 0 : _a.theme) || zonosStore.zonosStore.appearance.theme;
184
184
  await cart.initStripeElements({
185
- overrideBorderRaidus: (_b = this.appearanceSettingsOverride) === null || _b === void 0 ? void 0 : _b.style,
185
+ overrideBorderRadius: (_b = this.appearanceSettingsOverride) === null || _b === void 0 ? void 0 : _b.style,
186
186
  overridePrimaryColor: (_c = this.appearanceSettingsOverride) === null || _c === void 0 ? void 0 : _c.colorPrimary,
187
187
  overrideSecondaryColor: (_d = this.appearanceSettingsOverride) === null || _d === void 0 ? void 0 : _d.colorSecondary,
188
188
  // only override theme or theme from appearance if it's mobile
@@ -314,7 +314,7 @@ const ZonosCheckout = class {
314
314
  attachCheckout() {
315
315
  const buttonAnchorSelector = zonosStore.zonosStore.checkoutSettings.placeOrderButtonSelector;
316
316
  handleFetch.log(`attach checkout ${buttonAnchorSelector}`);
317
- // allow to load checkout if cartData is ready (Checkout can be loaded right awaiy if tempCartUUID is in the URL)
317
+ // allow to load checkout if cartData is ready (Checkout can be loaded right away if tempCartUUID is in the URL)
318
318
  if (!buttonAnchorSelector && !window.Zonos.cartData) {
319
319
  // do nothing if button element is not found
320
320
  return;
@@ -350,7 +350,7 @@ const ZonosCheckout = class {
350
350
  cart.stripeStore.isFetchingSession = true;
351
351
  this.open = true;
352
352
  try {
353
- // buildCartDetail need to be catch since it may throw error
353
+ // buildCartDetail may throw an error
354
354
  const result = await this.buildCartAndInit();
355
355
  if (!result) {
356
356
  throw new Error('Error building cart');
@@ -474,12 +474,12 @@ const ZonosCheckout = class {
474
474
  },
475
475
  });
476
476
  /**
477
- * When temp cart data is available, set default address if exist
477
+ * When temp cart data is available, set default address if it exists
478
478
  */
479
479
  if (window.Zonos) {
480
480
  this.useLegacyQueryParam();
481
481
  }
482
- // only init checkout if visitor's country is in the shipping zones.
482
+ // only initialize checkout if visitor's country is in the shipping zones.
483
483
  const interval = setInterval(() => {
484
484
  cart.stripeStore.stripe = window.Zonos.stripe;
485
485
  this.stripe = window.Zonos.stripe;
@@ -495,7 +495,11 @@ const ZonosCheckout = class {
495
495
  if (this.preview || this.forceDialogOpen) {
496
496
  void this.buildCartAndInit();
497
497
  }
498
- else {
498
+ else if (window.Zonos.isLegacyCheckout) {
499
+ // With legacy checkout, avoid the mutation observer. We are using a hidden button to trigger checkout.
500
+ this.attachCheckout();
501
+ }
502
+ else if (window) {
499
503
  this.attachCheckout();
500
504
  // create a mutation observer to see if any new elements that match our selector is added to the DOM
501
505
  const observer = new MutationObserver(() => {
@@ -748,7 +752,7 @@ const ZonosCheckout = class {
748
752
  onConfirmClicked: () => this.closeDialogHandler({ confirmed: true }) }), index.h("zonos-confirm-dialog", { class: "zonos--inventory-check-failure-dialog", dialogConfirmBtnText: cart.translate('Return to cart'), dialogIntent: "danger",
749
753
  // Show dialog if inventory check error message is not null
750
754
  dialogOpen: !!cart.cartStore.inventoryCheckErrorMessage,
751
- // If diallog is in open state, the message should not be null
755
+ // If dialog is in open state, the message should not be null
752
756
  dialogSubtitle: cart.cartStore.inventoryCheckErrorMessage, dialogTitle: cart.translate("Couldn't place order"), dialogType: "alert", onCancelClicked: () => {
753
757
  this.handleInventoryCheckDialogCancel();
754
758
  },
@@ -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-8a585d9b.js');
6
+ const cart = require('./cart-11d066b2.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const handleFetch = require('./handleFetch-661a8225.js');
9
9
  require('./isDarkColor-5efc8367.js');
@@ -86,6 +86,10 @@ const injectDefaultWrapper = ({ position = 'bottom-right', }) => {
86
86
  return mobileAnchorSelector;
87
87
  };
88
88
  const initHello = async (helloSettings) => {
89
+ if (window.Zonos.isLegacyCheckout) {
90
+ handleFetch.log('Hello is disabled when isLegacyCheckout', 'info');
91
+ return;
92
+ }
89
93
  const { anchorElementSelector } = helloSettings;
90
94
  // default to mobile anchor if anchorElementSelector is not provided
91
95
  let helloAnchor = anchorElementSelector;
@@ -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-8a585d9b.js');
6
+ const cart = require('./cart-11d066b2.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  require('./handleFetch-661a8225.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-8a585d9b.js');
6
+ const cart = require('./cart-11d066b2.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-8a585d9b.js');
6
+ const cart = require('./cart-11d066b2.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-8a585d9b.js');
7
+ const cart = require('./cart-11d066b2.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const handleFetch = require('./handleFetch-661a8225.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-8a585d9b.js');
6
+ const cart = require('./cart-11d066b2.js');
7
7
  const zonosStore = require('./zonosStore-a4395972.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-661a8225.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-8a585d9b.js');
8
+ const cart = require('./cart-11d066b2.js');
9
9
  const handleFetch = require('./handleFetch-661a8225.js');
10
- const paypal = require('./paypal-81274880.js');
10
+ const paypal = require('./paypal-aa0570f4.js');
11
11
  require('./isDarkColor-5efc8367.js');
12
12
  require('./getBorderRadius-5a64574c.js');
13
13
 
@@ -55,7 +55,7 @@ const ZonosShippingRichRadio = class {
55
55
  return (index.h("div", { "aria-hidden": "true", class: classes.classes([
56
56
  'zonos--shipping-rich-radio-item',
57
57
  selected && 'selected',
58
- ]), onClick: () => this.handleRichRadioSelect(item) }, index.h("input", { checked: selected, class: "zonos--shipping-rich-radio-input", name: "zonos--shipping-rich-radio", type: "radio", value: item.value }), index.h("div", { class: "zonos--shipping-info" }, index.h("div", { class: "zonos--shipping-detail" }, index.h("zonos-text", { class: "zonos--shipping-label", type: "label" }, item.label)), index.h("zonos-text", { type: "semiBoldLabel" }, item.price))));
58
+ ]), onClick: () => this.handleRichRadioSelect(item) }, index.h("input", { checked: selected, class: "zonos--shipping-rich-radio-input", name: "zonos--shipping-rich-radio", type: "radio", value: item.value }), index.h("div", { class: "zonos--shipping-info" }, index.h("div", { class: "zonos--shipping-detail" }, index.h("zonos-text", { class: "zonos--shipping-label", type: "label" }, item.label), (item.sublabel || item.caption) && (index.h("div", { class: "zonos--sub-detail" }, item.sublabel && (index.h("zonos-text", { textColor: "gray-800" }, item.sublabel)), item.caption && (index.h("zonos-text", { textColor: "gray-600" }, item.caption))))), index.h("zonos-text", { type: "semiBoldLabel" }, item.price))));
59
59
  })));
60
60
  }
61
61
  };
@@ -15,7 +15,7 @@ export class ZonosCartSubtotal {
15
15
  if (!cartStore.selectedShippingOption) {
16
16
  return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Shipping')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('No shipping method selected'))));
17
17
  }
18
- return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cartStore.selectedShippingOption.displayName), cartStore.selectedShippingOptionTransitTime && (h("zonos-text", { class: "zonos--caption", type: "caption" }, cartStore.selectedShippingOptionTransitTime, ' ', translate('business days')))));
18
+ return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cartStore.selectedShippingOption.displayName), cartStore.selectedShippingOptionTransitTime && (h("zonos-text", { class: "zonos--caption", type: "caption" }, cartStore.selectedShippingOptionTransitTime))));
19
19
  };
20
20
  return (h(Host, { class: "zonos--cart-subtotal zonos--elements" }, h("table", { class: "zonos--cart-table" }, h("tr", { class: "zonos--row zonos--cart-subtotal" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { type: "semiBoldLabel" }, translate('Cart subtotal'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, currencyFormat({
21
21
  amount: subtotal,
@@ -38,7 +38,7 @@ export class ZonosCheckout {
38
38
  var _a, _b, _c, _d;
39
39
  const theme = ((_a = this.appearanceSettingsOverride) === null || _a === void 0 ? void 0 : _a.theme) || zonosStore.appearance.theme;
40
40
  await initStripeElements({
41
- overrideBorderRaidus: (_b = this.appearanceSettingsOverride) === null || _b === void 0 ? void 0 : _b.style,
41
+ overrideBorderRadius: (_b = this.appearanceSettingsOverride) === null || _b === void 0 ? void 0 : _b.style,
42
42
  overridePrimaryColor: (_c = this.appearanceSettingsOverride) === null || _c === void 0 ? void 0 : _c.colorPrimary,
43
43
  overrideSecondaryColor: (_d = this.appearanceSettingsOverride) === null || _d === void 0 ? void 0 : _d.colorSecondary,
44
44
  // only override theme or theme from appearance if it's mobile
@@ -170,7 +170,7 @@ export class ZonosCheckout {
170
170
  attachCheckout() {
171
171
  const buttonAnchorSelector = zonosStore.checkoutSettings.placeOrderButtonSelector;
172
172
  log(`attach checkout ${buttonAnchorSelector}`);
173
- // allow to load checkout if cartData is ready (Checkout can be loaded right awaiy if tempCartUUID is in the URL)
173
+ // allow to load checkout if cartData is ready (Checkout can be loaded right away if tempCartUUID is in the URL)
174
174
  if (!buttonAnchorSelector && !window.Zonos.cartData) {
175
175
  // do nothing if button element is not found
176
176
  return;
@@ -206,7 +206,7 @@ export class ZonosCheckout {
206
206
  stripeStore.isFetchingSession = true;
207
207
  this.open = true;
208
208
  try {
209
- // buildCartDetail need to be catch since it may throw error
209
+ // buildCartDetail may throw an error
210
210
  const result = await this.buildCartAndInit();
211
211
  if (!result) {
212
212
  throw new Error('Error building cart');
@@ -330,12 +330,12 @@ export class ZonosCheckout {
330
330
  },
331
331
  });
332
332
  /**
333
- * When temp cart data is available, set default address if exist
333
+ * When temp cart data is available, set default address if it exists
334
334
  */
335
335
  if (window.Zonos) {
336
336
  this.useLegacyQueryParam();
337
337
  }
338
- // only init checkout if visitor's country is in the shipping zones.
338
+ // only initialize checkout if visitor's country is in the shipping zones.
339
339
  const interval = setInterval(() => {
340
340
  stripeStore.stripe = window.Zonos.stripe;
341
341
  this.stripe = window.Zonos.stripe;
@@ -351,7 +351,11 @@ export class ZonosCheckout {
351
351
  if (this.preview || this.forceDialogOpen) {
352
352
  void this.buildCartAndInit();
353
353
  }
354
- else {
354
+ else if (window.Zonos.isLegacyCheckout) {
355
+ // With legacy checkout, avoid the mutation observer. We are using a hidden button to trigger checkout.
356
+ this.attachCheckout();
357
+ }
358
+ else if (window) {
355
359
  this.attachCheckout();
356
360
  // create a mutation observer to see if any new elements that match our selector is added to the DOM
357
361
  const observer = new MutationObserver(() => {
@@ -604,7 +608,7 @@ export class ZonosCheckout {
604
608
  onConfirmClicked: () => this.closeDialogHandler({ confirmed: true }) }), h("zonos-confirm-dialog", { class: "zonos--inventory-check-failure-dialog", dialogConfirmBtnText: translate('Return to cart'), dialogIntent: "danger",
605
609
  // Show dialog if inventory check error message is not null
606
610
  dialogOpen: !!cartStore.inventoryCheckErrorMessage,
607
- // If diallog is in open state, the message should not be null
611
+ // If dialog is in open state, the message should not be null
608
612
  dialogSubtitle: cartStore.inventoryCheckErrorMessage, dialogTitle: translate("Couldn't place order"), dialogType: "alert", onCancelClicked: () => {
609
613
  this.handleInventoryCheckDialogCancel();
610
614
  },
@@ -48,24 +48,22 @@ export class ZonosShipping {
48
48
  };
49
49
  this.initServiceLevels = () => {
50
50
  var _a;
51
- const serviceLevels = ((_a = cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.map((item) => {
51
+ const serviceLevels = ((_a = cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.flatMap(item => {
52
52
  var _a;
53
- const { expectedDate, maxTransit, minTransit } = cartStoreGetShippingTransitInfo(item);
54
- const sublabel = expectedDate
55
- ? `${translate('Expected delivery')} ${expectedDate}`
56
- : '';
57
- const caption = minTransit && maxTransit
58
- ? `(${minTransit}-${maxTransit} ${translate('business days')})`
59
- : '';
53
+ const transitData = cartStoreGetShippingTransitInfo(item);
54
+ if (!transitData) {
55
+ return [];
56
+ }
57
+ const { maxTransit, minTransit, unit } = transitData;
58
+ const sublabel = minTransit && maxTransit ? `${minTransit}-${maxTransit} ${unit}` : '';
60
59
  const foundShipmentRating = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(landedCostItem => { var _a; return ((_a = landedCostItem.landedCost) === null || _a === void 0 ? void 0 : _a.shipmentRating.id) === item.id; });
61
60
  if (!foundShipmentRating) {
62
61
  // exclude shipping method if there is no matching landed cost data
63
- return null;
62
+ return [];
64
63
  }
65
64
  const shippingAmount = foundShipmentRating.subtotals.shipping;
66
65
  return {
67
66
  amount: shippingAmount,
68
- caption,
69
67
  label: item.displayName,
70
68
  price: currencyFormat({
71
69
  amount: shippingAmount,
@@ -74,7 +72,7 @@ export class ZonosShipping {
74
72
  sublabel,
75
73
  value: item.id,
76
74
  };
77
- }).filter(Boolean)) || [];
75
+ })) || [];
78
76
  // sort service level by price
79
77
  this.serviceLevels = sortServiceLevelOptions(serviceLevels);
80
78
  };
@@ -108,7 +106,7 @@ export class ZonosShipping {
108
106
  if (this.showErrorBanner) {
109
107
  this.showErrorBanner = !this.handleValidate();
110
108
  }
111
- return (h(Host, { key: 'a00e5aa3844a5df009db0b2364d56700f37c2d20', class: "zonos--shipping zonos--elements" }, h("div", { key: 'b9037a08517557f2a5eb7d85fde9d8b551c196a5', class: "zonos--group" }, h("zonos-text", { key: '68fa391e9df29791eacff17af55d319bd5faafcf', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (h("zonos-banner", { key: '9bf0e9b1131c4412e5883c1706ae3152e7cdb13b', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: '32dcef256412bb41d6a05b579d0d2ce38b8bdf6a', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.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.'), intent: "error" })) : (h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), h("div", { key: '47dda4f3f44377fba5ae58dd704e9858b6b9c606', class: "zonos--group-btn" }, h("zonos-button", { key: 'ca4dca0f3f14926af5864fb935cb758f54238a00', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
109
+ return (h(Host, { key: '44917386c8ec8a19f8eacb9d4e76b479adc2cd54', class: "zonos--shipping zonos--elements" }, h("div", { key: '9de59b5b3e7c8fe2f8b1e9a83c1ef6119106c2ca', class: "zonos--group" }, h("zonos-text", { key: '7ef2d5c73659c625e60197c3789ff8517a1f0d57', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!((_a = this.serviceLevels) === null || _a === void 0 ? void 0 : _a.length) && (h("zonos-banner", { key: '9242f584733edb0af000a403a5f578e2859d5bd8', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: '1436b0da67bb61146af2bfbd72d9aea613114e69', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !((_b = this.serviceLevels) === null || _b === void 0 ? void 0 : _b.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.'), intent: "error" })) : (h("zonos-shipping-rich-radio", { initialSelectedValue: (_c = this.selectedShippingMethod) === null || _c === void 0 ? void 0 : _c.value, items: this.serviceLevels, onRadioSelected: e => this.handleRadioSelected(e) })), h("div", { key: '856d1e0d7ce8d85617774edd4e2bcc7e78cf29c7', class: "zonos--group-btn" }, h("zonos-button", { key: 'f89c93131977958205f60aa651a6eac19d9c102e', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
112
110
  // use primary type when on mobile mode
113
111
  variant: this.submitBtnType }, translate('Go to payment'))))));
114
112
  }
@@ -45,7 +45,7 @@ export class ZonosShippingRichRadio {
45
45
  return (h("div", { "aria-hidden": "true", class: classes([
46
46
  'zonos--shipping-rich-radio-item',
47
47
  selected && 'selected',
48
- ]), onClick: () => this.handleRichRadioSelect(item) }, h("input", { checked: selected, class: "zonos--shipping-rich-radio-input", name: "zonos--shipping-rich-radio", type: "radio", value: item.value }), h("div", { class: "zonos--shipping-info" }, h("div", { class: "zonos--shipping-detail" }, h("zonos-text", { class: "zonos--shipping-label", type: "label" }, item.label)), h("zonos-text", { type: "semiBoldLabel" }, item.price))));
48
+ ]), onClick: () => this.handleRichRadioSelect(item) }, h("input", { checked: selected, class: "zonos--shipping-rich-radio-input", name: "zonos--shipping-rich-radio", type: "radio", value: item.value }), h("div", { class: "zonos--shipping-info" }, h("div", { class: "zonos--shipping-detail" }, h("zonos-text", { class: "zonos--shipping-label", type: "label" }, item.label), (item.sublabel || item.caption) && (h("div", { class: "zonos--sub-detail" }, item.sublabel && (h("zonos-text", { textColor: "gray-800" }, item.sublabel)), item.caption && (h("zonos-text", { textColor: "gray-600" }, item.caption))))), h("zonos-text", { type: "semiBoldLabel" }, item.price))));
49
49
  })));
50
50
  }
51
51
  static get is() { return "zonos-shipping-rich-radio"; }
@@ -2,8 +2,6 @@ import { createStore } from "@stencil/store";
2
2
  import { stripeStore, stripeStoreReset, stripeStoreUpdateCheckoutSession, } from "./stripe";
3
3
  import { localizationStore } from "../hello/localization";
4
4
  import { translate } from "../translationStore";
5
- import { formatDate } from "../../utils/formatDate";
6
- import { getDaysDifference } from "../../utils/getDaysDifference";
7
5
  import { log } from "../../utils/logging/log";
8
6
  import { logError } from "../../utils/logging/logError";
9
7
  const { onChange, reset, state: cartStore, } = createStore(() => ({
@@ -56,6 +54,17 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
56
54
  },
57
55
  total: 0,
58
56
  }));
57
+ const getTransitUnit = (type) => {
58
+ switch (type) {
59
+ case 'DAYS':
60
+ return translate('days');
61
+ case 'WEEKS':
62
+ return translate('weeks');
63
+ case 'BUSINESS_DAYS':
64
+ default:
65
+ return translate('business days');
66
+ }
67
+ };
59
68
  /**
60
69
  * Format shipping transit info to be displayed on UI
61
70
  * @returns
@@ -64,21 +73,16 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
64
73
  * - minTransit: 3
65
74
  */
66
75
  const cartStoreGetShippingTransitInfo = (item) => {
67
- const minTransit = item.minTransitAt
68
- ? getDaysDifference(new Date(item.minTransitAt))
69
- : '';
70
- const maxTransit = item.maxTransitAt
71
- ? getDaysDifference(new Date(item.maxTransitAt))
72
- : '';
73
- const expectedDate = item.minTransitAt
74
- ? formatDate({
75
- date: new Date(item.minTransitAt),
76
- })
77
- : '';
76
+ var _a;
77
+ const transitTime = (_a = item.shippingProfile) === null || _a === void 0 ? void 0 : _a.transitTime;
78
+ // Don't care about falsy 0 values because this is international shipping and 0 days is not feasible
79
+ if (!(transitTime === null || transitTime === void 0 ? void 0 : transitTime.min) || !(transitTime === null || transitTime === void 0 ? void 0 : transitTime.max) || !(transitTime === null || transitTime === void 0 ? void 0 : transitTime.type)) {
80
+ return null;
81
+ }
78
82
  return {
79
- expectedDate,
80
- maxTransit,
81
- minTransit,
83
+ maxTransit: transitTime.max,
84
+ minTransit: transitTime.min,
85
+ unit: getTransitUnit(transitTime.type),
82
86
  };
83
87
  };
84
88
  const getMatchItem = ({ item1, item2, }) => {
@@ -191,7 +195,7 @@ const cartStoreReCalculateTotal = async ({ adjustmentAmount, cartId, currency, i
191
195
  return false;
192
196
  }
193
197
  if (!landedCostId) {
194
- // This is when first open the checkout modal and we just want to get info from the old cart session.
198
+ // This is when we first open the checkout modal and we just want to get info from the old cart session.
195
199
  // use subtotals from checkout session to update cart total
196
200
  cartStoreApplySubtotals(json.checkoutSessionUpdate.subtotals);
197
201
  log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
@@ -203,12 +207,11 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption) =>
203
207
  var _a, _b, _c, _d, _e;
204
208
  cartStore.selectedShippingOption = selectedShippingOption;
205
209
  // update shipping transit info
206
- const { expectedDate, maxTransit, minTransit } = cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);
207
- cartStore.selectedShippingOptionExpectedDate = expectedDate;
208
- cartStore.selectedShippingOptionTransitTime =
209
- minTransit && maxTransit
210
- ? `${minTransit}-${maxTransit}`
211
- : `${minTransit || maxTransit}`;
210
+ const transitData = cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);
211
+ if (transitData) {
212
+ const { maxTransit, minTransit, unit } = transitData;
213
+ cartStore.selectedShippingOptionTransitTime = `${minTransit}-${maxTransit} ${unit}`;
214
+ }
212
215
  const selectedLandedCost = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(checkoutSessionPresentment => {
213
216
  var _a, _b, _c;
214
217
  return ((_b = (_a = checkoutSessionPresentment.landedCost) === null || _a === void 0 ? void 0 : _a.shipmentRating) === null || _b === void 0 ? void 0 : _b.id) ===
@@ -229,12 +232,12 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption) =>
229
232
  cartStore.isSelectedShippingAboveDeminimis = isAboveDeminimis;
230
233
  cartStore.isSelectedShippingGuarantee = isGuarantee;
231
234
  // update session with selected landed cost
232
- const updateCalulateStatus = await cartStoreReCalculateTotal({
235
+ const updateCalculateStatus = await cartStoreReCalculateTotal({
233
236
  adjustmentAmount: cartStore.adjustmentTotal,
234
237
  cartId: window.Zonos.cartId,
235
238
  landedCostId: (_e = selectedLandedCost.landedCost) === null || _e === void 0 ? void 0 : _e.id,
236
239
  });
237
- return updateCalulateStatus;
240
+ return updateCalculateStatus;
238
241
  };
239
242
  onChange('checkoutSessionId', () => {
240
243
  if (!cartStore.checkoutSessionId) {
@@ -280,16 +283,16 @@ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
280
283
  const total = cartItems.reduce((amt, item) => {
281
284
  return amt + item.amount * item.quantity;
282
285
  }, 0);
283
- const adjustmenTotal = adjustments.reduce((amt, adjustment) => amt + adjustment.amount, 0);
286
+ const adjustmentTotal = adjustments.reduce((amt, adjustment) => amt + adjustment.amount, 0);
284
287
  if (!currency || !total) {
285
288
  // do nothing if we can't get currency or total
286
289
  return;
287
290
  }
288
291
  cartStore.currency = currency;
289
- // set loading state here because this is first load checkout session when we already have checkout session id stored
292
+ // set loading state here because this is the first load checkout session when we already have checkout session id stored
290
293
  stripeStore.isFetchingSession = true;
291
294
  await cartStoreReCalculateTotal({
292
- adjustmentAmount: adjustmenTotal,
295
+ adjustmentAmount: adjustmentTotal,
293
296
  cartId: window.Zonos.cartId,
294
297
  currency: currency,
295
298
  itemsAmount: total,
@@ -300,7 +303,6 @@ const cartStoreResetSelectedShippingOption = () => {
300
303
  cartStore.selectedShippingOption = null;
301
304
  cartStore.isSelectedShippingAboveDeminimis = false;
302
305
  cartStore.isSelectedShippingGuarantee = false;
303
- cartStore.selectedShippingOptionExpectedDate = '';
304
306
  cartStore.selectedShippingOptionTransitTime = '';
305
307
  cartStore.dutiesTaxFees = 0;
306
308
  cartStore.shipping = 0;
@@ -14,7 +14,7 @@ import { addressRuleStyle } from "../../../styles/stripe/addressRuleStyle";
14
14
  import { defaultVariable } from "../../../styles/stripe/defaultVariable";
15
15
  const { onChange, reset, state: stripeStore, } = createStore(() => ({
16
16
  clientSecret: sessionStorage.getItem('zonos--client-secret') || null,
17
- fetchingLandedCostAbordController: null,
17
+ fetchingLandedCostAbortController: null,
18
18
  hasPaymentError: false,
19
19
  isFetchingLandedCost: false,
20
20
  isFetchingSession: false,
@@ -44,7 +44,7 @@ const { onChange, reset, state: stripeStore, } = createStore(() => ({
44
44
  name: {},
45
45
  },
46
46
  }));
47
- const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideSecondaryColor, overrideTheme, }) => {
47
+ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryColor, overrideSecondaryColor, overrideTheme, }) => {
48
48
  const primaryColor = overridePrimaryColor || zonosStore.appearance.colorPrimary;
49
49
  const secondaryColor = overrideSecondaryColor || zonosStore.appearance.colorSecondary;
50
50
  const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
@@ -57,7 +57,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryC
57
57
  // get contrast theme color base on primary color
58
58
  theme: overrideTheme ? theme : themeBasedColor,
59
59
  variables: Object.assign(Object.assign({}, defaultVariable({
60
- borderStyle: overrideBorderRaidus,
60
+ borderStyle: overrideBorderRadius,
61
61
  theme: 'LIGHT',
62
62
  })), {
63
63
  // use the button background color for input glow color
@@ -89,7 +89,7 @@ const initStripeElements = async (props) => {
89
89
  if (clientSecret) {
90
90
  const stripeOptions = getStripeOptions({
91
91
  clientSecret,
92
- overrideBorderRaidus: props === null || props === void 0 ? void 0 : props.overrideBorderRaidus,
92
+ overrideBorderRadius: props === null || props === void 0 ? void 0 : props.overrideBorderRadius,
93
93
  overridePrimaryColor: props === null || props === void 0 ? void 0 : props.overridePrimaryColor,
94
94
  overrideSecondaryColor: props === null || props === void 0 ? void 0 : props.overrideSecondaryColor,
95
95
  overrideTheme: props === null || props === void 0 ? void 0 : props.overrideTheme,
@@ -173,8 +173,8 @@ const stripeStorePrefetchLandedCost = async () => {
173
173
  const shouldRefetch = isPrefetchInfoOutdated();
174
174
  if (shouldRefetch) {
175
175
  // if the info used when fetching landed cost is different from the current info, abort the previous request
176
- (_e = stripeStore.fetchingLandedCostAbordController) === null || _e === void 0 ? void 0 : _e.abort();
177
- stripeStore.fetchingLandedCostAbordController = null;
176
+ (_e = stripeStore.fetchingLandedCostAbortController) === null || _e === void 0 ? void 0 : _e.abort();
177
+ stripeStore.fetchingLandedCostAbortController = null;
178
178
  }
179
179
  // only fetch if we are not fetching or we need to refetch
180
180
  if (stripeAddressReady &&
@@ -193,12 +193,12 @@ const stripeStorePrefetchLandedCost = async () => {
193
193
  }
194
194
  try {
195
195
  const abortController = new AbortController();
196
- stripeStore.fetchingLandedCostAbordController = abortController;
196
+ stripeStore.fetchingLandedCostAbortController = abortController;
197
197
  // Reset cart items to non-restricted state and restricted item list
198
198
  cartStoreResetCartItems();
199
199
  const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
200
200
  // reset abort controller after we are done
201
- stripeStore.fetchingLandedCostAbordController = null;
201
+ stripeStore.fetchingLandedCostAbortController = null;
202
202
  // update cart store with landed cost info
203
203
  cartStore.landedCostData =
204
204
  (checkoutSessionWorkflow === null || checkoutSessionWorkflow === void 0 ? void 0 : checkoutSessionWorkflow.map(checkoutSession => {
@@ -321,7 +321,7 @@ const stripeStoreConfirmPayment = async () => {
321
321
  const stripe = stripeStore.stripe;
322
322
  const stripeClientSecret = stripeStore.clientSecret;
323
323
  if (!((_b = cartStore.selectedLandedCost) === null || _b === void 0 ? void 0 : _b.landedCost.id)) {
324
- throw new Error('Attemped to confirm the payment when no landed cost is found in store');
324
+ throw new Error('Attempted to confirm the payment when no landed cost is found in store');
325
325
  }
326
326
  if (stripe && stripeElements && stripePaymentReady && stripeClientSecret) {
327
327
  const { error } = await stripe.confirmPayment({
@@ -344,10 +344,16 @@ export const stringsArabic = {
344
344
  'click to learn more': {
345
345
  value: 'انقر لمعرفة المزيد',
346
346
  },
347
+ days: {
348
+ value: 'أيام',
349
+ },
347
350
  or: {
348
351
  value: 'أو',
349
352
  },
350
353
  'restricted items': {
351
354
  value: 'عناصر مقيدة',
352
355
  },
356
+ weeks: {
357
+ value: 'أسابيع',
358
+ },
353
359
  };