ublo-lib 1.47.11 → 1.47.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 +1 -2
- package/es/future/components/msem-preset-editor/editors/ski-rental.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/ski-rental.js +56 -15
- package/es/future/components/msem-preset-editor/msem-preset-editor.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/msem-preset-editor.js +3 -1
- 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;AAS/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;AAYF,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;AAS/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;AAYF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,EAAE,KAAK,2CAwKP"}
|
|
@@ -52,8 +52,7 @@ export default function WidgetListItem({ item, preset, updatePreset, removePrese
|
|
|
52
52
|
"otherProducts",
|
|
53
53
|
...ALLOW_PRESETS_ON_WIDGETS,
|
|
54
54
|
];
|
|
55
|
-
const
|
|
56
|
-
const allowAdvancedPresets = !isSkiRental && allowedWidgets.includes(sub.widget);
|
|
55
|
+
const allowAdvancedPresets = allowedWidgets.includes(sub.widget);
|
|
57
56
|
const showEditButton = isSelected && allowAdvancedPresets;
|
|
58
57
|
const showButtons = showEditButton || isSelected;
|
|
59
58
|
const classes = classNames(css.sub, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ski-rental.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-rental.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ski-rental.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-rental.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/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,KAAK,EAAE,MAAM,CAAC;IACd,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;CACxB,CAAC;AAeF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,eAAe,EACf,MAAM,EACN,SAAS,EAET,mBAAmB,EACnB,QAAQ,EACR,UAAU,GACX,EAAE,KAAK,2CAwKP"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import MultipleSelect from "dt-design-system/es/multiple-select";
|
|
4
|
+
import NumberPicker from "dt-design-system/es/number-picker";
|
|
5
|
+
import Input from "dt-design-system/es/input";
|
|
4
6
|
import Form from "../components/form";
|
|
5
7
|
import * as API from "../services/api";
|
|
6
8
|
const DEFAULT_LISTING_DATA = {
|
|
7
9
|
merchants: [],
|
|
8
10
|
};
|
|
9
11
|
const DEFAULT_DATA = {
|
|
10
|
-
|
|
12
|
+
catalog: "",
|
|
13
|
+
duration: 0,
|
|
11
14
|
rentFrom: "",
|
|
12
15
|
activity: "",
|
|
13
16
|
level: "",
|
|
@@ -19,7 +22,8 @@ export default function SkiRental({ msemServicesUrl, preset, setPreset, setShowP
|
|
|
19
22
|
const mode = merchant === undefined ? "LISTING" : "MERCHANT";
|
|
20
23
|
const [loading, setLoading] = React.useState(false);
|
|
21
24
|
const [merchantList, setMerchantList] = React.useState([]);
|
|
22
|
-
const [merchants, setMerchants] = React.useState(getDefaultData(preset,
|
|
25
|
+
const [merchants, setMerchants] = React.useState(getDefaultData(preset, "LISTING"));
|
|
26
|
+
const [data, setData] = React.useState(getDefaultData(preset, "MERCHANT"));
|
|
23
27
|
const formattedMerchants = merchantList.map(({ name, code }) => {
|
|
24
28
|
return { label: name, value: code };
|
|
25
29
|
});
|
|
@@ -33,6 +37,15 @@ export default function SkiRental({ msemServicesUrl, preset, setPreset, setShowP
|
|
|
33
37
|
const updateMerchants = (newValue) => {
|
|
34
38
|
setMerchants(newValue.map((v) => v.value));
|
|
35
39
|
};
|
|
40
|
+
const updateData = (field) => (newValue) => {
|
|
41
|
+
setData((current = {}) => {
|
|
42
|
+
const newData = {
|
|
43
|
+
...current,
|
|
44
|
+
[field]: newValue,
|
|
45
|
+
};
|
|
46
|
+
return newData;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
36
49
|
React.useEffect(() => {
|
|
37
50
|
const runEffect = async () => {
|
|
38
51
|
try {
|
|
@@ -51,23 +64,49 @@ export default function SkiRental({ msemServicesUrl, preset, setPreset, setShowP
|
|
|
51
64
|
}, []);
|
|
52
65
|
React.useEffect(() => {
|
|
53
66
|
setPreset((current = {}) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
let newPreset = current;
|
|
68
|
+
if (mode === "LISTING") {
|
|
69
|
+
newPreset = {
|
|
70
|
+
...current,
|
|
71
|
+
presets: {
|
|
72
|
+
...(current?.presets || {}),
|
|
73
|
+
merchants,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (mode === "MERCHANT") {
|
|
78
|
+
const catalog = data.catalog || undefined;
|
|
79
|
+
const duration = data.duration || undefined;
|
|
80
|
+
const rentFrom = data.rentFrom || undefined;
|
|
81
|
+
const activity = data.activity || undefined;
|
|
82
|
+
const level = data.level || undefined;
|
|
83
|
+
const productId = data.productId || undefined;
|
|
84
|
+
newPreset = {
|
|
85
|
+
...current,
|
|
86
|
+
presets: {
|
|
87
|
+
...(current?.presets || {}),
|
|
88
|
+
duration,
|
|
89
|
+
rentFrom,
|
|
90
|
+
activity,
|
|
91
|
+
level,
|
|
92
|
+
productId,
|
|
93
|
+
},
|
|
94
|
+
options: {
|
|
95
|
+
...(current?.options || {}),
|
|
96
|
+
catalog,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
61
100
|
onChange?.(newPreset);
|
|
62
101
|
return newPreset;
|
|
63
102
|
});
|
|
64
|
-
}, [
|
|
103
|
+
}, [data, merchants, mode, onChange, setPreset]);
|
|
65
104
|
const selectedMerchants = merchants?.map((merchant) => formattedMerchants.find((d) => d.value === merchant));
|
|
66
|
-
return (
|
|
105
|
+
return (_jsxs(Form, { title: "Presets loueurs de mat\u00E9riel", width: 420, preset: preset, buttonsActions: {
|
|
67
106
|
testPreset,
|
|
68
107
|
cancelPreset,
|
|
69
|
-
confirmPreset
|
|
70
|
-
}, children: mode === "LISTING" && merchantList?.length > 0 && (_jsx(MultipleSelect, { label: "Liste de marchands", options: formattedMerchants, values: selectedMerchants, onChange: updateMerchants, disabled: loading, withSearch: true })) }));
|
|
108
|
+
confirmPreset,
|
|
109
|
+
}, children: [mode === "LISTING" && merchantList?.length > 0 && (_jsx(MultipleSelect, { label: "Liste de marchands", options: formattedMerchants, values: selectedMerchants, onChange: updateMerchants, disabled: loading, withSearch: true })), mode === "MERCHANT" && (_jsxs(_Fragment, { children: [_jsx(Input, { label: "Catalogue", value: data.catalog || DEFAULT_DATA.catalog, onValueChange: updateData("catalog"), disabled: loading }), _jsx(Input, { type: "date", label: "Date de d\u00E9but", value: data.rentFrom || DEFAULT_DATA.rentFrom, onValueChange: updateData("rentFrom"), disabled: loading }), _jsx(NumberPicker, { label: "Dur\u00E9e", value: data.duration || DEFAULT_DATA.duration, onChange: updateData("duration"), disabled: loading }), _jsx(Input, { label: "Activit\u00E9", value: data.activity || DEFAULT_DATA.activity, onValueChange: updateData("activity"), disabled: loading }), _jsx(Input, { label: "Niveau", value: data.level || DEFAULT_DATA.level, onValueChange: updateData("level"), disabled: loading }), _jsx(Input, { label: "Id produit", value: data.productId || DEFAULT_DATA.productId, onValueChange: updateData("productId"), disabled: loading })] }))] }));
|
|
71
110
|
}
|
|
72
111
|
function getDefaultData(preset, mode) {
|
|
73
112
|
if (mode === "LISTING") {
|
|
@@ -79,8 +118,10 @@ function getDefaultData(preset, mode) {
|
|
|
79
118
|
else {
|
|
80
119
|
if (!preset?.presets)
|
|
81
120
|
return DEFAULT_DATA;
|
|
82
|
-
const {
|
|
121
|
+
const { catalog } = preset.options;
|
|
122
|
+
const { duration, rentFrom, activity, level, productId } = preset.presets || {};
|
|
83
123
|
return {
|
|
124
|
+
catalog: catalog || DEFAULT_DATA.catalog,
|
|
84
125
|
duration: duration || DEFAULT_DATA.duration,
|
|
85
126
|
rentFrom: rentFrom || DEFAULT_DATA.rentFrom,
|
|
86
127
|
activity: activity || DEFAULT_DATA.activity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msem-preset-editor.d.ts","sourceRoot":"","sources":["../../../../src/future/components/msem-preset-editor/msem-preset-editor.tsx"],"names":[],"mappings":"AAmBA,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"msem-preset-editor.d.ts","sourceRoot":"","sources":["../../../../src/future/components/msem-preset-editor/msem-preset-editor.tsx"],"names":[],"mappings":"AAmBA,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,GACT,EAAE,KAAK,2CA0NP"}
|
|
@@ -16,7 +16,9 @@ import * as UrlParams from "./services/url-params";
|
|
|
16
16
|
import * as Preset from "./services/preset";
|
|
17
17
|
import css from "./msem-preset-editor.module.css";
|
|
18
18
|
export default function MseMPresetEditor({ lang, channel, resort, msemServicesUrl, urlOverride, resorts, currentPreset, onChange, showUrl, facet, hideStay, }) {
|
|
19
|
-
const defaultResort = Number(currentPreset
|
|
19
|
+
const defaultResort = Number(currentPreset
|
|
20
|
+
? currentPreset.options.resort
|
|
21
|
+
: resort || resorts?.[0]?.value);
|
|
20
22
|
const [selectedResort, setSelectedResort] = React.useState(defaultResort);
|
|
21
23
|
const [selectedFacet, setSelectedFacet] = React.useState(facet?.toString() || currentPreset?.options?.facet?.toString() || "");
|
|
22
24
|
const [stay, setStay] = React.useState(currentPreset?.presets?.stay || { from: "", to: "" });
|