ublo-lib 1.26.4 → 1.26.6
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.
- package/es/common/components/date-picker/calendar.js +3 -3
- package/es/common/components/date-picker/date-item.js +2 -2
- package/es/common/components/date-picker/date-picker.js +2 -4
- package/es/common/components/msem-preset-editor/components/widget-list-item.js +0 -1
- package/es/common/components/msem-preset-editor/services/offers.js +17 -1
- package/es/common/components/msem-preset-editor/services/preset.js +4 -0
- package/es/common/hooks/use-window-sizes.js +5 -4
- package/package.json +1 -1
|
@@ -20,11 +20,11 @@ export default function Calendar({
|
|
|
20
20
|
min,
|
|
21
21
|
max,
|
|
22
22
|
onSubmit,
|
|
23
|
+
availabilities,
|
|
24
|
+
close,
|
|
23
25
|
singleDate,
|
|
24
26
|
submitOnSelectionEnd,
|
|
25
|
-
|
|
26
|
-
disableConfirmModal,
|
|
27
|
-
close
|
|
27
|
+
disableConfirmModal
|
|
28
28
|
}) {
|
|
29
29
|
const isDateObject = Utils.isDate(date);
|
|
30
30
|
const _date = isDateObject ? date : new Date();
|
|
@@ -49,7 +49,7 @@ export default function DateItem({
|
|
|
49
49
|
} = stay;
|
|
50
50
|
const formatedStart = Utils.formatDate(start);
|
|
51
51
|
const formatedEnd = Utils.formatDate(end);
|
|
52
|
-
const formatedDate = Utils.formatDate(
|
|
52
|
+
const formatedDate = Utils.formatDate(_date);
|
|
53
53
|
return formatedStart === formatedDate || selecting && formatedEnd === formatedDate;
|
|
54
54
|
}) || false;
|
|
55
55
|
const shortestMatchingStaysLength = enableAvailability && matchingStays?.reduce((acc, stay) => {
|
|
@@ -62,7 +62,7 @@ export default function DateItem({
|
|
|
62
62
|
}
|
|
63
63
|
return acc;
|
|
64
64
|
}, Infinity);
|
|
65
|
-
const isDisabled = enableAvailability && selecting && allMatchingStaysEnd?.length && !allMatchingStaysEnd.includes(
|
|
65
|
+
const isDisabled = enableAvailability && selecting && allMatchingStaysEnd?.length && !allMatchingStaysEnd.includes(_date) || enableAvailability && !isAvailable || isPastDate || !isInMonth || Utils.isBefore(date, min) || Utils.isAfter(date, max);
|
|
66
66
|
React.useEffect(() => {
|
|
67
67
|
if (isFirstSelected) setFirstSelectedDate(index);
|
|
68
68
|
if (isLastSelected) setLastSelectedDate(index);
|
|
@@ -12,14 +12,13 @@ export { Data, Utils };
|
|
|
12
12
|
export default function DatePicker({
|
|
13
13
|
stayDates = [],
|
|
14
14
|
onSubmit,
|
|
15
|
-
popup = true,
|
|
16
15
|
close,
|
|
17
|
-
hideModes,
|
|
18
16
|
min,
|
|
19
17
|
max,
|
|
18
|
+
availabilities,
|
|
19
|
+
popup = true,
|
|
20
20
|
singleDate,
|
|
21
21
|
submitOnSelectionEnd,
|
|
22
|
-
availabilities,
|
|
23
22
|
disableConfirmModal
|
|
24
23
|
}) {
|
|
25
24
|
const [display, setDisplay] = React.useState(Data.DISPLAYS.DESKTOP);
|
|
@@ -54,7 +53,6 @@ export default function DatePicker({
|
|
|
54
53
|
min: min,
|
|
55
54
|
max: max,
|
|
56
55
|
onSubmit: onSubmit,
|
|
57
|
-
hideModes: hideModes,
|
|
58
56
|
singleDate: singleDate,
|
|
59
57
|
submitOnSelectionEnd: submitOnSelectionEnd,
|
|
60
58
|
availabilities: availabilities,
|
|
@@ -58,8 +58,24 @@ function mergeSkiPasses(offer) {
|
|
|
58
58
|
items = [],
|
|
59
59
|
...rest
|
|
60
60
|
} = offer;
|
|
61
|
+
const uniqueItems = items.reduce((acc, item) => {
|
|
62
|
+
const {
|
|
63
|
+
name
|
|
64
|
+
} = item;
|
|
65
|
+
const isUnique = !acc.some(i => i.name === name);
|
|
66
|
+
if (isUnique) {
|
|
67
|
+
return [item, ...acc];
|
|
68
|
+
}
|
|
69
|
+
return acc;
|
|
70
|
+
}, []);
|
|
71
|
+
if (uniqueItems.length === 0) {
|
|
72
|
+
return {
|
|
73
|
+
...rest,
|
|
74
|
+
...uniqueItems[0]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
61
77
|
return {
|
|
62
78
|
...rest,
|
|
63
|
-
|
|
79
|
+
items: uniqueItems
|
|
64
80
|
};
|
|
65
81
|
}
|
|
@@ -5,6 +5,10 @@ export function format(data) {
|
|
|
5
5
|
taxonomy,
|
|
6
6
|
slug
|
|
7
7
|
} = data;
|
|
8
|
+
const isLift = ["skiPass", "liftJb"].includes(widget);
|
|
9
|
+
if (isLift) {
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
8
12
|
const isOtherProductsOrSkiRental = ["otherProducts", "skiRental"].includes(widget);
|
|
9
13
|
const merchant = isOtherProductsOrSkiRental ? slug : code;
|
|
10
14
|
const merchantSlug = isOtherProductsOrSkiRental ? slug : undefined;
|
|
@@ -3,7 +3,7 @@ const DEFAULT_SIZES = {
|
|
|
3
3
|
width: undefined,
|
|
4
4
|
height: undefined
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
export default function useWindowSizes() {
|
|
7
7
|
const [windowSizes, setWindowSizes] = React.useState(DEFAULT_SIZES);
|
|
8
8
|
const resized = () => {
|
|
9
9
|
setWindowSizes({
|
|
@@ -21,12 +21,13 @@ const useWindowSizes = () => {
|
|
|
21
21
|
observer.unobserve(document.body);
|
|
22
22
|
};
|
|
23
23
|
} else {
|
|
24
|
-
window.addEventListener("resize", resized
|
|
24
|
+
window.addEventListener("resize", resized, {
|
|
25
|
+
passive: true
|
|
26
|
+
});
|
|
25
27
|
return () => {
|
|
26
28
|
window.removeEventListener("resize", resized);
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
}, []);
|
|
30
32
|
return windowSizes;
|
|
31
|
-
}
|
|
32
|
-
export default useWindowSizes;
|
|
33
|
+
}
|