ublo-lib 1.42.12 → 1.42.13
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/future/components/msem-preset-editor/components/widget-list-item.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/components/widget-list-item.js +3 -2
- package/es/future/components/msem-preset-editor/components/widget-list-item.module.css +17 -1
- package/es/future/components/msem-preset-editor/editors/lodgings.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/lodgings.js +45 -2
- package/es/future/components/msem-preset-editor/editors/ski-passes.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/ski-passes.js +41 -7
- package/es/future/components/msem-preset-editor/editors/ski-passes.module.css +18 -0
- package/es/future/components/msem-preset-editor/services/api.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-list-item.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/components/widget-list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACpE,CAAC;AAaF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"widget-list-item.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/components/widget-list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACvD,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACpE,CAAC;AAaF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,EAAE,KAAK,2CAuKP"}
|
|
@@ -20,7 +20,7 @@ export default function WidgetListItem({ item, preset, updatePreset, removePrese
|
|
|
20
20
|
const { widget, logo, name, items: subs } = item;
|
|
21
21
|
const isSelected = preset?.name === name && preset?.widget === widget;
|
|
22
22
|
const hasSubsSelected = subs?.some((sub) => preset?.name === sub.name && preset?.widget === sub.widget) || false;
|
|
23
|
-
const [opened, setOpened] = React.useState(isSelected
|
|
23
|
+
const [opened, setOpened] = React.useState(isSelected);
|
|
24
24
|
const ToggleIcon = opened ? Icons.ChevronUp : Icons.ChevronDown;
|
|
25
25
|
const hasSubs = subs && subs.length > 0;
|
|
26
26
|
const allowAdvancedPresets = ALLOW_PRESETS_ON_WIDGETS.includes(widget);
|
|
@@ -36,6 +36,7 @@ export default function WidgetListItem({ item, preset, updatePreset, removePrese
|
|
|
36
36
|
};
|
|
37
37
|
const classes = classNames(css.item, {
|
|
38
38
|
[css.selected]: isSelected,
|
|
39
|
+
[css.subSelected]: hasSubsSelected,
|
|
39
40
|
[css.opened]: opened,
|
|
40
41
|
});
|
|
41
42
|
const handleItemClick = () => {
|
|
@@ -62,5 +63,5 @@ export default function WidgetListItem({ item, preset, updatePreset, removePrese
|
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
return (_jsxs("div", { className: classes, children: [_jsx(Button, { variant: "transparent", className: css.subButton, onClick: handleSubClick, autoFocus: isSelected ? true : undefined, children: sub.name }), showButtons && (_jsxs("div", { className: css.subActions, children: [showEditButton && (_jsx(Tooltip, { content: "Affiner le preset", children: _jsx(Button, { variant: "primary", className: css.action, onClick: () => setShowPresetDialog(true), compact: true, children: _jsx(Icons.Edit, {}) }) })), isSelected && (_jsx(Tooltip, { content: "Supprimer le preset", children: _jsx(Button, { variant: "danger", className: css.action, onClick: removePreset, compact: true, children: _jsx(Icons.Trash, {}) }) }))] }))] }, sub.name));
|
|
65
|
-
}) }), children:
|
|
66
|
+
}) }), children: _jsxs(Button, { variant: "secondary", className: css.action, onClick: openDropdown, compact: true, children: [_jsx(ToggleIcon, {}), hasSubsSelected && _jsx("div", { className: css.actionPill })] }) }))] }))] }));
|
|
66
67
|
}
|
|
@@ -35,7 +35,12 @@
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.subSelected .button,
|
|
39
|
+
.subSelected .button:hover {
|
|
40
|
+
background: var(--ublo-blue-100, #e8f0fc);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.item:not(.selected, .subSelected) .button:not(:disabled):hover {
|
|
39
44
|
background-color: var(--ublo-grey-100, #f5f5f5);
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -73,9 +78,20 @@
|
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
.action {
|
|
81
|
+
position: relative;
|
|
76
82
|
border-radius: var(--ublo-radius-100, 3px);
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
.actionPill {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: -3px;
|
|
88
|
+
right: -3px;
|
|
89
|
+
width: 8px;
|
|
90
|
+
height: 8px;
|
|
91
|
+
background-color: var(--ds-red-400, #ee3535);
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
.dropdown {
|
|
80
96
|
padding: 0;
|
|
81
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lodgings.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/lodgings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"lodgings.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/lodgings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4EF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,IAAI,EACJ,eAAe,EACf,MAAM,EACN,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,WAAW,GACZ,EAAE,KAAK,2CAgVP"}
|
|
@@ -18,8 +18,43 @@ const DEFAULT_DATA = {
|
|
|
18
18
|
nbRooms: [],
|
|
19
19
|
roomType: "",
|
|
20
20
|
type: "",
|
|
21
|
+
meubleType: [],
|
|
21
22
|
filter: "",
|
|
22
23
|
};
|
|
24
|
+
const MEUBLE_TYPES = [
|
|
25
|
+
{
|
|
26
|
+
label: "Appartement",
|
|
27
|
+
value: "APT",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Appartement dans maison",
|
|
31
|
+
value: "APT-IN-HOUSE",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: "Appartement dans un chalet",
|
|
35
|
+
value: "APT-IN-CHALET",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Chalet",
|
|
39
|
+
value: "CHALET",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Gîte rural",
|
|
43
|
+
value: "GITE-RURAL",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "Maison",
|
|
47
|
+
value: "HOUSE",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "Clévacances",
|
|
51
|
+
value: "CLEVACANCES",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: "Gîte de France",
|
|
55
|
+
value: "GITE-FRANCE",
|
|
56
|
+
},
|
|
57
|
+
];
|
|
23
58
|
export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, setShowPresetDialog, testPreset, onChange, urlOverride, }) {
|
|
24
59
|
const savedPreset = React.useRef(preset);
|
|
25
60
|
const [ready, setReady] = React.useState(false);
|
|
@@ -35,6 +70,7 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
35
70
|
const kinds = [...new Set(lodgings.map(({ kind }) => kind))];
|
|
36
71
|
const { channel, resort, facet } = preset?.options || {};
|
|
37
72
|
const showFilters = !data.lodging;
|
|
73
|
+
const showMeubleType = data.type === "MEUBLE";
|
|
38
74
|
const updateField = (field) => (value) => {
|
|
39
75
|
setData({ ...data, [field]: value });
|
|
40
76
|
};
|
|
@@ -60,6 +96,7 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
60
96
|
const selectedStandings = data.standings?.map((standing) => filters?.standings?.find((d) => d.value === standing));
|
|
61
97
|
const selectedOptions = data.options?.map((option) => filters?.options?.find((d) => d.value === option));
|
|
62
98
|
const selectedDistricts = data.districts?.map((district) => filters?.districts?.find((d) => d.value === district));
|
|
99
|
+
const selectedMeubleTypes = data.meubleType?.map((meubleType) => MEUBLE_TYPES.find((d) => d.value === meubleType));
|
|
63
100
|
const cancelPreset = () => {
|
|
64
101
|
setPreset(savedPreset.current);
|
|
65
102
|
setShowPresetDialog(false);
|
|
@@ -124,6 +161,7 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
124
161
|
options: DEFAULT_DATA.options,
|
|
125
162
|
districts: DEFAULT_DATA.districts,
|
|
126
163
|
type: DEFAULT_DATA.type,
|
|
164
|
+
meubleType: DEFAULT_DATA.meubleType,
|
|
127
165
|
}));
|
|
128
166
|
}
|
|
129
167
|
catch (e) {
|
|
@@ -148,6 +186,9 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
148
186
|
const options = data.options?.length ? data.options : undefined;
|
|
149
187
|
const districts = data.districts?.length ? data.districts : undefined;
|
|
150
188
|
const type = data.type || undefined;
|
|
189
|
+
const meubleType = data.meubleType?.length
|
|
190
|
+
? data.meubleType.join(",")
|
|
191
|
+
: undefined;
|
|
151
192
|
const roomType = data.roomType || undefined;
|
|
152
193
|
const nbRooms = data.nbRooms[0] > 0 ? data.nbRooms : undefined;
|
|
153
194
|
const previewDetails = { paxPlan, roomType };
|
|
@@ -159,6 +200,7 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
159
200
|
districts,
|
|
160
201
|
nbRooms,
|
|
161
202
|
type,
|
|
203
|
+
meubleType,
|
|
162
204
|
};
|
|
163
205
|
const newPreset = {
|
|
164
206
|
...current,
|
|
@@ -170,12 +212,12 @@ export default function Lodgings({ lang, msemServicesUrl, preset, setPreset, set
|
|
|
170
212
|
return newPreset;
|
|
171
213
|
});
|
|
172
214
|
}, [data, onChange, urlOverride, setPreset]);
|
|
173
|
-
return (_jsxs(Form, { title: "Presets h\u00E9bergements", width: 580, preset: preset, buttonsActions: { testPreset, cancelPreset, confirmPreset }, children: [_jsx("div", { className: css.label, children: "Nombre de personnes" }), _jsxs("div", { className: css.row, children: [_jsx(NumberPicker, { className: css.peopleInput, label: "Adultes", min: 0, max: 20, value: data.adults, onChange: updateField("adults"), withInput: true }), _jsx(NumberPicker, { className: css.peopleInput, label: "Enfants", min: 0, max: 9, value: data.children, onChange: updateField("children"), withInput: true })] }), _jsx("div", { className: css.label, children: "H\u00E9bergement" }), _jsx(Select, { placeholder: "S\u00E9lectionnez un h\u00E9bergement", options: formattedLodgings, value: data.lodging, onValueChange: updateField("lodging"), loading: loading }), !showFilters && (_jsxs(_Fragment, { children: [_jsx("div", { className: css.label, children: "Chambres" }), (formattedRooms?.length > 0 || loading) && (_jsx(Select, { label: "Type de bien", placeholder: "S\u00E9lectionnez un type de bien", value: data.roomType, options: formattedRooms, onValueChange: updateField("roomType"), loading: loading })), _jsx(NumberPicker, { label: "Nombre de chambres", min: 0, max: 20, value: data.nbRooms?.[0] || 0, onChange: updateRoomNb, withInput: true })] })), showFilters && (_jsxs(_Fragment, { children: [_jsx("div", { className: css.label, children: "Filtres" }), lodgings && (_jsx(MultipleSelect, { label: "Liste de marchands", options: formattedMerchants, values: selectedMerchants, onChange: updateFilter("merchants"), loading: loading, withSearch: true })), (loading || kinds.length > 1) && (_jsx(Select, { label: "Type", placeholder: "S\u00E9lectionnez un type", options: kinds, value: data.type, onValueChange: updateField("type"), loading: loading })), (loading || filters.standings.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Standing", options: filters.standings, values: selectedStandings, onChange: updateFilter("standings"), loading: loading, withSearch: true })), (loading || filters.options.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Options", options: filters.options, values: selectedOptions, onChange: updateFilter("options"), loading: loading, withSearch: true })), (loading || filters.districts.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Quartiers", options: filters.districts, values: selectedDistricts, onChange: updateFilter("districts"), loading: loading, withSearch: true })), _jsx("div", { className: css.label, children: "Avanc\u00E9" }), _jsx(Input, { className: css.input, label: "Filtre", value: data.filter, placeholder: "('10', '22') in options", onValueChange: updateField("filter") })] }))] }));
|
|
215
|
+
return (_jsxs(Form, { title: "Presets h\u00E9bergements", width: 580, preset: preset, buttonsActions: { testPreset, cancelPreset, confirmPreset }, children: [_jsx("div", { className: css.label, children: "Nombre de personnes" }), _jsxs("div", { className: css.row, children: [_jsx(NumberPicker, { className: css.peopleInput, label: "Adultes", min: 0, max: 20, value: data.adults, onChange: updateField("adults"), withInput: true }), _jsx(NumberPicker, { className: css.peopleInput, label: "Enfants", min: 0, max: 9, value: data.children, onChange: updateField("children"), withInput: true })] }), _jsx("div", { className: css.label, children: "H\u00E9bergement" }), _jsx(Select, { placeholder: "S\u00E9lectionnez un h\u00E9bergement", options: formattedLodgings, value: data.lodging, onValueChange: updateField("lodging"), loading: loading }), !showFilters && (_jsxs(_Fragment, { children: [_jsx("div", { className: css.label, children: "Chambres" }), (formattedRooms?.length > 0 || loading) && (_jsx(Select, { label: "Type de bien", placeholder: "S\u00E9lectionnez un type de bien", value: data.roomType, options: formattedRooms, onValueChange: updateField("roomType"), loading: loading })), _jsx(NumberPicker, { label: "Nombre de chambres", min: 0, max: 20, value: data.nbRooms?.[0] || 0, onChange: updateRoomNb, withInput: true })] })), showFilters && (_jsxs(_Fragment, { children: [_jsx("div", { className: css.label, children: "Filtres" }), lodgings && (_jsx(MultipleSelect, { label: "Liste de marchands", options: formattedMerchants, values: selectedMerchants, onChange: updateFilter("merchants"), loading: loading, withSearch: true })), (loading || kinds.length > 1) && (_jsx(Select, { label: "Type", placeholder: "S\u00E9lectionnez un type", options: kinds, value: data.type, onValueChange: updateField("type"), loading: loading })), showMeubleType && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Type de meubl\u00E9", options: MEUBLE_TYPES, values: selectedMeubleTypes, onChange: updateFilter("meubleType"), loading: loading })), (loading || filters.standings.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Standing", options: filters.standings, values: selectedStandings, onChange: updateFilter("standings"), loading: loading, withSearch: true })), (loading || filters.options.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Options", options: filters.options, values: selectedOptions, onChange: updateFilter("options"), loading: loading, withSearch: true })), (loading || filters.districts.length >= 1) && (_jsx(MultipleSelect, { placeholder: "Selectionnez une ou plusieurs options", label: "Quartiers", options: filters.districts, values: selectedDistricts, onChange: updateFilter("districts"), loading: loading, withSearch: true })), _jsx("div", { className: css.label, children: "Avanc\u00E9" }), _jsx(Input, { className: css.input, label: "Filtre", value: data.filter, placeholder: "('10', '22') in options", onValueChange: updateField("filter") })] }))] }));
|
|
174
216
|
}
|
|
175
217
|
function getDefaultData(preset) {
|
|
176
218
|
if (!preset?.presets && !preset?.options)
|
|
177
219
|
return DEFAULT_DATA;
|
|
178
|
-
const { merchants, accomodation, nbRooms, standings, options, districts, type, filter, } = preset?.presets || {};
|
|
220
|
+
const { merchants, accomodation, nbRooms, standings, options, districts, type, meubleType, filter, } = preset?.presets || {};
|
|
179
221
|
const { paxPlan, roomType } = preset?.options?.previewDetails || {};
|
|
180
222
|
return {
|
|
181
223
|
adults: paxPlan?.adults || DEFAULT_DATA.adults,
|
|
@@ -188,6 +230,7 @@ function getDefaultData(preset) {
|
|
|
188
230
|
options: options || DEFAULT_DATA.options,
|
|
189
231
|
districts: districts || DEFAULT_DATA.districts,
|
|
190
232
|
type: type || DEFAULT_DATA.type,
|
|
233
|
+
meubleType: meubleType?.split(",") || DEFAULT_DATA.meubleType,
|
|
191
234
|
filter: filter || DEFAULT_DATA.filter,
|
|
192
235
|
};
|
|
193
236
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ski-passes.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-passes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ski-passes.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-passes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAiFF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,eAAe,EACf,MAAM,EACN,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,KAAK,2CAgUP"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import Select from "dt-design-system/es/select";
|
|
4
|
-
import
|
|
4
|
+
import MultipleSelect from "dt-design-system/es/multiple-select";
|
|
5
|
+
import Checkbox from "dt-design-system/es/checkbox";
|
|
5
6
|
import Loader from "dt-design-system/es/loader";
|
|
6
7
|
import Input from "dt-design-system/es/input";
|
|
7
8
|
import NumberPicker from "dt-design-system/es/number-picker";
|
|
@@ -15,6 +16,8 @@ const DEFAULT_DATA = {
|
|
|
15
16
|
activities: [],
|
|
16
17
|
domains: [],
|
|
17
18
|
durations: [],
|
|
19
|
+
hide: [],
|
|
20
|
+
minimalistLiftScreen: false,
|
|
18
21
|
};
|
|
19
22
|
const ACTIVITIES_LABELS = {
|
|
20
23
|
piscine: "Piscine",
|
|
@@ -26,6 +29,24 @@ const ACTIVITIES_LABELS = {
|
|
|
26
29
|
"ski-activite": "Ski + Activités",
|
|
27
30
|
luge: "Luge sur rails",
|
|
28
31
|
};
|
|
32
|
+
const HIDE_OPTIONS = [
|
|
33
|
+
{
|
|
34
|
+
label: "Sélecteur de date de séjour",
|
|
35
|
+
value: "stay",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Sélecteur d'hébergement",
|
|
39
|
+
value: "lodging",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "Filtres",
|
|
43
|
+
value: "filters",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "Catalogue",
|
|
47
|
+
value: "catalog",
|
|
48
|
+
},
|
|
49
|
+
];
|
|
29
50
|
export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, setShowPresetDialog, onChange, testPreset, urlOverride, }) {
|
|
30
51
|
const savedPreset = React.useRef(preset);
|
|
31
52
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -57,6 +78,9 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
|
|
|
57
78
|
}, [])),
|
|
58
79
|
]
|
|
59
80
|
: []);
|
|
81
|
+
const selectedHideOptions = data.hide.map((hide) => {
|
|
82
|
+
return HIDE_OPTIONS.find((option) => option.value === hide);
|
|
83
|
+
});
|
|
60
84
|
const selectedActivities = data.activities.map((activity) => {
|
|
61
85
|
return activities.find((a) => a.value === activity);
|
|
62
86
|
});
|
|
@@ -120,6 +144,9 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
|
|
|
120
144
|
const newSkiers = !value ? [] : new Array(Number(value)).fill(code);
|
|
121
145
|
setData({ ...data, skiers: [...filteredSkiers, ...newSkiers] });
|
|
122
146
|
};
|
|
147
|
+
const updateMinimalistLiftScreen = (value) => {
|
|
148
|
+
setData({ ...data, minimalistLiftScreen: value });
|
|
149
|
+
};
|
|
123
150
|
React.useEffect(() => {
|
|
124
151
|
if (!isReady) {
|
|
125
152
|
const runEffect = async () => {
|
|
@@ -139,6 +166,7 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
|
|
|
139
166
|
const initFilters = async () => {
|
|
140
167
|
setLoading(true);
|
|
141
168
|
const filters = await API.getSkiPassesFilters(msemServicesUrl, merchant, catalog);
|
|
169
|
+
console.log(filters);
|
|
142
170
|
const filteredFilters = Object.keys(filters).reduce((acc, key) => {
|
|
143
171
|
const filter = filters[key];
|
|
144
172
|
return ALLOWED_FILTERS.includes(key)
|
|
@@ -162,15 +190,18 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
|
|
|
162
190
|
}, [catalog, merchant, msemServicesUrl]);
|
|
163
191
|
React.useEffect(() => {
|
|
164
192
|
setPreset((current = {}) => {
|
|
193
|
+
const { hide, minimalistLiftScreen, ...rest } = data;
|
|
165
194
|
const newPreset = {
|
|
166
195
|
...current,
|
|
167
196
|
options: {
|
|
168
197
|
...(current?.options || {}),
|
|
169
198
|
catalog,
|
|
199
|
+
hide,
|
|
200
|
+
minimalistLiftScreen,
|
|
170
201
|
},
|
|
171
202
|
presets: {
|
|
172
203
|
...(current?.presets || {}),
|
|
173
|
-
...
|
|
204
|
+
...rest,
|
|
174
205
|
},
|
|
175
206
|
url: urlOverride || undefined,
|
|
176
207
|
};
|
|
@@ -182,24 +213,27 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
|
|
|
182
213
|
testPreset,
|
|
183
214
|
cancelPreset,
|
|
184
215
|
confirmPreset: hasCatalog ? confirmPreset : undefined,
|
|
185
|
-
}, children: [_jsx(Select, { label: "Catalogue", value: catalog, options: catalogs ? ["", ...catalogs] : [], onValueChange: setCatalog, loading: !isReady }), loading && _jsx(Loader, { className: css.loader }), hasCatalog && (_jsxs(_Fragment, { children: [_jsx(Input, { type: "date", label: "1er jour", value: data.firstSkiDate, onValueChange: updateFirstSkiDate, defaultMonth: firstSkiDateDefaultMonth, min: stay?.from || undefined, max: stay?.to || undefined }), filters?.skiers && filters?.skiers?.length > 1 && (_jsxs("div", { className: css.skiers, children: [_jsx("div", { className: css.label, children: "Skieurs" }), filters.skiers.map((skier) => {
|
|
216
|
+
}, children: [_jsx("div", { className: css.title, children: "Options d'affichage" }), _jsx(MultipleSelect, { label: "Cacher", placeholder: "Selectionnez une ou plusieurs options", options: HIDE_OPTIONS, values: selectedHideOptions, onChange: updateField("hide") }), _jsx(Checkbox, { label: "Ecran de forfaits minimaliste", checked: data.minimalistLiftScreen, onCheckedChange: updateMinimalistLiftScreen }), _jsx("div", { className: css.title, children: "Preset" }), _jsx(Select, { label: "Catalogue", value: catalog, options: catalogs ? ["", ...catalogs] : [], onValueChange: setCatalog, loading: !isReady }), loading && _jsx(Loader, { className: css.loader }), hasCatalog && (_jsxs(_Fragment, { children: [_jsx(Input, { type: "date", label: "1er jour", value: data.firstSkiDate, onValueChange: updateFirstSkiDate, defaultMonth: firstSkiDateDefaultMonth, min: stay?.from || undefined, max: stay?.to || undefined }), filters?.skiers && filters?.skiers?.length > 1 && (_jsxs("div", { className: css.skiers, children: [_jsx("div", { className: css.label, children: "Skieurs" }), filters.skiers.map((skier) => {
|
|
186
217
|
const { code, label, ageMin, ageMax } = skier;
|
|
187
218
|
const title = `${label} (de ${ageMin} à ${ageMax} ans)`;
|
|
188
219
|
const value = data.skiers?.filter((skier) => skier === code)
|
|
189
220
|
?.length || 0;
|
|
190
221
|
return (_jsx(NumberPicker, { label: title, min: 0, max: 20, value: value, disabled: false, onChange: updateSkiers(code), withInput: true }, code));
|
|
191
|
-
})] })), _jsx("div", { className: css.label, children: "Filtres" }), (activities?.length > 0 || loading) && (_jsx(
|
|
192
|
-
loading) && (_jsx(
|
|
222
|
+
})] })), _jsx("div", { className: css.label, children: "Filtres" }), (activities?.length > 0 || loading) && (_jsx(MultipleSelect, { label: "Activit\u00E9s", placeholder: "Selectionnez une ou plusieurs options", options: activities, values: selectedActivities, onChange: updateField("activities"), loading: loading })), _jsxs("div", { className: css.row, children: [((filteredDomains && filteredDomains.length > 0) || loading) && (_jsx(MultipleSelect, { label: "Domaines", placeholder: "Selectionnez une ou plusieurs options", options: filteredDomains || [], values: selectedDomains, onChange: updateDomains, loading: loading })), ((filteredDurations && filteredDurations?.length > 0) ||
|
|
223
|
+
loading) && (_jsx(MultipleSelect, { label: "Dur\u00E9es", placeholder: "Selectionnez une ou plusieurs options", options: filteredDurations || [], values: selectedDurations, onChange: updateField("durations"), disabled: data.domains?.length === 0, loading: loading }))] })] }))] }));
|
|
193
224
|
}
|
|
194
225
|
function getDefaultData(preset) {
|
|
195
|
-
if (!preset?.presets)
|
|
226
|
+
if (!preset?.options && !preset?.presets)
|
|
196
227
|
return DEFAULT_DATA;
|
|
197
|
-
const { skiers, firstSkiDate, activities, domains, durations } = preset.presets;
|
|
228
|
+
const { skiers, firstSkiDate, activities, domains, durations } = preset.presets || {};
|
|
229
|
+
const { hide, minimalistLiftScreen } = preset.options || {};
|
|
198
230
|
return {
|
|
199
231
|
skiers: skiers || DEFAULT_DATA.skiers,
|
|
200
232
|
firstSkiDate: firstSkiDate || DEFAULT_DATA.firstSkiDate,
|
|
201
233
|
activities: activities || DEFAULT_DATA.activities,
|
|
202
234
|
domains: domains || DEFAULT_DATA.domains,
|
|
203
235
|
durations: durations || DEFAULT_DATA.durations,
|
|
236
|
+
hide: hide || DEFAULT_DATA.hide,
|
|
237
|
+
minimalistLiftScreen: minimalistLiftScreen || DEFAULT_DATA.minimalistLiftScreen,
|
|
204
238
|
};
|
|
205
239
|
}
|
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
margin-top: 10px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
.title {
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 8px;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.title::after {
|
|
19
|
+
content: "";
|
|
20
|
+
flex: 1 1 100%;
|
|
21
|
+
height: 1px;
|
|
22
|
+
margin-top: 2px;
|
|
23
|
+
background-color: var(--ds-grey-200, #ededed);
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
.row {
|
|
9
27
|
display: flex;
|
|
10
28
|
gap: 8px;
|
|
@@ -27,8 +27,8 @@ export async function getSkiPassesCatalogs(msemServicesUrl, merchant) {
|
|
|
27
27
|
return Fetcher.get(endpoint);
|
|
28
28
|
}
|
|
29
29
|
export async function getSkiPassesFilters(msemServicesUrl, merchant, catalog) {
|
|
30
|
-
const endpoint = `${msemServicesUrl}/api/ski-pass/${merchant}/filters`;
|
|
31
|
-
return Fetcher.
|
|
30
|
+
const endpoint = `${msemServicesUrl}/api/ski-pass-eliberty/${merchant}/${catalog}/filters`;
|
|
31
|
+
return Fetcher.get(endpoint);
|
|
32
32
|
}
|
|
33
33
|
export async function getLodgings(msemServicesUrl, channel, resort) {
|
|
34
34
|
const endpoint = `${msemServicesUrl}/api/lodging/getAccommodationsStructure`;
|