ublo-lib 1.30.3 → 1.30.5

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.
@@ -27,10 +27,4 @@ export async function fetchMseMCart(cartId, lang) {
27
27
  };
28
28
  const result = await Fetcher.post(endpoint, payload);
29
29
  return result;
30
- }
31
- export async function fetchSkipassesFilters(merchant, catalog) {
32
- const endpoint = `${msemServicesUrl}/api/ski-pass/${merchant}/filters`;
33
- return Fetcher.post(endpoint, undefined, {
34
- catalog
35
- });
36
30
  }
@@ -1,4 +1,3 @@
1
- import * as API from "./api";
2
1
  export const tunnelOffers = {
3
2
  HOT: "Hébergement",
4
3
  LIFT: "Forfait",
@@ -89,7 +88,7 @@ function checkStay(override, stay) {
89
88
  const stayFromTime = new Date(stay?.from).getTime();
90
89
  const stayToTime = new Date(stay?.to).getTime();
91
90
  const stayIsBetweenTrigger = stayFromTime >= triggerStayFrom && stayToTime <= triggerStayTo;
92
- const stayHasRightDuration = stay.duration && stayDuration && stayDuration !== 0 && stay?.duration > stayDuration;
91
+ const stayHasRightDuration = stay.duration && stayDuration && stayDuration !== 0 && typeof stay?.duration === "number" && stay?.duration > stayDuration;
93
92
  return stayIsBetweenTrigger || stayHasRightDuration;
94
93
  }
95
94
  function checkMerchants(override, merchants) {
@@ -180,26 +179,16 @@ export async function getSkiPassDurationFromCart(cart) {
180
179
  LIFT: items
181
180
  } = cart.orders;
182
181
  if (!items?.length) return [];
183
- const {
184
- merchant
185
- } = items[0];
186
- const skipassCatalogs = items[0].inscriptions.map(i => i.skipassCatalog);
187
- const filters = await Promise.all(skipassCatalogs.map(catalog => API.fetchSkipassesFilters(merchant, catalog)));
188
- const durations = filters.reduce((acc, filter) => {
189
- const {
190
- durations: durationsFilter
191
- } = filter;
192
- const durations = items.map(item => {
193
- if (!item.inscriptions.length) return acc;
194
- const label = item.inscriptions[0].duration;
195
- const duration = durationsFilter.find(d => {
196
- return d.code === label;
197
- });
198
- return duration;
199
- });
200
- return [...acc, ...durations];
201
- }, []);
202
- return durations.map(d => d.nbDays);
182
+ const durations = items[0].inscriptions.map(i => patchDuration(i.duration));
183
+ return durations;
184
+ }
185
+ function patchDuration(duration) {
186
+ if (typeof duration === "number") return duration;
187
+ const normalizedDuration = duration.toLowerCase();
188
+ if (normalizedDuration.includes("jour") || normalizedDuration.includes("day")) {
189
+ return Number(normalizedDuration.replace(/\D+/g, ""));
190
+ }
191
+ return 1;
203
192
  }
204
193
  export async function getDurationTagsFromCart(cart) {
205
194
  const {
@@ -3,10 +3,10 @@ a.button {
3
3
  color: inherit;
4
4
  }
5
5
 
6
- .icon {
6
+ svg.icon {
7
7
  --size: 24px;
8
8
  }
9
9
 
10
- a.compact .icon {
10
+ a.compact svg.icon {
11
11
  --size: 15px;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.30.3",
3
+ "version": "1.30.5",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",