ublo-lib 1.18.1 → 1.18.2
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,7 +27,8 @@ function Calendar({
|
|
|
27
27
|
hideModes,
|
|
28
28
|
singleDate,
|
|
29
29
|
submitOnSelectionEnd,
|
|
30
|
-
availabilities
|
|
30
|
+
availabilities,
|
|
31
|
+
disableConfirmModal
|
|
31
32
|
}) {
|
|
32
33
|
const isDateObject = Utils.isDate(date);
|
|
33
34
|
const _date = isDateObject ? date : new Date();
|
|
@@ -66,7 +67,7 @@ function Calendar({
|
|
|
66
67
|
};
|
|
67
68
|
const submit = dates => {
|
|
68
69
|
const hasCart = window.sessionStorage.cartId !== undefined;
|
|
69
|
-
if (hasCart) {
|
|
70
|
+
if (!disableConfirmModal && hasCart) {
|
|
70
71
|
setShowPopup(true);
|
|
71
72
|
} else {
|
|
72
73
|
onSubmit(dates);
|
|
@@ -21,7 +21,8 @@ const DatePicker = ({
|
|
|
21
21
|
rules,
|
|
22
22
|
singleDate,
|
|
23
23
|
submitOnSelectionEnd,
|
|
24
|
-
availabilities
|
|
24
|
+
availabilities,
|
|
25
|
+
disableConfirmModal
|
|
25
26
|
}) => {
|
|
26
27
|
const [display, setDisplay] = React.useState(Data.DISPLAYS.DESKTOP);
|
|
27
28
|
const [specialRule, setSpecialRule] = React.useState();
|
|
@@ -30,12 +31,20 @@ const DatePicker = ({
|
|
|
30
31
|
} = useUbloContext();
|
|
31
32
|
const showModes = display !== Data.DISPLAYS.PHONE && !hideModes;
|
|
32
33
|
const getDefaultMode = () => {
|
|
33
|
-
if (!showModes)
|
|
34
|
-
|
|
34
|
+
if (!showModes) {
|
|
35
|
+
return Data.MODES.CUSTOM;
|
|
36
|
+
}
|
|
37
|
+
if (stayDates.length === 0) {
|
|
38
|
+
return defaultMode;
|
|
39
|
+
}
|
|
35
40
|
const firstDate = stayDates[0];
|
|
36
41
|
const lastDate = stayDates[stayDates.length - 1];
|
|
37
|
-
if (Utils.isSaturday(firstDate) && Utils.isSaturday(lastDate))
|
|
38
|
-
|
|
42
|
+
if (Utils.isSaturday(firstDate) && Utils.isSaturday(lastDate)) {
|
|
43
|
+
return Data.MODES.SATURDAY;
|
|
44
|
+
}
|
|
45
|
+
if (Utils.isSunday(firstDate) && Utils.isSunday(lastDate)) {
|
|
46
|
+
return Data.MODES.SUNDAY;
|
|
47
|
+
}
|
|
39
48
|
return Data.MODES.CUSTOM;
|
|
40
49
|
};
|
|
41
50
|
const [currentMode, setCurrentMode] = React.useState(getDefaultMode());
|
|
@@ -91,7 +100,8 @@ const DatePicker = ({
|
|
|
91
100
|
hideModes: hideModes,
|
|
92
101
|
singleDate: singleDate,
|
|
93
102
|
submitOnSelectionEnd: submitOnSelectionEnd,
|
|
94
|
-
availabilities: availabilities
|
|
103
|
+
availabilities: availabilities,
|
|
104
|
+
disableConfirmModal: disableConfirmModal
|
|
95
105
|
}), specialRule && _jsxs("div", {
|
|
96
106
|
className: styles.specialRule,
|
|
97
107
|
children: [_jsx(Icons.Info, {}), _jsxs("div", {
|