ublo-lib 1.47.118 → 1.48.1
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-package/components/config.d.ts +10 -0
- package/es/future/components/msem-package/components/config.d.ts.map +1 -0
- package/es/future/components/msem-package/components/config.js +42 -0
- package/es/future/components/msem-package/components/config.module.css +3 -0
- package/es/future/components/msem-package/components/filters.d.ts +10 -0
- package/es/future/components/msem-package/components/filters.d.ts.map +1 -0
- package/es/future/components/msem-package/components/filters.js +63 -0
- package/es/future/components/msem-package/components/filters.module.css +64 -0
- package/es/future/components/msem-package/components/global-settings.d.ts +9 -0
- package/es/future/components/msem-package/components/global-settings.d.ts.map +1 -0
- package/es/future/components/msem-package/components/global-settings.js +29 -0
- package/es/future/components/msem-package/components/global-settings.module.css +42 -0
- package/es/future/components/msem-package/components/stay-settings.d.ts +9 -0
- package/es/future/components/msem-package/components/stay-settings.d.ts.map +1 -0
- package/es/future/components/msem-package/components/stay-settings.js +32 -0
- package/es/future/components/msem-package/components/stay-settings.module.css +59 -0
- package/es/future/components/msem-package/components/widget-dialog.d.ts +12 -0
- package/es/future/components/msem-package/components/widget-dialog.d.ts.map +1 -0
- package/es/future/components/msem-package/components/widget-dialog.js +71 -0
- package/es/future/components/msem-package/components/widget-dialog.module.css +89 -0
- package/es/future/components/msem-package/components/widget.d.ts +16 -0
- package/es/future/components/msem-package/components/widget.d.ts.map +1 -0
- package/es/future/components/msem-package/components/widget.js +129 -0
- package/es/future/components/msem-package/components/widget.module.css +125 -0
- package/es/future/components/msem-package/components/widgets-settings.d.ts +10 -0
- package/es/future/components/msem-package/components/widgets-settings.d.ts.map +1 -0
- package/es/future/components/msem-package/components/widgets-settings.js +81 -0
- package/es/future/components/msem-package/components/widgets-settings.module.css +116 -0
- package/es/future/components/msem-package/components/widgets-zones.d.ts +7 -0
- package/es/future/components/msem-package/components/widgets-zones.d.ts.map +1 -0
- package/es/future/components/msem-package/components/widgets-zones.js +18 -0
- package/es/future/components/msem-package/components/widgets-zones.module.css +29 -0
- package/es/future/components/msem-package/components/widgets.d.ts +9 -0
- package/es/future/components/msem-package/components/widgets.d.ts.map +1 -0
- package/es/future/components/msem-package/components/widgets.js +58 -0
- package/es/future/components/msem-package/components/widgets.module.css +42 -0
- package/es/future/components/msem-package/i18n/en.json +25 -0
- package/es/future/components/msem-package/i18n/es.json +25 -0
- package/es/future/components/msem-package/i18n/fr.json +25 -0
- package/es/future/components/msem-package/i18n/translations.d.ts +7 -0
- package/es/future/components/msem-package/i18n/translations.d.ts.map +1 -0
- package/es/future/components/msem-package/i18n/translations.js +21 -0
- package/es/future/components/msem-package/index.d.ts +4 -0
- package/es/future/components/msem-package/index.d.ts.map +1 -0
- package/es/future/components/msem-package/index.js +3 -0
- package/es/future/components/msem-package/msem-package.d.ts +8 -0
- package/es/future/components/msem-package/msem-package.d.ts.map +1 -0
- package/es/future/components/msem-package/msem-package.js +17 -0
- package/es/future/components/msem-package/msem-package.module.css +5 -0
- package/es/future/components/msem-package/types.d.ts +37 -0
- package/es/future/components/msem-package/types.d.ts.map +1 -0
- package/es/future/components/msem-package/types.js +1 -0
- package/es/future/components/msem-package/utils/api.d.ts +2 -0
- package/es/future/components/msem-package/utils/api.d.ts.map +1 -0
- package/es/future/components/msem-package/utils/api.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
idPrefix: string;
|
|
5
|
+
config: Types.Config;
|
|
6
|
+
setConfig: React.Dispatch<React.SetStateAction<Types.Config>>;
|
|
7
|
+
};
|
|
8
|
+
export default function Config({ idPrefix, config, setConfig }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/config.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAIvC,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CA8CpE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
4
|
+
import Zone from "ublo/zone";
|
|
5
|
+
import styles from "./config.module.css";
|
|
6
|
+
export default function Config({ idPrefix, config, setConfig }) {
|
|
7
|
+
const ref = React.useRef(null);
|
|
8
|
+
const { menuPath } = useUbloContext();
|
|
9
|
+
const [initialized, setInitialized] = React.useState(false);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (!initialized) {
|
|
12
|
+
const container = ref.current;
|
|
13
|
+
let script = container?.querySelector("script");
|
|
14
|
+
if (!script) {
|
|
15
|
+
script = Object.assign(document.createElement("script"), {
|
|
16
|
+
type: "application/json",
|
|
17
|
+
innerHTML: "{}",
|
|
18
|
+
});
|
|
19
|
+
container.appendChild(script);
|
|
20
|
+
}
|
|
21
|
+
const storedConfig = script.textContent;
|
|
22
|
+
if (storedConfig) {
|
|
23
|
+
const config = JSON.parse(storedConfig);
|
|
24
|
+
setConfig({
|
|
25
|
+
...config,
|
|
26
|
+
id: config.id || `${idPrefix}-${menuPath?.id}`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
setInitialized(true);
|
|
30
|
+
}
|
|
31
|
+
}, [initialized, setConfig, idPrefix, menuPath?.id]);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
const container = ref.current;
|
|
34
|
+
if (initialized && container) {
|
|
35
|
+
const script = container.querySelector("script");
|
|
36
|
+
if (script) {
|
|
37
|
+
script.textContent = JSON.stringify(config);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [config, initialized]);
|
|
41
|
+
return (_jsx(Zone, { ref: ref, id: "package-config", className: styles.zone, readOnly: true }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
config: Types.Config;
|
|
5
|
+
stay: Types.Stay;
|
|
6
|
+
setStay: React.Dispatch<React.SetStateAction<Types.Stay>>;
|
|
7
|
+
};
|
|
8
|
+
export default function Filters({ config, stay, setStay }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/filters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAIvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;CAC3D,CAAC;AAMF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,2CA+I/D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
4
|
+
import Input from "dt-design-system/es/input";
|
|
5
|
+
import Dropdown from "dt-design-system/es/dropdown";
|
|
6
|
+
import DatePicker, { Utils } from "../../../../common/components/date-picker";
|
|
7
|
+
import T, { t } from "../i18n/translations";
|
|
8
|
+
import styles from "./filters.module.css";
|
|
9
|
+
export default function Filters({ config, stay, setStay }) {
|
|
10
|
+
const ref = React.useRef(null);
|
|
11
|
+
const { lang } = useUbloContext();
|
|
12
|
+
const [stayDates, setStayDates] = React.useState([]);
|
|
13
|
+
const [datePickerOpen, setDatePickerOpen] = React.useState(false);
|
|
14
|
+
const [datePickerOptions, setDatePickerOptions] = React.useState();
|
|
15
|
+
const { from: min, to: max, forced, fixed, nbDays } = config.stay || {};
|
|
16
|
+
const { paxPlan } = config;
|
|
17
|
+
const usedMax = fixed
|
|
18
|
+
? Utils.getDateISO(Utils.addDays(max, -nbDays + 1))
|
|
19
|
+
: max;
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
if (forced) {
|
|
22
|
+
setStay({ from: min, to: usedMax });
|
|
23
|
+
}
|
|
24
|
+
}, [forced, usedMax, min, setStay]);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
if (stay) {
|
|
27
|
+
const { from, to } = stay;
|
|
28
|
+
const fromDate = new Date(from);
|
|
29
|
+
fromDate.setHours(0, 0, 0, 0);
|
|
30
|
+
const toDate = new Date(to);
|
|
31
|
+
toDate.setHours(0, 0, 0, 0);
|
|
32
|
+
const interval = Utils.getDateInterval(fromDate, toDate);
|
|
33
|
+
setStayDates(interval);
|
|
34
|
+
}
|
|
35
|
+
}, [stay]);
|
|
36
|
+
const scrollToFilters = () => {
|
|
37
|
+
window.requestAnimationFrame(() => {
|
|
38
|
+
ref.current.scrollIntoView({ behavior: "smooth" });
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const openDatePicker = (options = {}) => {
|
|
42
|
+
setDatePickerOpen(true);
|
|
43
|
+
setDatePickerOptions(options);
|
|
44
|
+
scrollToFilters();
|
|
45
|
+
};
|
|
46
|
+
const closeDatePicker = () => {
|
|
47
|
+
setDatePickerOpen(false);
|
|
48
|
+
setDatePickerOptions(undefined);
|
|
49
|
+
};
|
|
50
|
+
const updateStay = (data) => {
|
|
51
|
+
if (data.length === 0)
|
|
52
|
+
return;
|
|
53
|
+
const from = Utils.getDateISO(data[0]);
|
|
54
|
+
const to = fixed
|
|
55
|
+
? Utils.getDateISO(Utils.addDays(data[0], nbDays - 1))
|
|
56
|
+
: Utils.getDateISO(data[data.length - 1]);
|
|
57
|
+
const newStay = { from, to };
|
|
58
|
+
setStay(newStay);
|
|
59
|
+
closeDatePicker();
|
|
60
|
+
};
|
|
61
|
+
const titleKey = forced ? "filters.fixed-title" : "filters.title";
|
|
62
|
+
return (_jsx("div", { ref: ref, className: styles.filters, style: { display: forced ? "none" : "block" }, children: _jsxs("div", { className: styles.form, children: [_jsx("div", { className: styles.title, children: _jsx(T, { id: titleKey }) }), fixed && (_jsxs("div", { className: styles.subtitle, children: [_jsx(T, { id: "filters.subtitle" }), _jsxs("span", { className: styles.bold, children: [nbDays, " ", _jsx(T, { id: "filters.day" }), nbDays > 1 ? "s" : ""] })] })), _jsxs("div", { className: styles.inner, children: [_jsx(Dropdown, { open: datePickerOpen, onClose: closeDatePicker, onOpenChange: (open) => setDatePickerOpen(open), breakpoint: 600, content: _jsx(DatePicker, { stayDates: stayDates, popup: false, close: closeDatePicker, onSubmit: updateStay, min: min, max: usedMax, singleDate: fixed, submitOnSelectionEnd: fixed, ...datePickerOptions }), children: _jsx(Input, { type: "text", icon: "Calendar", className: styles.field, label: t(lang, "filters.stay-from-label"), placeholder: t(lang, "filters.stay-from-placeholder"), value: stay?.from ? Utils.weekToLongDate(stay.from) : "", onClick: () => openDatePicker(), readOnly: true, disabled: forced }) }, JSON.stringify(datePickerOptions)), _jsx(Input, { type: "text", icon: "Calendar", className: styles.field, label: t(lang, "filters.stay-to-label"), placeholder: t(lang, "filters.stay-to-placeholder"), value: stay?.to ? Utils.weekToLongDate(stay?.to || "") : "", onClick: () => openDatePicker({ defaultSelecting: true }), readOnly: true, disabled: forced || fixed || !stay?.from }), _jsxs("div", { className: styles.pax, children: [_jsx(Input, { icon: "User", type: "number", label: t(lang, "filters.pax"), className: styles.field, value: paxPlan || "", disabled: true }), _jsxs("span", { className: styles.paxMessage, children: [_jsx(T, { id: "filters.pax-message" }), " ", paxPlan] })] })] })] }) }));
|
|
63
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.filters {
|
|
2
|
+
padding: 10px;
|
|
3
|
+
background-color: var(--ds-grey-100, #f8f8f8);
|
|
4
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@media (min-width: 1320px) {
|
|
8
|
+
.filters {
|
|
9
|
+
padding: 40px 10px;
|
|
10
|
+
border-radius: 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.form {
|
|
15
|
+
width: min(100%, 900px);
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
margin: 0 auto;
|
|
20
|
+
padding: 16px;
|
|
21
|
+
background-color: var(--ds-grey-000, #fff);
|
|
22
|
+
border: 1px solid var(--ds-grey-200, #ededed);
|
|
23
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.title {
|
|
27
|
+
font-size: 17px;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
}
|
|
30
|
+
.subtitle {
|
|
31
|
+
font-size: 15px;
|
|
32
|
+
margin-bottom: 8px;
|
|
33
|
+
}
|
|
34
|
+
.bold {
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
}
|
|
37
|
+
.inner {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: 8px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (min-width: 640px) {
|
|
44
|
+
.inner {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.field {
|
|
50
|
+
--ds-input-padding: 13px;
|
|
51
|
+
|
|
52
|
+
flex: 1 1 auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pax {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 4px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.paxMessage {
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
color: var(--ds-grey-600, #484848);
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
config: Types.Config;
|
|
5
|
+
setConfig: React.Dispatch<React.SetStateAction<Types.Config>>;
|
|
6
|
+
};
|
|
7
|
+
export default function GlobalSettings({ config, setConfig }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=global-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-settings.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/global-settings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAGvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAYF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CAyDlE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Select from "dt-design-system/es/select";
|
|
3
|
+
import Input from "dt-design-system/es/input";
|
|
4
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
5
|
+
import styles from "./global-settings.module.css";
|
|
6
|
+
const FACET_OPTIONS = [
|
|
7
|
+
{ value: "0", label: "Hiver" },
|
|
8
|
+
{ value: "1", label: "Été" },
|
|
9
|
+
];
|
|
10
|
+
const PAX = {
|
|
11
|
+
MIN: 0,
|
|
12
|
+
MAX: 20,
|
|
13
|
+
};
|
|
14
|
+
export default function GlobalSettings({ config, setConfig }) {
|
|
15
|
+
const updateName = (value) => {
|
|
16
|
+
setConfig((prev) => ({ ...prev, name: value }));
|
|
17
|
+
};
|
|
18
|
+
const updateFacet = (value) => {
|
|
19
|
+
const facet = Number(value);
|
|
20
|
+
setConfig((prev) => ({ ...prev, facet }));
|
|
21
|
+
};
|
|
22
|
+
const updatePaxPlan = (value) => {
|
|
23
|
+
const paxPlan = isNaN(Number(value))
|
|
24
|
+
? 0
|
|
25
|
+
: Math.min(Math.max(Number(value), PAX.MIN), PAX.MAX);
|
|
26
|
+
setConfig((prev) => ({ ...prev, paxPlan }));
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.title, children: [_jsx(Icons.Tune, {}), "Param\u00E8tres g\u00E9n\u00E9raux"] }), _jsxs("div", { className: styles.settings, children: [_jsx(Input, { label: "Nom du package", value: config.name, onValueChange: updateName, className: styles.field }), _jsx(Input, { label: "Identifiant", value: config.id, onValueChange: updateName, className: styles.field, disabled: true }), _jsx(Select, { label: "Facette", placeholder: "Choisissez une facette", options: FACET_OPTIONS, value: config.facet, onValueChange: updateFacet, className: styles.field }), _jsx(Input, { type: "number", label: "Nombre de personne(s)", value: config.paxPlan || "0", onValueChange: updatePaxPlan, className: styles.field, min: "0", max: "20" })] })] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
width: min(calc(100% - 20px), 840px);
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
margin-inline: auto;
|
|
7
|
+
padding: 12px;
|
|
8
|
+
border: 1px solid var(--ds-grey-200, #ededed);
|
|
9
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.title {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
margin-bottom: 8px;
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title > svg {
|
|
22
|
+
flex: 0 0 22px;
|
|
23
|
+
height: 22px;
|
|
24
|
+
fill: currentcolor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.settings {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: flex-end;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
gap: 12px 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.field {
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (width > 700px) {
|
|
39
|
+
.field {
|
|
40
|
+
flex: 1 1 49%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
config: Types.Config;
|
|
5
|
+
setConfig: React.Dispatch<React.SetStateAction<Types.Config>>;
|
|
6
|
+
};
|
|
7
|
+
export default function StaySettings({ config, setConfig }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=stay-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stay-settings.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/stay-settings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAGvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CA+EhE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Input from "dt-design-system/es/input";
|
|
3
|
+
import Checkbox from "dt-design-system/es/checkbox";
|
|
4
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
5
|
+
import styles from "./stay-settings.module.css";
|
|
6
|
+
export default function StaySettings({ config, setConfig }) {
|
|
7
|
+
const updateStay = (key) => (value) => {
|
|
8
|
+
setConfig((prev) => ({
|
|
9
|
+
...prev,
|
|
10
|
+
stay: { ...prev.stay, [key]: value },
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
const updateNbDays = (value) => {
|
|
14
|
+
setConfig((prev) => ({
|
|
15
|
+
...prev,
|
|
16
|
+
stay: { ...prev.stay, nbDays: parseInt(value) },
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
const updateForced = (forced) => {
|
|
20
|
+
setConfig((prev) => ({
|
|
21
|
+
...prev,
|
|
22
|
+
stay: { ...prev.stay, forced, fixed: false },
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
const updateFixed = (fixed) => {
|
|
26
|
+
setConfig((prev) => ({
|
|
27
|
+
...prev,
|
|
28
|
+
stay: { ...prev.stay, fixed, forced: false },
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.title, children: [_jsx(Icons.Calendar, {}), "Param\u00E8tres de validit\u00E9 de l'offre"] }), _jsxs("div", { className: styles.settings, children: [_jsx(Input, { label: "D\u00E9but de validit\u00E9 de l'offre", type: "date", value: config.stay?.from || "", onValueChange: updateStay("from"), className: styles.field }), _jsx(Input, { label: "Fin de validit\u00E9 de l'offre", type: "date", value: config.stay?.to || "", onValueChange: updateStay("to"), className: styles.field }), _jsxs("div", { className: styles.checkboxes, children: [_jsx(Checkbox, { label: "Verrouiller ces dates de validit\u00E9", checked: config.stay?.forced || false, onCheckedChange: updateForced }), _jsx(Checkbox, { label: _jsxs("div", { className: styles.nbDaysLabel, children: [_jsx("span", { children: "Fixer l'offre \u00E0" }), _jsx(Input, { value: config.stay?.nbDays || "", onValueChange: updateNbDays, className: styles.nbDaysInput, disabled: !config.stay?.fixed, compact: true, type: "number", min: 1 }), _jsx("span", { children: "jour(s)" })] }), checked: config.stay?.fixed || false, onCheckedChange: updateFixed })] })] })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
width: min(calc(100% - 20px), 840px);
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
margin-inline: auto;
|
|
7
|
+
padding: 12px;
|
|
8
|
+
border: 1px solid var(--ds-grey-200, #ededed);
|
|
9
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.title {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
margin-bottom: 8px;
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title > svg {
|
|
22
|
+
flex: 0 0 22px;
|
|
23
|
+
height: 22px;
|
|
24
|
+
fill: currentcolor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.settings {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: flex-end;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
gap: 12px 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.field {
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (width > 700px) {
|
|
39
|
+
.field {
|
|
40
|
+
flex: 1 1 0%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.checkboxes {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: 4px;
|
|
48
|
+
}
|
|
49
|
+
.checkbox {
|
|
50
|
+
flex: 1 1 100%;
|
|
51
|
+
}
|
|
52
|
+
.nbDaysLabel {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 4px;
|
|
56
|
+
}
|
|
57
|
+
.nbDaysInput {
|
|
58
|
+
width: 45px;
|
|
59
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
config: Types.Config;
|
|
5
|
+
setConfig: React.Dispatch<React.SetStateAction<Types.Config>>;
|
|
6
|
+
editorOptions: Types.EditorOptions;
|
|
7
|
+
widget: Types.Widget;
|
|
8
|
+
closeWidgetDialog: () => void;
|
|
9
|
+
};
|
|
10
|
+
export default function WidgetDialog({ config, setConfig, editorOptions, widget, closeWidgetDialog, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=widget-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-dialog.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/widget-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAIvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,MAAM,EACN,SAAS,EACT,aAAa,EACb,MAAM,EACN,iBAAiB,GAClB,EAAE,KAAK,2CAuJP"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
4
|
+
import Button from "dt-design-system/es/button";
|
|
5
|
+
import Input from "dt-design-system/es/input";
|
|
6
|
+
import Dialog from "dt-design-system/es/dialog";
|
|
7
|
+
import Checkbox from "dt-design-system/es/checkbox";
|
|
8
|
+
import MseMPresetEditor from "../../msem-preset-editor";
|
|
9
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
10
|
+
import styles from "./widget-dialog.module.css";
|
|
11
|
+
export default function WidgetDialog({ config, setConfig, editorOptions, widget, closeWidgetDialog, }) {
|
|
12
|
+
const { lang } = useUbloContext();
|
|
13
|
+
const { facet } = config;
|
|
14
|
+
const editorLang = lang === "fr" ? "fr" : "en";
|
|
15
|
+
const { channel, resort, msemServicesUrl } = editorOptions;
|
|
16
|
+
const [repeatable, setRepeatable] = React.useState(widget.repeatable);
|
|
17
|
+
const isNew = widget.id === "new";
|
|
18
|
+
const isOptional = widget.optional;
|
|
19
|
+
const title = isNew ? "Nouvelle offre" : "Modifier l'offre";
|
|
20
|
+
const defaultPreset = getDefaultPreset(widget);
|
|
21
|
+
const [preset, setPreset] = React.useState(defaultPreset);
|
|
22
|
+
const [image, setImage] = React.useState(widget.image);
|
|
23
|
+
const updateImage = (path) => {
|
|
24
|
+
setImage(path);
|
|
25
|
+
};
|
|
26
|
+
const submit = React.useCallback((e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
const form = e.currentTarget;
|
|
29
|
+
const formData = new FormData(form);
|
|
30
|
+
const title = formData.get("title");
|
|
31
|
+
const tagline = formData.get("tagline");
|
|
32
|
+
const maxParticipants = parseInt(formData.get("maxParticipants"));
|
|
33
|
+
const { name, widget: widgetName, options, presets } = preset;
|
|
34
|
+
const id = isNew ? crypto.randomUUID() : widget.id;
|
|
35
|
+
const data = {
|
|
36
|
+
name,
|
|
37
|
+
widget: widgetName,
|
|
38
|
+
title,
|
|
39
|
+
tagline,
|
|
40
|
+
image,
|
|
41
|
+
options,
|
|
42
|
+
presets,
|
|
43
|
+
repeatable,
|
|
44
|
+
maxParticipants: isNaN(maxParticipants) ? undefined : maxParticipants,
|
|
45
|
+
};
|
|
46
|
+
const existingWidgets = (isOptional ? config.optionalWidgets : config.widgets) || [];
|
|
47
|
+
const newConfig = {
|
|
48
|
+
...config,
|
|
49
|
+
[isOptional ? "optionalWidgets" : "widgets"]: isNew
|
|
50
|
+
? [...existingWidgets, { ...widget, id, ...data }]
|
|
51
|
+
: existingWidgets.map((w) => {
|
|
52
|
+
return w.id === widget.id ? { ...w, ...data } : w;
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
setConfig(newConfig);
|
|
56
|
+
}, [config, image, isNew, isOptional, preset, setConfig, widget, repeatable]);
|
|
57
|
+
return (_jsx(Dialog, { className: styles.dialog, close: closeWidgetDialog, showAsModal: false, closeOnBackdropClick: false, isOpened: true, children: _jsxs("div", { className: styles.inner, children: [_jsxs("div", { className: styles.title, children: [_jsx(Icons.ShoppingBag, {}), title] }), _jsxs("form", { className: styles.form, onSubmit: submit, children: [_jsxs("div", { className: styles.top, children: [_jsx("div", { className: styles.left, children: _jsx(Button, { className: styles.image, variant: "transparent", onClick: () => window?.Cms?.fileManager(updateImage, 150, 100), children: image ? _jsx("img", { src: image, alt: "" }) : _jsx(Icons.Image, {}) }) }), _jsxs("div", { className: styles.right, children: [_jsx(Input, { label: "Titre", name: "title", defaultValue: widget.title }), _jsx(Input, { label: "Phrase d'accroche", name: "tagline", defaultValue: widget.tagline })] })] }), _jsxs("div", { className: styles.editor, children: [_jsx("div", { className: styles.editorTitle, children: "Preset" }), _jsx(MseMPresetEditor, { lang: editorLang, channel: channel, resort: String(resort), msemServicesUrl: msemServicesUrl, facet: facet, currentPreset: preset, onChange: setPreset, hideStay: true })] }), _jsxs("div", { className: styles.checkboxes, children: [!isOptional && (_jsx(Checkbox, { label: "R\u00E9p\u00E9ter le widget pour chaque participant", name: "repeatable", checked: repeatable, onChange: (e) => setRepeatable(e.target.checked) })), isOptional && (_jsx(Checkbox, { label: _jsxs("div", { className: styles.nbParticipantsLabel, children: [_jsx("span", { children: "R\u00E9p\u00E9ter le widget jusqu'\u00E0" }), _jsx(Input, { name: "maxParticipants", defaultValue: widget.maxParticipants || config.paxPlan, className: styles.nbParticipantsInput, disabled: !repeatable, compact: true, type: "number", min: config.paxPlan }), _jsx("span", { children: "fois" })] }), name: "repeatManually", checked: repeatable, onChange: (e) => setRepeatable(e.target.checked) }))] }), _jsx("div", { className: styles.controls, children: _jsxs(Button, { type: "submit", variant: "success", className: styles.save, children: [_jsx(Icons.Check, {}), "Confirmer"] }) })] })] }) }));
|
|
58
|
+
}
|
|
59
|
+
function getDefaultPreset(widget) {
|
|
60
|
+
const { name, widget: widgetName, options, presets } = widget;
|
|
61
|
+
const defaultData = { name, widget: widgetName };
|
|
62
|
+
const hasOptions = options && Object.keys(options).length > 0;
|
|
63
|
+
const hasPresets = presets && Object.keys(presets).length > 0;
|
|
64
|
+
if (hasOptions && hasPresets)
|
|
65
|
+
return { ...defaultData, options, presets };
|
|
66
|
+
if (hasOptions)
|
|
67
|
+
return { ...defaultData, options };
|
|
68
|
+
if (hasPresets)
|
|
69
|
+
return { ...defaultData, presets };
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.inner {
|
|
2
|
+
max-width: 576px;
|
|
3
|
+
padding: 16px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.title {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 6px;
|
|
10
|
+
margin-bottom: 8px;
|
|
11
|
+
padding-right: 30px;
|
|
12
|
+
font-size: 18px;
|
|
13
|
+
font-weight: 700;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title > svg {
|
|
17
|
+
flex: 0 0 22px;
|
|
18
|
+
height: 22px;
|
|
19
|
+
fill: currentcolor;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.form {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
gap: 12px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.top {
|
|
29
|
+
width: 100%;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
gap: 12px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.left {
|
|
36
|
+
flex: 0 0 150px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.right {
|
|
40
|
+
flex: 1 1 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.image {
|
|
44
|
+
width: 150px;
|
|
45
|
+
height: 100px;
|
|
46
|
+
margin: 0 auto;
|
|
47
|
+
padding: 0;
|
|
48
|
+
border: 1px solid var(--ds-grey-300, #d7d7d7);
|
|
49
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.image > img {
|
|
53
|
+
border-radius: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.editor {
|
|
57
|
+
flex: 1 1 100%;
|
|
58
|
+
padding: 10px;
|
|
59
|
+
background-color: var(--ds-grey-100, #f8f8f8);
|
|
60
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.editorTitle {
|
|
64
|
+
margin-bottom: 6px;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.controls {
|
|
70
|
+
flex: 0 0 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.save {
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.checkboxes {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: 4px;
|
|
81
|
+
}
|
|
82
|
+
.nbParticipantsLabel {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 4px;
|
|
86
|
+
}
|
|
87
|
+
.nbParticipantsInput {
|
|
88
|
+
width: 45px;
|
|
89
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
type Props = {
|
|
4
|
+
index: number;
|
|
5
|
+
config: Types.Config;
|
|
6
|
+
widget: Types.Widget;
|
|
7
|
+
step: string;
|
|
8
|
+
setStep: React.Dispatch<React.SetStateAction<string>>;
|
|
9
|
+
stay: Types.Stay;
|
|
10
|
+
completedSteps?: number[];
|
|
11
|
+
setCompletedSteps?: React.Dispatch<React.SetStateAction<number[]>>;
|
|
12
|
+
packageId: string;
|
|
13
|
+
};
|
|
14
|
+
export default function Widget({ index, config, widget, step, setStep, stay, completedSteps, setCompletedSteps, packageId, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-package/components/widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,KAAK,KAAK,MAAM,UAAU,CAAC;AAIvC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACtD,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnE,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAsBF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,SAAS,GACV,EAAE,KAAK,2CAmLP"}
|