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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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 {
|