@zonos/elements 1.3.82 → 1.3.84

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 (166) hide show
  1. package/dist/cjs/{cart-ba540c8e.js → cart-a06f18e2.js} +462 -18
  2. package/dist/cjs/{createCustomEvent-1fd24ad8.js → createCustomEvent-8d9cf9ac.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-6bbe55a7.js → paypal-078f3cef.js} +1 -1
  6. package/dist/cjs/{zonos-address_8.cjs.entry.js → zonos-address_7.cjs.entry.js} +3 -58
  7. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +99 -29
  8. package/dist/cjs/zonos-checkout.cjs.entry.js +10 -8
  9. package/dist/cjs/zonos-collapse.cjs.entry.js +62 -0
  10. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-elements.cjs.js +1 -1
  14. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -11
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -6
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +3 -1
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +7 -3
  22. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/assets/ChevronUpIcon.svg +23 -0
  23. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +55 -9
  24. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +57 -16
  25. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +20 -27
  26. package/dist/collection/components/store/checkout/cart.js +28 -11
  27. package/dist/collection/components/store/checkout/stripe.js +5 -4
  28. package/dist/collection/components/store/hello/localization.js +5 -1
  29. package/dist/collection/components/store/translationStore/strings.arabic.js +21 -0
  30. package/dist/collection/components/store/translationStore/strings.base.js +21 -0
  31. package/dist/collection/components/store/translationStore/strings.chinese.js +21 -0
  32. package/dist/collection/components/store/translationStore/strings.danish.js +21 -0
  33. package/dist/collection/components/store/translationStore/strings.dutch.js +21 -0
  34. package/dist/collection/components/store/translationStore/strings.french.js +22 -1
  35. package/dist/collection/components/store/translationStore/strings.german.js +22 -1
  36. package/dist/collection/components/store/translationStore/strings.hebrew.js +22 -1
  37. package/dist/collection/components/store/translationStore/strings.indonesian.js +21 -0
  38. package/dist/collection/components/store/translationStore/strings.italian.js +21 -0
  39. package/dist/collection/components/store/translationStore/strings.japanese.js +21 -0
  40. package/dist/collection/components/store/translationStore/strings.korean.js +21 -0
  41. package/dist/collection/components/store/translationStore/strings.norwegian.js +21 -0
  42. package/dist/collection/components/store/translationStore/strings.polish.js +21 -0
  43. package/dist/collection/components/store/translationStore/strings.portuguese.js +21 -0
  44. package/dist/collection/components/store/translationStore/strings.russian.js +22 -1
  45. package/dist/collection/components/store/translationStore/strings.spanish.js +21 -0
  46. package/dist/collection/components/store/translationStore/strings.swedish.js +21 -0
  47. package/dist/collection/components/store/translationStore/strings.turkish.js +21 -0
  48. package/dist/collection/components/store/translationStore/strings.vietnamese.js +21 -0
  49. package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -3
  50. package/dist/collection/components/utils/checkout/isDisabledCountry.js +0 -2
  51. package/dist/collection/components/utils/checkout/isShippableCountry.js +0 -2
  52. package/dist/collection/components/utils/checkout/{sortServiceLevelOptions.js → sortServiceLevelOptionsByAmount.js} +1 -1
  53. package/dist/esm/{cart-7df78f9f.js → cart-40e0d619.js} +461 -19
  54. package/dist/esm/{createCustomEvent-fcec608e.js → createCustomEvent-1f615c82.js} +1 -1
  55. package/dist/esm/index.js +7 -7
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/{paypal-a27aad03.js → paypal-a45fb0bb.js} +1 -1
  58. package/dist/esm/{zonos-address_8.entry.js → zonos-address_7.entry.js} +4 -58
  59. package/dist/esm/zonos-cart-items_12.entry.js +99 -29
  60. package/dist/esm/zonos-checkout.entry.js +10 -8
  61. package/dist/esm/zonos-collapse.entry.js +58 -0
  62. package/dist/esm/zonos-controller.entry.js +1 -1
  63. package/dist/esm/zonos-country-flag.entry.js +1 -1
  64. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  65. package/dist/esm/zonos-elements.js +1 -1
  66. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  67. package/dist/esm/zonos-hello.entry.js +1 -1
  68. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  69. package/dist/esm/zonos-notification_3.entry.js +2 -2
  70. package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -11
  71. package/dist/esm-es5/cart-40e0d619.js +1 -0
  72. package/dist/esm-es5/{createCustomEvent-fcec608e.js → createCustomEvent-1f615c82.js} +1 -1
  73. package/dist/esm-es5/index.js +1 -1
  74. package/dist/esm-es5/loader.js +1 -1
  75. package/dist/esm-es5/{paypal-a27aad03.js → paypal-a45fb0bb.js} +1 -1
  76. package/dist/esm-es5/zonos-address_7.entry.js +1 -0
  77. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  78. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  79. package/dist/esm-es5/zonos-collapse.entry.js +1 -0
  80. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  81. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  82. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  83. package/dist/esm-es5/zonos-elements.js +1 -1
  84. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  85. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  86. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  87. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  88. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  89. package/dist/scripts/index.d.ts +499 -496
  90. package/dist/scripts/index.js +1 -1
  91. package/dist/scripts/loadZonos.js +1 -1
  92. package/dist/scripts/zonos.js +1 -1
  93. package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +4 -1
  94. package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts +2 -6
  95. package/dist/types/components/store/checkout/cart.d.ts +9 -7
  96. package/dist/types/components/store/hello/localization.d.ts +4 -0
  97. package/dist/types/components/store/translationStore/strings.arabic.d.ts +21 -0
  98. package/dist/types/components/store/translationStore/strings.base.d.ts +21 -0
  99. package/dist/types/components/store/translationStore/strings.chinese.d.ts +21 -0
  100. package/dist/types/components/store/translationStore/strings.danish.d.ts +21 -0
  101. package/dist/types/components/store/translationStore/strings.dutch.d.ts +21 -0
  102. package/dist/types/components/store/translationStore/strings.french.d.ts +21 -0
  103. package/dist/types/components/store/translationStore/strings.german.d.ts +21 -0
  104. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +21 -0
  105. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +21 -0
  106. package/dist/types/components/store/translationStore/strings.italian.d.ts +21 -0
  107. package/dist/types/components/store/translationStore/strings.japanese.d.ts +21 -0
  108. package/dist/types/components/store/translationStore/strings.korean.d.ts +21 -0
  109. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +21 -0
  110. package/dist/types/components/store/translationStore/strings.polish.d.ts +21 -0
  111. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +21 -0
  112. package/dist/types/components/store/translationStore/strings.russian.d.ts +21 -0
  113. package/dist/types/components/store/translationStore/strings.spanish.d.ts +21 -0
  114. package/dist/types/components/store/translationStore/strings.swedish.d.ts +21 -0
  115. package/dist/types/components/store/translationStore/strings.turkish.d.ts +21 -0
  116. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +21 -0
  117. package/dist/types/components/store/translationStore.d.ts +1 -1
  118. package/dist/types/components/utils/checkout/{sortServiceLevelOptions.d.ts → sortServiceLevelOptionsByAmount.d.ts} +1 -1
  119. package/dist/types/components.d.ts +10 -8
  120. package/dist/zonos-elements/index.esm.js +1 -1
  121. package/dist/zonos-elements/{p-cd17565d.entry.js → p-019b202c.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-a4cdd4f2.entry.js → p-0a15de43.entry.js} +1 -1
  123. package/dist/zonos-elements/{p-2024313c.js → p-1348c46d.js} +1 -1
  124. package/dist/zonos-elements/p-181de82e.entry.js +1 -0
  125. package/dist/zonos-elements/p-189a2cae.entry.js +1 -0
  126. package/dist/zonos-elements/{p-957b1c1b.system.js → p-3d9a0e52.system.js} +1 -1
  127. package/dist/zonos-elements/{p-4683797b.system.js → p-47d5a081.system.js} +1 -1
  128. package/dist/zonos-elements/p-4abca0e9.system.entry.js +1 -0
  129. package/dist/zonos-elements/{p-4e06a2bb.system.entry.js → p-5d325c13.system.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-5d4bde9c.system.entry.js → p-5ef15d65.system.entry.js} +1 -1
  131. package/dist/zonos-elements/{p-df83e30b.entry.js → p-60c543e7.entry.js} +1 -1
  132. package/dist/zonos-elements/p-7096814b.system.entry.js +1 -0
  133. package/dist/zonos-elements/{p-43e2de45.system.entry.js → p-78ca17aa.system.entry.js} +1 -1
  134. package/dist/zonos-elements/{p-cfd53396.entry.js → p-9013751a.entry.js} +1 -1
  135. package/dist/zonos-elements/p-9367aeca.system.entry.js +1 -0
  136. package/dist/zonos-elements/p-9931bea7.system.entry.js +1 -0
  137. package/dist/zonos-elements/{p-d48f3bd3.system.entry.js → p-ac6562c7.system.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-2d2edb5a.system.entry.js → p-b1381434.system.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-acabfc47.js → p-b39b794a.js} +1 -1
  140. package/dist/zonos-elements/p-ba10b830.entry.js +1 -0
  141. package/dist/zonos-elements/p-c1fbe220.js +1 -0
  142. package/dist/zonos-elements/{p-4097a25b.system.entry.js → p-c224f43a.system.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-b09c3702.entry.js → p-c3314b3b.entry.js} +1 -1
  144. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  145. package/dist/zonos-elements/p-cec3e1ed.entry.js +1 -0
  146. package/dist/zonos-elements/p-d043cf10.system.entry.js +1 -0
  147. package/dist/zonos-elements/{p-bf84416a.entry.js → p-d31368f1.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-15651b06.system.js → p-e2adfe87.system.js} +1 -1
  149. package/dist/zonos-elements/{p-112a969c.entry.js → p-e563eb3f.entry.js} +1 -1
  150. package/dist/zonos-elements/p-e6f2948c.system.js +1 -0
  151. package/dist/zonos-elements/{p-59806a8e.system.entry.js → p-ec8ff301.system.entry.js} +1 -1
  152. package/dist/zonos-elements/p-f1e452e1.entry.js +1 -0
  153. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  154. package/package.json +1 -1
  155. package/dist/esm-es5/cart-7df78f9f.js +0 -1
  156. package/dist/esm-es5/zonos-address_8.entry.js +0 -1
  157. package/dist/zonos-elements/p-270cc182.system.entry.js +0 -1
  158. package/dist/zonos-elements/p-2c5e2163.entry.js +0 -1
  159. package/dist/zonos-elements/p-85600e22.system.entry.js +0 -1
  160. package/dist/zonos-elements/p-8dd38974.entry.js +0 -1
  161. package/dist/zonos-elements/p-8fd6ae63.js +0 -1
  162. package/dist/zonos-elements/p-a1c5c1a2.entry.js +0 -1
  163. package/dist/zonos-elements/p-aa899bf7.entry.js +0 -1
  164. package/dist/zonos-elements/p-cffe7cc8.system.entry.js +0 -1
  165. package/dist/zonos-elements/p-e7eb0a92.system.js +0 -1
  166. package/dist/zonos-elements/p-f4667002.system.entry.js +0 -1
@@ -7,7 +7,6 @@ export class ZonosShippingRichRadio {
7
7
  constructor() {
8
8
  this.handleRichRadioSelect = (item) => {
9
9
  var _a;
10
- this.selectedItem = item;
11
10
  (_a = this.radioSelected) === null || _a === void 0 ? void 0 : _a.emit(item);
12
11
  };
13
12
  this.getRadioItemStyleVariables = () => {
@@ -26,20 +25,11 @@ export class ZonosShippingRichRadio {
26
25
  this.borderColor = undefined;
27
26
  this.borderStyle = undefined;
28
27
  this.theme = undefined;
29
- this.initialSelectedValue = undefined;
30
28
  this.selectedItem = null;
31
29
  }
32
- componentWillLoad() {
33
- // Set initial selected item
34
- if (this.initialSelectedValue) {
35
- this.selectedItem =
36
- this.items.find(item => item.value === this.initialSelectedValue) ||
37
- null;
38
- }
39
- }
40
30
  render() {
41
31
  var _a;
42
- return (h(Host, { key: '83ee4ddc5ad32514ca98457812207964cf452217', class: "zonos--shipping-rich-radio zonos--elements", "data-theme": this.theme, style: Object.assign(Object.assign({}, this.getRadioItemStyleVariables()), { '--font-family': zonosStoreFontFamily() }) }, (_a = this.items) === null || _a === void 0 ? void 0 : _a.map(item => {
32
+ return (h(Host, { key: '74cb16ff6cfde65b626ef902c456b967af649f6d', class: "zonos--shipping-rich-radio zonos--elements", "data-theme": this.theme, style: Object.assign(Object.assign({}, this.getRadioItemStyleVariables()), { '--font-family': zonosStoreFontFamily() }) }, (_a = this.items) === null || _a === void 0 ? void 0 : _a.map(item => {
43
33
  var _a;
44
34
  const selected = ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.value) === item.value;
45
35
  return (h("div", { "aria-hidden": "true", class: classes([
@@ -152,30 +142,33 @@ export class ZonosShippingRichRadio {
152
142
  "attribute": "theme",
153
143
  "reflect": false
154
144
  },
155
- "initialSelectedValue": {
156
- "type": "any",
145
+ "selectedItem": {
146
+ "type": "unknown",
157
147
  "mutable": false,
158
148
  "complexType": {
159
- "original": "string | number",
160
- "resolved": "number | string | undefined",
161
- "references": {}
149
+ "original": "ShippingRichRadioItem | null",
150
+ "resolved": "null | { amount: number; caption?: string | undefined; label: string; landedCostId: string; method: IncotermCode; price: string; shipmentRatingId: string; sublabel?: string | undefined; value: string | number; }",
151
+ "references": {
152
+ "ShippingRichRadioItem": {
153
+ "location": "local",
154
+ "path": "/home/runner/work/zonos-elements/zonos-elements/src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx",
155
+ "id": "src/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.tsx::ShippingRichRadioItem"
156
+ }
157
+ }
162
158
  },
163
159
  "required": false,
164
- "optional": true,
160
+ "optional": false,
165
161
  "docs": {
166
- "tags": [],
167
- "text": "Initial selected value"
162
+ "tags": [{
163
+ "name": "default",
164
+ "text": "{null|firstItem}"
165
+ }],
166
+ "text": "Selected item"
168
167
  },
169
- "attribute": "initial-selected-value",
170
- "reflect": false
168
+ "defaultValue": "null"
171
169
  }
172
170
  };
173
171
  }
174
- static get states() {
175
- return {
176
- "selectedItem": {}
177
- };
178
- }
179
172
  static get events() {
180
173
  return [{
181
174
  "method": "radioSelected",
@@ -189,7 +182,7 @@ export class ZonosShippingRichRadio {
189
182
  },
190
183
  "complexType": {
191
184
  "original": "ShippingRichRadioItem",
192
- "resolved": "{ amount: number; caption?: string | undefined; label: string; landedCostId: string; price: string; shipmentRatingId: string; sublabel?: string | undefined; value: string | number; }",
185
+ "resolved": "{ amount: number; caption?: string | undefined; label: string; landedCostId: string; method: IncotermCode; price: string; shipmentRatingId: string; sublabel?: string | undefined; value: string | number; }",
193
186
  "references": {
194
187
  "ShippingRichRadioItem": {
195
188
  "location": "local",
@@ -13,7 +13,8 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
13
13
  checkoutTimeoutInterval: null,
14
14
  currency: 'USD',
15
15
  doneSteps: [],
16
- dutiesTaxFees: 0,
16
+ dutiesTaxesFees: 0,
17
+ dutiesTaxesFeesEstimate: 0,
17
18
  error: null,
18
19
  exchangeRate: null,
19
20
  externalConfirmationPageURL: null,
@@ -22,6 +23,7 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
22
23
  isSelectedShippingGuarantee: false,
23
24
  items: [],
24
25
  landedCostData: null,
26
+ landedCostMethod: 'DDP',
25
27
  promoCode: sessionStorage.getItem('promoCode') || '',
26
28
  // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
27
29
  promoCodeApplied: !!sessionStorage.getItem('promoCode'),
@@ -136,14 +138,15 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
136
138
  title,
137
139
  };
138
140
  };
139
- const cartStoreApplySubtotals = (subtotals) => {
141
+ const cartStoreApplySubtotals = (subtotals, dutiesTaxesFeesEstimate) => {
140
142
  // update exchange rate so we can use it to display cart items
141
143
  cartStore.exchangeRate = subtotals.exchangeRate;
142
144
  cartStore.adjustmentTotal = subtotals.adjustments;
143
- cartStore.dutiesTaxFees = subtotals.landedCostTotal;
145
+ cartStore.dutiesTaxesFees = subtotals.landedCostTotal;
144
146
  cartStore.subtotal = subtotals.items;
145
147
  cartStore.total = subtotals.total;
146
148
  cartStore.currency = subtotals.presentmentCurrencyCode;
149
+ cartStore.dutiesTaxesFeesEstimate = dutiesTaxesFeesEstimate || 0;
147
150
  };
148
151
  /**
149
152
  * Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
@@ -166,11 +169,11 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
166
169
  cartStore.externalConfirmationPageURL = externalConfirmationPageURL;
167
170
  }
168
171
  };
169
- const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, itemsAmount, landedCostId, }) => {
172
+ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, }) => {
170
173
  if (landedCostId && cartStore.selectedLandedCost) {
171
174
  // update cart total right away if we have landed cost id to avoid order total flickering
172
175
  const subtotals = cartStore.selectedLandedCost.subtotals;
173
- cartStoreApplySubtotals(subtotals);
176
+ cartStoreApplySubtotals(subtotals, dutiesTaxesFeesEstimate);
174
177
  log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
175
178
  }
176
179
  // update checkout session
@@ -208,7 +211,7 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
208
211
  return true;
209
212
  };
210
213
  const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, landedCostId) => {
211
- var _a, _b, _c, _d, _e;
214
+ var _a, _b, _c, _d, _e, _f;
212
215
  cartStore.selectedShippingOption = selectedShippingOption;
213
216
  // update shipping transit info
214
217
  const transitData = cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);
@@ -216,6 +219,9 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
216
219
  const { maxTransit, minTransit, unit } = transitData;
217
220
  cartStore.selectedShippingOptionTransitTime = `${minTransit}-${maxTransit} ${unit}`;
218
221
  }
222
+ else {
223
+ cartStore.selectedShippingOptionTransitTime = '';
224
+ }
219
225
  const selectedLandedCost = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(x => x.landedCostId === landedCostId);
220
226
  // save selected landed cost for later use
221
227
  cartStore.selectedLandedCost = selectedLandedCost || null;
@@ -223,19 +229,28 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
223
229
  // do nothing if we can't find landed cost for selected shipping option
224
230
  return false;
225
231
  }
232
+ // If the quote is DAP, get the estimate from the corresponding DDP quote if available
233
+ const correspondingDdpQuote = (_b = cartStore.landedCostData) === null || _b === void 0 ? void 0 : _b.find(x => x.landedCost.shipmentRating.id === selectedShippingOption.id &&
234
+ x.landedCost.method === 'DDP');
235
+ const dutiesTaxesFeesEstimate = correspondingDdpQuote === null || correspondingDdpQuote === void 0 ? void 0 : correspondingDdpQuote.subtotals.landedCostTotal;
236
+ if (dutiesTaxesFeesEstimate) {
237
+ log(`DAP quote, using estimate from DDP quote: ${dutiesTaxesFeesEstimate}`, 'info');
238
+ }
239
+ cartStore.landedCostMethod = selectedLandedCost.landedCost.method || 'DDP';
226
240
  // update shipping value and dutiesTaxFees on selectedShippingOption change
227
241
  cartStore.shipping = selectedLandedCost.subtotals.shipping;
228
242
  // update deminimis status
229
- const isGuarantee = ((_b = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _b === void 0 ? void 0 : _b.landedCostGuaranteeCode) === 'ZONOS';
243
+ const isGuarantee = ((_c = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _c === void 0 ? void 0 : _c.landedCostGuaranteeCode) === 'ZONOS';
230
244
  // one item in deminimis with type of duty and tax has threshold value is "ABOVE"
231
- const isAboveDeminimis = !!((_d = (_c = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _c === void 0 ? void 0 : _c.deMinimis) === null || _d === void 0 ? void 0 : _d.find(item => ['DUTY', 'TAX'].includes(item.type) && item.threshold === 'ABOVE'));
245
+ const isAboveDeminimis = !!((_e = (_d = selectedLandedCost === null || selectedLandedCost === void 0 ? void 0 : selectedLandedCost.landedCost) === null || _d === void 0 ? void 0 : _d.deMinimis) === null || _e === void 0 ? void 0 : _e.find(item => ['DUTY', 'TAX'].includes(item.type) && item.threshold === 'ABOVE'));
232
246
  cartStore.isSelectedShippingAboveDeminimis = isAboveDeminimis;
233
247
  cartStore.isSelectedShippingGuarantee = isGuarantee;
234
248
  // update session with selected landed cost
235
249
  const updateCalculateStatus = await cartStoreReCalculateTotal({
236
250
  adjustmentsAmount: cartStore.adjustmentTotal,
237
251
  cartId: window.Zonos.cartId,
238
- landedCostId: (_e = selectedLandedCost.landedCost) === null || _e === void 0 ? void 0 : _e.id,
252
+ dutiesTaxesFeesEstimate: dutiesTaxesFeesEstimate,
253
+ landedCostId: (_f = selectedLandedCost.landedCost) === null || _f === void 0 ? void 0 : _f.id,
239
254
  });
240
255
  return updateCalculateStatus;
241
256
  };
@@ -295,6 +310,7 @@ const cartStoreUpdateItems = async ({ adjustments, cartItems, }) => {
295
310
  adjustmentsAmount: adjustmentTotal,
296
311
  cartId: window.Zonos.cartId,
297
312
  currency: currency,
313
+ dutiesTaxesFeesEstimate: 0,
298
314
  itemsAmount: total,
299
315
  });
300
316
  stripeStore.isFetchingSession = false;
@@ -304,7 +320,8 @@ const cartStoreResetSelectedShippingOption = () => {
304
320
  cartStore.isSelectedShippingAboveDeminimis = false;
305
321
  cartStore.isSelectedShippingGuarantee = false;
306
322
  cartStore.selectedShippingOptionTransitTime = '';
307
- cartStore.dutiesTaxFees = 0;
323
+ cartStore.dutiesTaxesFees = 0;
324
+ cartStore.dutiesTaxesFeesEstimate = 0;
308
325
  cartStore.shipping = 0;
309
326
  // reset total to subtotal
310
327
  cartStore.total = cartStore.subtotal;
@@ -341,4 +358,4 @@ const cartStoreResetTabItems = () => {
341
358
  cartStore.tabItems = Object.assign(Object.assign({}, cartStore.tabItems), { 'customer-info': Object.assign(Object.assign({}, cartStore.tabItems['customer-info']), { isDone: false }), payment: Object.assign(Object.assign({}, cartStore.tabItems.payment), { isDone: false }), shipping: Object.assign(Object.assign({}, cartStore.tabItems.shipping), { isDone: false }) });
342
359
  cartStoreResetSelectedShippingOption();
343
360
  };
344
- export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
361
+ export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStorePreviousStep, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
@@ -1,11 +1,11 @@
1
1
  import { createStore } from "@stencil/store";
2
2
  import { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStorePreviousStep, cartStoreResetCartItems, cartStoreSetCheckoutSession, cartStoreUpdateSelectedShippingOption, } from "./cart";
3
- import { localizationStore } from "../hello/localization";
3
+ import { DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT, localizationStore, } from "../hello/localization";
4
4
  import { translate } from "../translationStore";
5
5
  import { zonosStore } from "../zonosStore";
6
6
  import { calculateLandedCostNormalized } from "../../utils/api/calculateLandedCostNormaliz";
7
7
  import { buildTranslateRequest } from "../../utils/checkout/buildTranslateRequest";
8
- import { sortServiceLevelOptions } from "../../utils/checkout/sortServiceLevelOptions";
8
+ import { sortServiceLevelOptionsByAmount } from "../../utils/checkout/sortServiceLevelOptionsByAmount";
9
9
  import { handleFetch } from "../../utils/handleFetch";
10
10
  import { isDarkColor } from "../../utils/isDarkColor";
11
11
  import { jsonParse } from "../../utils/jsonParse";
@@ -170,7 +170,7 @@ const stripeCalculateLandedCost = async () => {
170
170
  // Reset cart items to non-restricted state and restricted item list
171
171
  cartStoreResetCartItems();
172
172
  const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCostNormalized(abortController);
173
- cartStore.shippingData = sortServiceLevelOptions((shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || []);
173
+ cartStore.shippingData = sortServiceLevelOptionsByAmount((shipmentRatingCalculateWorkflow === null || shipmentRatingCalculateWorkflow === void 0 ? void 0 : shipmentRatingCalculateWorkflow.filter(Boolean)) || []);
174
174
  // check and update cart items with restrictions
175
175
  cartStoreCheckItemRestrictions(itemCreateWorkflow);
176
176
  // reset abort controller after we are done
@@ -420,7 +420,8 @@ const stripeStoreInitCheckoutSession = async () => {
420
420
  currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
421
421
  itemsAmount: total,
422
422
  metadata: [{ key: 'language', value: localizationStore.selectedLocale }],
423
- presentmentCountryCode: localizationStore.selectedCountryCode || null,
423
+ presentmentCountryCode: localizationStore.selectedCountryCode ||
424
+ DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT,
424
425
  },
425
426
  method: 'POST',
426
427
  });
@@ -15,6 +15,10 @@ import { getCurrencyCode } from "../../utils/hello/currencyConversion/getCurrenc
15
15
  import { setZCountryUrlParam } from "../../utils/hello/setZCountryUrlParam";
16
16
  import { log } from "../../utils/logging/log";
17
17
  import { logError } from "../../utils/logging/logError";
18
+ /**
19
+ * CHORE: This is mostly for legacy checkout as the country param is not guaranteed.
20
+ */
21
+ export const DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT = 'CA';
18
22
  const { dispose: localizationDispose, onChange: localizationStoreOnUpdate, state: localizationStore, } = createStore({
19
23
  countryLandedCost: null,
20
24
  customMessages: [],
@@ -128,7 +132,7 @@ const localizationStoreUpdateSelectedCountryCode = (newSelectedCountryCode) => {
128
132
  // update shippable country
129
133
  localizationStore.isShippableCountry = isShippableCountry;
130
134
  log(`${localizationStore.selectedCountryCode} is a shippable country: ${localizationStore.isShippableCountry}`);
131
- const isDisabledCountry = !selectedCountryCode ||
135
+ const isDisabledCountry = !!selectedCountryCode &&
132
136
  zonosStore.disabledCountries.includes(selectedCountryCode);
133
137
  localizationStore.isDisabledCountry = isDisabledCountry;
134
138
  log(`${localizationStore.selectedCountryCode} is a disabled country: ${localizationStore.isDisabledCountry}`);
@@ -86,12 +86,18 @@ export const stringsArabic = {
86
86
  "Don't close": {
87
87
  value: 'لا تغلق',
88
88
  },
89
+ 'Due at delivery': {
90
+ value: 'مستحق عند التسليم',
91
+ },
89
92
  'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
90
93
  value: 'الرسوم والضرائب في أستراليا، ضريبة القيمة المضافة أو GST هي [percentage] وتستحق على جميع الطلبات.',
91
94
  },
92
95
  'Duties and taxes will be applied to items and shipping.': {
93
96
  value: 'سيتم تطبيق الرسوم والضرائب على العناصر والشحن.',
94
97
  },
98
+ 'Duties and taxes will be charged upon delivery.': {
99
+ value: 'سيتم فرض الرسوم والضرائب عند التسليم.',
100
+ },
95
101
  'Duties will apply to all orders.': {
96
102
  value: 'ستنطبق الرسوم على جميع الطلبات.',
97
103
  },
@@ -107,6 +113,9 @@ export const stringsArabic = {
107
113
  'Error updating Checkout': {
108
114
  value: 'خطأ في تحديث جلسة الخروج',
109
115
  },
116
+ Estimated: {
117
+ value: 'مقدر',
118
+ },
110
119
  'Expected delivery': {
111
120
  value: 'التوصيل المتوقع',
112
121
  },
@@ -128,6 +137,9 @@ export const stringsArabic = {
128
137
  Hide: {
129
138
  value: 'اخفِ',
130
139
  },
140
+ 'Hide non prepaid methods': {
141
+ value: 'إخفاء الطرق غير المدفوعة مسبقًا',
142
+ },
131
143
  'Invalid promo code': {
132
144
  value: 'رمز ترويجي غير صالح',
133
145
  },
@@ -161,6 +173,9 @@ export const stringsArabic = {
161
173
  'No shipping methods found - try editing your address or contacting support if the error persists': {
162
174
  value: 'لم يتم العثور على طرق شحن - جرب تحرير عنوانك أو الاتصال بالدعم إذا استمر الخطأ',
163
175
  },
176
+ 'Nothing due at delivery': {
177
+ value: 'لا شيء مستحق عند التسليم',
178
+ },
164
179
  'Nothing due at the door': {
165
180
  value: 'لا شيء مستحق عند الباب',
166
181
  },
@@ -269,6 +284,9 @@ export const stringsArabic = {
269
284
  Show: {
270
285
  value: 'عرض',
271
286
  },
287
+ 'Show non prepaid methods': {
288
+ value: 'عرض طرق غير مدفوعة مسبقًا',
289
+ },
272
290
  'Something went wrong.': {
273
291
  value: 'حدث خطأ ما.',
274
292
  },
@@ -341,6 +359,9 @@ export const stringsArabic = {
341
359
  'Would you like to close checkout and return to the site?': {
342
360
  value: 'هل ترغب في إغلاق عملية الدفع والعودة إلى الموقع؟',
343
361
  },
362
+ 'You may incur additional fees from the shipping carrier by not prepaying.': {
363
+ value: 'قد تتكبد رسومًا إضافية من شركة الشحن إذا لم تدفع مسبقًا.',
364
+ },
344
365
  "You're all set!": {
345
366
  value: 'أنت جاهز!',
346
367
  },
@@ -86,12 +86,18 @@ export const stringsBase = {
86
86
  "Don't close": {
87
87
  value: "Don't close",
88
88
  },
89
+ 'Due at delivery': {
90
+ value: 'Due at delivery',
91
+ },
89
92
  'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
90
93
  value: 'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.',
91
94
  },
92
95
  'Duties and taxes will be applied to items and shipping.': {
93
96
  value: 'Duties and taxes will be applied to items and shipping.',
94
97
  },
98
+ 'Duties and taxes will be charged upon delivery.': {
99
+ value: 'Duties and taxes will be charged upon delivery.',
100
+ },
95
101
  'Duties will apply to all orders.': {
96
102
  value: 'Duties will apply to all orders.',
97
103
  },
@@ -107,6 +113,9 @@ export const stringsBase = {
107
113
  'Error updating Checkout': {
108
114
  value: 'Error updating Checkout',
109
115
  },
116
+ Estimated: {
117
+ value: 'Estimated',
118
+ },
110
119
  'Expected delivery': {
111
120
  value: 'Expected delivery',
112
121
  },
@@ -128,6 +137,9 @@ export const stringsBase = {
128
137
  Hide: {
129
138
  value: 'Hide',
130
139
  },
140
+ 'Hide non prepaid methods': {
141
+ value: 'Hide non prepaid methods',
142
+ },
131
143
  'Invalid promo code': {
132
144
  value: 'Invalid promo code',
133
145
  },
@@ -161,6 +173,9 @@ export const stringsBase = {
161
173
  'No shipping methods found - try editing your address or contacting support if the error persists': {
162
174
  value: 'No shipping methods found - try editing your address or contacting support if the error persists',
163
175
  },
176
+ 'Nothing due at delivery': {
177
+ value: 'Nothing due at delivery',
178
+ },
164
179
  'Nothing due at the door': {
165
180
  value: 'Nothing due at the door',
166
181
  },
@@ -269,6 +284,9 @@ export const stringsBase = {
269
284
  Show: {
270
285
  value: 'Show',
271
286
  },
287
+ 'Show non prepaid methods': {
288
+ value: 'Show non prepaid methods',
289
+ },
272
290
  'Something went wrong.': {
273
291
  value: 'Something went wrong.',
274
292
  },
@@ -341,6 +359,9 @@ export const stringsBase = {
341
359
  'Would you like to close checkout and return to the site?': {
342
360
  value: 'Would you like to close checkout and return to the site?',
343
361
  },
362
+ 'You may incur additional fees from the shipping carrier by not prepaying.': {
363
+ value: 'You may incur additional fees from the shipping carrier by not prepaying.',
364
+ },
344
365
  "You're all set!": {
345
366
  value: "You're all set!",
346
367
  },
@@ -86,12 +86,18 @@ export const stringsChinese = {
86
86
  "Don't close": {
87
87
  value: '不要关',
88
88
  },
89
+ 'Due at delivery': {
90
+ value: '交货时付款',
91
+ },
89
92
  'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
90
93
  value: '澳大利亚的关税和税费,增值税或GST为[percentage],适用于所有订单。',
91
94
  },
92
95
  'Duties and taxes will be applied to items and shipping.': {
93
96
  value: '商品和运费将征收关税和税款。',
94
97
  },
98
+ 'Duties and taxes will be charged upon delivery.': {
99
+ value: '关税和税款将在交货时收取。',
100
+ },
95
101
  'Duties will apply to all orders.': {
96
102
  value: '所有订单都将适用关税。',
97
103
  },
@@ -107,6 +113,9 @@ export const stringsChinese = {
107
113
  'Error updating Checkout': {
108
114
  value: '更新结账时出错',
109
115
  },
116
+ Estimated: {
117
+ value: '估计',
118
+ },
110
119
  'Expected delivery': {
111
120
  value: '预计送达',
112
121
  },
@@ -128,6 +137,9 @@ export const stringsChinese = {
128
137
  Hide: {
129
138
  value: '隐藏',
130
139
  },
140
+ 'Hide non prepaid methods': {
141
+ value: '隐藏非预付费方法',
142
+ },
131
143
  'Invalid promo code': {
132
144
  value: '无效的促销代码',
133
145
  },
@@ -161,6 +173,9 @@ export const stringsChinese = {
161
173
  'No shipping methods found - try editing your address or contacting support if the error persists': {
162
174
  value: '未找到运输方法 - 如果错误仍然存在,请尝试编辑您的地址或联系支持',
163
175
  },
176
+ 'Nothing due at delivery': {
177
+ value: '交货时无需付款',
178
+ },
164
179
  'Nothing due at the door': {
165
180
  value: '门口无需付款',
166
181
  },
@@ -269,6 +284,9 @@ export const stringsChinese = {
269
284
  Show: {
270
285
  value: '显示',
271
286
  },
287
+ 'Show non prepaid methods': {
288
+ value: '显示非预付费方法',
289
+ },
272
290
  'Something went wrong.': {
273
291
  value: '出了些问题。',
274
292
  },
@@ -341,6 +359,9 @@ export const stringsChinese = {
341
359
  'Would you like to close checkout and return to the site?': {
342
360
  value: '您要关闭结帐并返回网站吗?',
343
361
  },
362
+ 'You may incur additional fees from the shipping carrier by not prepaying.': {
363
+ value: '如果不预付,您可能会产生来自运输公司的额外费用。',
364
+ },
344
365
  "You're all set!": {
345
366
  value: '您已完成设置!',
346
367
  },
@@ -86,12 +86,18 @@ export const stringsDanish = {
86
86
  "Don't close": {
87
87
  value: 'Luk ikke',
88
88
  },
89
+ 'Due at delivery': {
90
+ value: 'Betales ved levering',
91
+ },
89
92
  'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
90
93
  value: 'Afgifter og skatter i Australien, moms eller GST er [percentage] og forfalder på alle ordrer.',
91
94
  },
92
95
  'Duties and taxes will be applied to items and shipping.': {
93
96
  value: 'Told og skatter vil blive pålagt varer og fragt.',
94
97
  },
98
+ 'Duties and taxes will be charged upon delivery.': {
99
+ value: 'Told og skatter vil blive opkrævet ved levering.',
100
+ },
95
101
  'Duties will apply to all orders.': {
96
102
  value: 'Told vil gælde for alle ordrer.',
97
103
  },
@@ -107,6 +113,9 @@ export const stringsDanish = {
107
113
  'Error updating Checkout': {
108
114
  value: 'Fejl ved opdatering af betalingssession',
109
115
  },
116
+ Estimated: {
117
+ value: 'Anslået',
118
+ },
110
119
  'Expected delivery': {
111
120
  value: 'Forventet levering',
112
121
  },
@@ -128,6 +137,9 @@ export const stringsDanish = {
128
137
  Hide: {
129
138
  value: 'Skjul',
130
139
  },
140
+ 'Hide non prepaid methods': {
141
+ value: 'Skjul ikke-forudbetalte metoder',
142
+ },
131
143
  'Invalid promo code': {
132
144
  value: 'Ugyldig kampagnekode',
133
145
  },
@@ -161,6 +173,9 @@ export const stringsDanish = {
161
173
  'No shipping methods found - try editing your address or contacting support if the error persists': {
162
174
  value: 'Ingen forsendelsesmetoder fundet - prøv at redigere din adresse eller kontakte support, hvis fejlen fortsætter',
163
175
  },
176
+ 'Nothing due at delivery': {
177
+ value: 'Intet at betale ved levering',
178
+ },
164
179
  'Nothing due at the door': {
165
180
  value: 'Intet at betale ved døren',
166
181
  },
@@ -269,6 +284,9 @@ export const stringsDanish = {
269
284
  Show: {
270
285
  value: 'Vis',
271
286
  },
287
+ 'Show non prepaid methods': {
288
+ value: 'Vis ikke forudbetalte metoder',
289
+ },
272
290
  'Something went wrong.': {
273
291
  value: 'Noget gik galt.',
274
292
  },
@@ -341,6 +359,9 @@ export const stringsDanish = {
341
359
  'Would you like to close checkout and return to the site?': {
342
360
  value: 'Vil du lukke kassen og vende tilbage til siden?',
343
361
  },
362
+ 'You may incur additional fees from the shipping carrier by not prepaying.': {
363
+ value: 'Du kan pådrage dig ekstra gebyrer fra fragtfirmaet ved ikke at forudbetale.',
364
+ },
344
365
  "You're all set!": {
345
366
  value: 'Du er klar til at gå!',
346
367
  },
@@ -86,12 +86,18 @@ export const stringsDutch = {
86
86
  "Don't close": {
87
87
  value: 'Niet sluiten',
88
88
  },
89
+ 'Due at delivery': {
90
+ value: 'Te betalen bij levering',
91
+ },
89
92
  'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
90
93
  value: 'Invoerrechten en belastingen in Australië, de btw of GST is [percentage] en is verschuldigd op alle bestellingen.',
91
94
  },
92
95
  'Duties and taxes will be applied to items and shipping.': {
93
96
  value: 'Belastingen en heffingen worden toegepast op artikelen en verzending.',
94
97
  },
98
+ 'Duties and taxes will be charged upon delivery.': {
99
+ value: 'Invoerrechten en belastingen worden bij levering in rekening gebracht.',
100
+ },
95
101
  'Duties will apply to all orders.': {
96
102
  value: 'Invoerrechten zullen van toepassing zijn op alle bestellingen.',
97
103
  },
@@ -107,6 +113,9 @@ export const stringsDutch = {
107
113
  'Error updating Checkout': {
108
114
  value: 'Fout bij het bijwerken van afrekening',
109
115
  },
116
+ Estimated: {
117
+ value: 'Geschat',
118
+ },
110
119
  'Expected delivery': {
111
120
  value: 'Verwachte levering',
112
121
  },
@@ -128,6 +137,9 @@ export const stringsDutch = {
128
137
  Hide: {
129
138
  value: 'Verbergen',
130
139
  },
140
+ 'Hide non prepaid methods': {
141
+ value: 'Verberg niet-voorafbetaalde methoden',
142
+ },
131
143
  'Invalid promo code': {
132
144
  value: 'Ongeldige promotiecode',
133
145
  },
@@ -161,6 +173,9 @@ export const stringsDutch = {
161
173
  'No shipping methods found - try editing your address or contacting support if the error persists': {
162
174
  value: 'Geen verzendmethoden gevonden - probeer uw adres te bewerken of neem contact op met de ondersteuning als de fout aanhoudt',
163
175
  },
176
+ 'Nothing due at delivery': {
177
+ value: 'Niets te betalen bij levering',
178
+ },
164
179
  'Nothing due at the door': {
165
180
  value: 'Niets te betalen aan de deur',
166
181
  },
@@ -269,6 +284,9 @@ export const stringsDutch = {
269
284
  Show: {
270
285
  value: 'Tonen',
271
286
  },
287
+ 'Show non prepaid methods': {
288
+ value: 'Toon niet-vooruitbetaalde methoden',
289
+ },
272
290
  'Something went wrong.': {
273
291
  value: 'Er is iets misgegaan.',
274
292
  },
@@ -341,6 +359,9 @@ export const stringsDutch = {
341
359
  'Would you like to close checkout and return to the site?': {
342
360
  value: 'Wilt u de kassa sluiten en terugkeren naar de site?',
343
361
  },
362
+ 'You may incur additional fees from the shipping carrier by not prepaying.': {
363
+ value: 'U kunt extra kosten van de vervoerder krijgen als u niet vooraf betaalt.',
364
+ },
344
365
  "You're all set!": {
345
366
  value: 'Je bent helemaal klaar!',
346
367
  },