ublo-lib 1.0.0
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/admin-links/admin-links.js +107 -0
- package/es/common/components/admin-links/admin-links.module.css +85 -0
- package/es/common/components/admin-links/index.js +2 -0
- package/es/common/components/analytics.js +46 -0
- package/es/common/components/breadcrumb.js +69 -0
- package/es/common/components/carousel-zone.js +61 -0
- package/es/common/components/carousel.js +365 -0
- package/es/common/components/cookie-consent/cookie-consent.js +111 -0
- package/es/common/components/cookie-consent/cookie-consent.module.css +103 -0
- package/es/common/components/cookie-consent/index.js +3 -0
- package/es/common/components/cookie-consent/messages.js +31 -0
- package/es/common/components/custom-contact-form/attachment.js +229 -0
- package/es/common/components/custom-contact-form/attachment.module.css +211 -0
- package/es/common/components/custom-contact-form/custom-contact-form.js +168 -0
- package/es/common/components/custom-contact-form/field.js +294 -0
- package/es/common/components/custom-contact-form/field.module.css +17 -0
- package/es/common/components/custom-contact-form/icons.js +55 -0
- package/es/common/components/custom-contact-form/index.js +2 -0
- package/es/common/components/custom-contact-form/index.module.css +119 -0
- package/es/common/components/custom-contact-form/messages.js +79 -0
- package/es/common/components/custom-contact-form/utils.js +132 -0
- package/es/common/components/date-picker/calendar.js +246 -0
- package/es/common/components/date-picker/calendar.module.css +123 -0
- package/es/common/components/date-picker/data.js +96 -0
- package/es/common/components/date-picker/date-item.js +127 -0
- package/es/common/components/date-picker/date-item.module.css +78 -0
- package/es/common/components/date-picker/date-picker.js +119 -0
- package/es/common/components/date-picker/date-picker.module.css +111 -0
- package/es/common/components/date-picker/helper.js +41 -0
- package/es/common/components/date-picker/helper.module.css +81 -0
- package/es/common/components/date-picker/index.js +3 -0
- package/es/common/components/date-picker/messages.js +34 -0
- package/es/common/components/date-picker/modes.js +42 -0
- package/es/common/components/date-picker/modes.module.css +90 -0
- package/es/common/components/date-picker/month.js +78 -0
- package/es/common/components/date-picker/month.module.css +54 -0
- package/es/common/components/date-picker/utils.js +121 -0
- package/es/common/components/error-404/error-404.js +51 -0
- package/es/common/components/error-404/error-404.module.css +55 -0
- package/es/common/components/error-404/index.js +2 -0
- package/es/common/components/error-404/messages.js +29 -0
- package/es/common/components/faq.js +54 -0
- package/es/common/components/info-buttons.js +116 -0
- package/es/common/components/plausible/hooks/use-plausible.js +33 -0
- package/es/common/components/plausible/index.js +7 -0
- package/es/common/components/plausible/plausible.js +20 -0
- package/es/common/components/plausible/services/callback.js +63 -0
- package/es/common/components/plausible/services/load.js +7 -0
- package/es/common/components/plausible/services/send-goal.js +10 -0
- package/es/common/components/popup.js +90 -0
- package/es/common/components/scroll-spy.js +53 -0
- package/es/common/components/tabbed-zones.js +110 -0
- package/es/common/components/unsupported-browser.js +158 -0
- package/es/common/components/video-player/controls.js +125 -0
- package/es/common/components/video-player/icons.js +45 -0
- package/es/common/components/video-player/index.js +1 -0
- package/es/common/components/video-player/player.module.css +151 -0
- package/es/common/components/video-player/utils.js +43 -0
- package/es/common/components/video-player/video-player.js +111 -0
- package/es/common/hooks/use-faq.js +44 -0
- package/es/common/hooks/use-in-view.js +73 -0
- package/es/common/hooks/use-injected-cms-markup.js +50 -0
- package/es/common/hooks/use-packages.js +127 -0
- package/es/common/hooks/use-scroll-direction.js +44 -0
- package/es/common/hooks/use-stay.js +32 -0
- package/es/common/hooks/use-sticky.js +38 -0
- package/es/common/hooks/use-tunnel.js +50 -0
- package/es/common/hooks/use-window-sizes.js +37 -0
- package/es/common/hooks/use-youtube-popup.js +62 -0
- package/es/common/hooks/use-zone-sync.js +65 -0
- package/es/common/utils/cookies.js +13 -0
- package/es/common/utils/copy.js +11 -0
- package/es/common/utils/dates.js +8 -0
- package/es/common/utils/events.js +25 -0
- package/es/common/utils/fetcher.js +37 -0
- package/es/common/utils/file-manager.js +14 -0
- package/es/common/utils/load-js.js +11 -0
- package/es/common/utils/msem-widget.js +16 -0
- package/es/common/utils/touch-device.js +1 -0
- package/es/common/utils/url-parameters.js +12 -0
- package/es/empty.d.ts +4 -0
- package/es/empty.d.ts.map +1 -0
- package/es/empty.js +6 -0
- package/es/esf/components/booking-form/data.js +213 -0
- package/es/esf/components/booking-form/field.js +140 -0
- package/es/esf/components/booking-form/hooks/use-custom-fields.js +20 -0
- package/es/esf/components/booking-form/hooks/use-stay.js +12 -0
- package/es/esf/components/booking-form/icons.js +50 -0
- package/es/esf/components/booking-form/index.js +78 -0
- package/es/esf/components/booking-form/lesson.js +59 -0
- package/es/esf/components/booking-form/lessons.js +93 -0
- package/es/esf/components/booking-form/messages.js +52 -0
- package/es/esf/components/booking-form/personal-data.js +73 -0
- package/es/esf/components/booking-form/progress-bar.js +35 -0
- package/es/esf/components/booking-form/response.js +42 -0
- package/es/esf/components/booking-form/steps.js +81 -0
- package/es/esf/components/booking-form/summary.js +138 -0
- package/es/esf/components/booking-form/utils.js +72 -0
- package/es/esf/components/contact-form/api.js +36 -0
- package/es/esf/components/contact-form/contact-form.js +293 -0
- package/es/esf/components/contact-form/contact-form.module.css +51 -0
- package/es/esf/components/contact-form/data.js +53 -0
- package/es/esf/components/contact-form/index.js +2 -0
- package/es/esf/components/contact-form/messages.js +75 -0
- package/es/esf/components/contact-form/validation.js +63 -0
- package/es/esf/components/covid-link/index.js +119 -0
- package/es/esf/components/covid-link/index.module.css +108 -0
- package/es/esf/components/covid-link/mask-icon.js +17 -0
- package/es/esf/components/covid-link/vax-pass-icon.js +34 -0
- package/es/esf/components/cp-form.js +65 -0
- package/es/esf/components/instructor-suggestions/fetcher.js +17 -0
- package/es/esf/components/instructor-suggestions/icons.js +266 -0
- package/es/esf/components/instructor-suggestions/index.js +181 -0
- package/es/esf/components/instructor-suggestions/loader.js +10 -0
- package/es/esf/components/instructor-suggestions/messages.js +16 -0
- package/es/esf/components/instructors-book/container.js +18 -0
- package/es/esf/components/instructors-book/details.js +120 -0
- package/es/esf/components/instructors-book/icons.js +266 -0
- package/es/esf/components/instructors-book/index.js +15 -0
- package/es/esf/components/instructors-book/link.js +17 -0
- package/es/esf/components/instructors-book/list-utils.js +21 -0
- package/es/esf/components/instructors-book/list.js +184 -0
- package/es/esf/components/instructors-book/loader.js +10 -0
- package/es/esf/components/instructors-book/messages.js +44 -0
- package/es/esf/components/instructors-book/utils.js +5 -0
- package/es/esf/components/levels.js +265 -0
- package/es/esf/components/loyal-customers/api.js +24 -0
- package/es/esf/components/loyal-customers/components/bin-icon.js +31 -0
- package/es/esf/components/loyal-customers/components/bin-icon.module.css +9 -0
- package/es/esf/components/loyal-customers/components/customer-form.js +105 -0
- package/es/esf/components/loyal-customers/components/customer-form.module.css +40 -0
- package/es/esf/components/loyal-customers/components/field.js +119 -0
- package/es/esf/components/loyal-customers/components/field.module.css +3 -0
- package/es/esf/components/loyal-customers/components/row.js +77 -0
- package/es/esf/components/loyal-customers/components/row.module.css +95 -0
- package/es/esf/components/loyal-customers/components/rows.js +38 -0
- package/es/esf/components/loyal-customers/components/rows.module.css +11 -0
- package/es/esf/components/loyal-customers/components/stay.js +37 -0
- package/es/esf/components/loyal-customers/components/stay.module.css +18 -0
- package/es/esf/components/loyal-customers/components/student-form.js +105 -0
- package/es/esf/components/loyal-customers/components/student-form.module.css +68 -0
- package/es/esf/components/loyal-customers/components/voucher.js +26 -0
- package/es/esf/components/loyal-customers/components/voucher.module.css +7 -0
- package/es/esf/components/loyal-customers/content.js +55 -0
- package/es/esf/components/loyal-customers/data.js +131 -0
- package/es/esf/components/loyal-customers/hooks/use-stored-rows.js +14 -0
- package/es/esf/components/loyal-customers/index.js +2 -0
- package/es/esf/components/loyal-customers/loyal-customers.js +141 -0
- package/es/esf/components/loyal-customers/loyal-customers.module.css +62 -0
- package/es/esf/components/loyal-customers/messages.js +59 -0
- package/es/esf/components/loyal-customers/utils.js +81 -0
- package/es/esf/components/village-maps/icons.js +35 -0
- package/es/esf/components/village-maps/index.js +214 -0
- package/es/esf/components/village-maps/messages.js +19 -0
- package/es/esf/components/village-maps/utils.js +26 -0
- package/es/esf/components/week-picker/index.js +244 -0
- package/es/esf/components/week-picker/messages.js +36 -0
- package/es/esf/components/week-picker/utils.js +65 -0
- package/es/esf/components/week-picker/week.js +52 -0
- package/es/esf/components/week-picker-2/index.js +283 -0
- package/es/esf/components/week-picker-2/messages.js +27 -0
- package/es/esf/components/week-picker-2/utils.js +65 -0
- package/es/esf/components/week-picker-2/week.js +55 -0
- package/es/esf/hooks/use-affiliation.js +26 -0
- package/es/esf/hooks/use-booking-links.js +36 -0
- package/es/esf/hooks/use-reviews.js +28 -0
- package/es/esf/hooks/use-season-products.js +100 -0
- package/package.json +51 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import css from "dt-design-system/es/input/input.module.css";
|
|
2
|
+
export const getElements = (product, selectors) => {
|
|
3
|
+
const title = Array.from(product.querySelectorAll(selectors.title));
|
|
4
|
+
const price = product.querySelector(selectors.price);
|
|
5
|
+
const details = product.querySelector(selectors.details);
|
|
6
|
+
const options = product.querySelector(selectors.options);
|
|
7
|
+
const button = product.querySelector(selectors.button);
|
|
8
|
+
const select = product.querySelector("select");
|
|
9
|
+
return {
|
|
10
|
+
title,
|
|
11
|
+
price,
|
|
12
|
+
details,
|
|
13
|
+
options,
|
|
14
|
+
button,
|
|
15
|
+
select
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export const getData = (product, selectors, levels, handleVariants, convertTableToSelect) => {
|
|
19
|
+
const {
|
|
20
|
+
title,
|
|
21
|
+
price,
|
|
22
|
+
details,
|
|
23
|
+
options
|
|
24
|
+
} = getElements(product, selectors);
|
|
25
|
+
const classList = Array.from(product.classList);
|
|
26
|
+
const productCategory = handleVariants ? classList.reduce((acc, className) => Object.keys(levels).includes(className) ? className : acc, null) : undefined;
|
|
27
|
+
const selectedOption = getSelectedOption(product, options, convertTableToSelect);
|
|
28
|
+
const formatedTitle = title?.map(element => element.textContent).join(" - ");
|
|
29
|
+
const formatedPrice = price ? parseInt(price.textContent.replace(/€/g, "").trim()) : 0;
|
|
30
|
+
return {
|
|
31
|
+
title: formatedTitle || "",
|
|
32
|
+
price: formatedPrice,
|
|
33
|
+
details: details?.textContent || "",
|
|
34
|
+
selectedOption,
|
|
35
|
+
productCategory
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export const createSelect = options => {
|
|
39
|
+
if (!options) return;
|
|
40
|
+
const rows = Array.from(options.querySelectorAll("td"));
|
|
41
|
+
|
|
42
|
+
if (rows.length > 1) {
|
|
43
|
+
const selectOptions = rows.map(row => `<option value="${row.textContent}">${row.textContent}</option>`).join("");
|
|
44
|
+
options.insertAdjacentHTML("beforebegin", `<div class="${css.fieldWrapper}"><select class="${css.field}">${selectOptions}</select></div>`);
|
|
45
|
+
options.style.display = "none";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export const getSelectedOption = (product, options, convertTableToSelect) => {
|
|
49
|
+
if (convertTableToSelect) {
|
|
50
|
+
const select = product.querySelector("select");
|
|
51
|
+
return select?.value || options.querySelector("td")?.textContent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return options?.textContent;
|
|
55
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export const HOSTS = {
|
|
2
|
+
PROD: "https://admin.mon-sejour-en-montagne.com",
|
|
3
|
+
TEST: "https://admin-integration.mon-sejour-en-montagne.com"
|
|
4
|
+
};
|
|
5
|
+
export const TESTS = {
|
|
6
|
+
text: /^[^%]{2,}$/,
|
|
7
|
+
date: /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/,
|
|
8
|
+
email: /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i,
|
|
9
|
+
phone: /^\+?[0-9]{3}-?[0-9]{6,12}$/,
|
|
10
|
+
textarea: /^(?!\s*$).+/,
|
|
11
|
+
select: /^(?!\s*$).+/
|
|
12
|
+
};
|
|
13
|
+
export const studentFormFields = levels => ({
|
|
14
|
+
studentName: {
|
|
15
|
+
type: "text",
|
|
16
|
+
label: {
|
|
17
|
+
fr: "Nom & prénom",
|
|
18
|
+
en: "Lastname & firstname"
|
|
19
|
+
},
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
birthDate: {
|
|
23
|
+
type: "date",
|
|
24
|
+
placeholder: {
|
|
25
|
+
fr: "AAAA-MM-JJ",
|
|
26
|
+
en: "YYYY-MM-DD"
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
fr: "Date de naissance",
|
|
30
|
+
en: "Birthdate"
|
|
31
|
+
},
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
level: {
|
|
35
|
+
type: "select",
|
|
36
|
+
label: {
|
|
37
|
+
fr: "Niveau",
|
|
38
|
+
en: "Level"
|
|
39
|
+
},
|
|
40
|
+
options: levels,
|
|
41
|
+
required: true
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export const stayFields = {
|
|
45
|
+
stayFrom: {
|
|
46
|
+
type: "date",
|
|
47
|
+
placeholder: {
|
|
48
|
+
fr: "AAAA-MM-JJ",
|
|
49
|
+
en: "YYYY-MM-DD"
|
|
50
|
+
},
|
|
51
|
+
label: {
|
|
52
|
+
fr: "Date de début de séjour",
|
|
53
|
+
en: "Start date of stay"
|
|
54
|
+
},
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
stayTo: {
|
|
58
|
+
type: "date",
|
|
59
|
+
placeholder: {
|
|
60
|
+
fr: "AAAA-MM-JJ",
|
|
61
|
+
en: "YYYY-MM-DD"
|
|
62
|
+
},
|
|
63
|
+
label: {
|
|
64
|
+
fr: "Date de fin de séjour",
|
|
65
|
+
en: "End date of stay"
|
|
66
|
+
},
|
|
67
|
+
required: true
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
export const customerFormFields = {
|
|
71
|
+
email: {
|
|
72
|
+
type: "email",
|
|
73
|
+
label: {
|
|
74
|
+
fr: "Email",
|
|
75
|
+
en: "Email"
|
|
76
|
+
},
|
|
77
|
+
required: true
|
|
78
|
+
},
|
|
79
|
+
title: {
|
|
80
|
+
type: "select",
|
|
81
|
+
label: {
|
|
82
|
+
fr: "Civilité",
|
|
83
|
+
en: "Title"
|
|
84
|
+
},
|
|
85
|
+
options: [{
|
|
86
|
+
label: {
|
|
87
|
+
fr: "M.",
|
|
88
|
+
en: "Mr."
|
|
89
|
+
},
|
|
90
|
+
value: 0
|
|
91
|
+
}, {
|
|
92
|
+
label: {
|
|
93
|
+
fr: "Mme.",
|
|
94
|
+
en: "Mrs."
|
|
95
|
+
},
|
|
96
|
+
value: 1
|
|
97
|
+
}],
|
|
98
|
+
required: true
|
|
99
|
+
},
|
|
100
|
+
firstname: {
|
|
101
|
+
type: "text",
|
|
102
|
+
label: {
|
|
103
|
+
fr: "Prénom",
|
|
104
|
+
en: "Firstname"
|
|
105
|
+
},
|
|
106
|
+
required: true
|
|
107
|
+
},
|
|
108
|
+
lastname: {
|
|
109
|
+
type: "text",
|
|
110
|
+
label: {
|
|
111
|
+
fr: "Nom",
|
|
112
|
+
en: "Lastname"
|
|
113
|
+
},
|
|
114
|
+
required: true
|
|
115
|
+
},
|
|
116
|
+
phone: {
|
|
117
|
+
type: "phone",
|
|
118
|
+
label: {
|
|
119
|
+
fr: "Téléphone",
|
|
120
|
+
en: "Phone"
|
|
121
|
+
},
|
|
122
|
+
required: true
|
|
123
|
+
},
|
|
124
|
+
comment: {
|
|
125
|
+
type: "textarea",
|
|
126
|
+
label: {
|
|
127
|
+
fr: "Commentaire",
|
|
128
|
+
en: "Comment"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const ROWS_STORAGE_KEY = "loyal-customer-rows";
|
|
3
|
+
|
|
4
|
+
const useStoredRows = (defaultValue = []) => {
|
|
5
|
+
const [rows, setRows] = React.useState(defaultValue);
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
const storedRows = window.sessionStorage.getItem(ROWS_STORAGE_KEY);
|
|
8
|
+
if (storedRows) setRows(JSON.parse(storedRows));
|
|
9
|
+
}, []);
|
|
10
|
+
React.useEffect(() => window.sessionStorage.setItem(ROWS_STORAGE_KEY, JSON.stringify(rows)), [rows]);
|
|
11
|
+
return [rows, setRows];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default useStoredRows;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import Rows from "./components/rows";
|
|
4
|
+
import Voucher from "./components/voucher";
|
|
5
|
+
import StudentForm from "./components/student-form";
|
|
6
|
+
import CustomerForm from "./components/customer-form";
|
|
7
|
+
import * as Messages from "./messages";
|
|
8
|
+
import * as Content from "./content";
|
|
9
|
+
import * as Utils from "./utils";
|
|
10
|
+
import Button from "dt-design-system/es/button";
|
|
11
|
+
import * as DTIcons from "dt-design-system/es/icons";
|
|
12
|
+
import useStoredRows from "./hooks/use-stored-rows";
|
|
13
|
+
import styles from "./loyal-customers.module.css";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
const LoyalCustomers = ({
|
|
18
|
+
lang,
|
|
19
|
+
cmsMode,
|
|
20
|
+
selectors,
|
|
21
|
+
levels,
|
|
22
|
+
className,
|
|
23
|
+
convertTableToSelect,
|
|
24
|
+
handleVariants,
|
|
25
|
+
manualStay,
|
|
26
|
+
channel = "ESF",
|
|
27
|
+
merchant,
|
|
28
|
+
resort,
|
|
29
|
+
disableVoucher,
|
|
30
|
+
integration
|
|
31
|
+
}) => {
|
|
32
|
+
const [rows, setRows] = useStoredRows([]);
|
|
33
|
+
const [openedRow, setOpenedRow] = React.useState();
|
|
34
|
+
const [voucher, setVoucher] = React.useState("");
|
|
35
|
+
const [studentData, setStudentData] = React.useState({});
|
|
36
|
+
const [customerFormOpen, setCustomerFormOpen] = React.useState(false);
|
|
37
|
+
Utils.showHelper();
|
|
38
|
+
const total = rows.reduce((acc, row) => acc + row.price, 0);
|
|
39
|
+
|
|
40
|
+
const closeStudentForm = () => setStudentData({});
|
|
41
|
+
|
|
42
|
+
const closeCustomerForm = () => setCustomerFormOpen(false);
|
|
43
|
+
|
|
44
|
+
const openCustomerForm = () => setCustomerFormOpen(true);
|
|
45
|
+
|
|
46
|
+
const openStudentForm = React.useCallback(product => e => {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
const productData = Content.getData(product, selectors, levels, handleVariants, convertTableToSelect);
|
|
50
|
+
setStudentData(productData);
|
|
51
|
+
}, [convertTableToSelect, handleVariants, levels, selectors]);
|
|
52
|
+
const init = React.useCallback(product => {
|
|
53
|
+
const {
|
|
54
|
+
options,
|
|
55
|
+
button
|
|
56
|
+
} = Content.getElements(product, selectors);
|
|
57
|
+
if (!options || !button) return;
|
|
58
|
+
if (convertTableToSelect) Content.createSelect(options);
|
|
59
|
+
button.callback = openStudentForm(product);
|
|
60
|
+
button.addEventListener("click", button.callback);
|
|
61
|
+
}, [openStudentForm, selectors, convertTableToSelect]);
|
|
62
|
+
const cleanup = React.useCallback(product => {
|
|
63
|
+
const {
|
|
64
|
+
options,
|
|
65
|
+
button,
|
|
66
|
+
select
|
|
67
|
+
} = Content.getElements(product, selectors);
|
|
68
|
+
if (!options || !button) return;
|
|
69
|
+
|
|
70
|
+
if (convertTableToSelect) {
|
|
71
|
+
select?.remove();
|
|
72
|
+
options.style.removeProperty("display");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
button.removeEventListener("click", button.callback);
|
|
76
|
+
}, [selectors, convertTableToSelect]);
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
const products = Array.from(document.querySelectorAll(selectors.block));
|
|
79
|
+
|
|
80
|
+
if (cmsMode !== "editing" && products.length) {
|
|
81
|
+
products.forEach(init);
|
|
82
|
+
return () => products.forEach(cleanup);
|
|
83
|
+
}
|
|
84
|
+
}, [cleanup, cmsMode, init, selectors]);
|
|
85
|
+
const classes = classnames(styles.index, {
|
|
86
|
+
[className]: className
|
|
87
|
+
});
|
|
88
|
+
return _jsxs("div", {
|
|
89
|
+
className: classes,
|
|
90
|
+
children: [_jsx("div", {
|
|
91
|
+
className: styles.title,
|
|
92
|
+
children: Messages.get(lang, "title")
|
|
93
|
+
}), _jsx(Rows, {
|
|
94
|
+
lang: lang,
|
|
95
|
+
rows: rows,
|
|
96
|
+
setRows: setRows,
|
|
97
|
+
openedRow: openedRow,
|
|
98
|
+
setOpenedRow: setOpenedRow
|
|
99
|
+
}), !disableVoucher && _jsx(Voucher, {
|
|
100
|
+
lang: lang,
|
|
101
|
+
voucher: voucher,
|
|
102
|
+
setVoucher: setVoucher
|
|
103
|
+
}), _jsxs("div", {
|
|
104
|
+
className: styles.overview,
|
|
105
|
+
children: [_jsx("div", {
|
|
106
|
+
className: styles.overviewTitle,
|
|
107
|
+
children: Messages.get(lang, "total")
|
|
108
|
+
}), _jsxs("div", {
|
|
109
|
+
className: styles.overviewTotal,
|
|
110
|
+
children: [total, " \u20AC"]
|
|
111
|
+
})]
|
|
112
|
+
}), _jsxs(Button, {
|
|
113
|
+
className: styles.orderButton,
|
|
114
|
+
disabled: !rows.length,
|
|
115
|
+
onClick: openCustomerForm,
|
|
116
|
+
children: [Messages.get(lang, "order"), _jsx(DTIcons.Check, {})]
|
|
117
|
+
}), _jsx(StudentForm, {
|
|
118
|
+
lang: lang,
|
|
119
|
+
close: closeStudentForm,
|
|
120
|
+
studentData: studentData,
|
|
121
|
+
levels: levels,
|
|
122
|
+
setRows: setRows
|
|
123
|
+
}), _jsx(CustomerForm, {
|
|
124
|
+
lang: lang,
|
|
125
|
+
close: closeCustomerForm,
|
|
126
|
+
open: customerFormOpen,
|
|
127
|
+
rows: rows,
|
|
128
|
+
setRows: setRows,
|
|
129
|
+
voucher: voucher,
|
|
130
|
+
setVoucher: setVoucher,
|
|
131
|
+
disableVoucher: disableVoucher,
|
|
132
|
+
manualStay: manualStay,
|
|
133
|
+
channel: channel,
|
|
134
|
+
merchant: merchant,
|
|
135
|
+
resort: resort,
|
|
136
|
+
integration: integration
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default LoyalCustomers;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.index {
|
|
2
|
+
--ds-secondary: #cc0900;
|
|
3
|
+
--ds-primary: #bb0b02;
|
|
4
|
+
|
|
5
|
+
background-color: var(--ds-grey-100, #f5f5f5);
|
|
6
|
+
border-radius: var(--ds-radius-100, 3px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.index * {
|
|
11
|
+
outline: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.index *:focus-visible {
|
|
15
|
+
outline: var(--ds-focus-ring-width, 2px) solid
|
|
16
|
+
var(--ds-focus-ring-color, var(--ds-blue-400, #4177f6));
|
|
17
|
+
outline-offset: var(--ds-focus-ring-offset, 2px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.title {
|
|
21
|
+
padding: 5px;
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 700;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
text-align: center;
|
|
26
|
+
color: var(--ds-grey-000, #ffffff);
|
|
27
|
+
background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.overview {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
padding: 0 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.overviewTitle {
|
|
37
|
+
flex: 1 1 100%;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.overviewTotal {
|
|
43
|
+
flex: 0 0 auto;
|
|
44
|
+
padding-left: 10px;
|
|
45
|
+
font-size: 17px;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.orderButton {
|
|
50
|
+
width: 100%;
|
|
51
|
+
margin-top: 10px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.orderButton:focus-visible {
|
|
55
|
+
outline: none;
|
|
56
|
+
box-shadow: inset var(--lc-focus-ring, 0 0 0 3px #00aff480);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.orderButton:disabled {
|
|
60
|
+
background-color: var(--ds-grey-300, #d4d4d4);
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const locales = {
|
|
2
|
+
fr: {
|
|
3
|
+
title: "Récapitulatif de commande",
|
|
4
|
+
"no-product": "Pas de produit selectionné",
|
|
5
|
+
"student-information": "Informations de l'élève",
|
|
6
|
+
"student-name": "Nom & prénom",
|
|
7
|
+
birthdate: "Date de naissance",
|
|
8
|
+
level: "Niveau",
|
|
9
|
+
total: "Total de la commande",
|
|
10
|
+
voucher: "Code promo",
|
|
11
|
+
order: "Commander",
|
|
12
|
+
confirm: "Confirmer",
|
|
13
|
+
"send-request": "Envoyer votre demande",
|
|
14
|
+
"student-form-product": "Produit selectionné",
|
|
15
|
+
"student-form-price": "Prix",
|
|
16
|
+
"student-form-details": "Détails",
|
|
17
|
+
"student-form-option": "Option",
|
|
18
|
+
"student-form-popup-instructions": "Veuillez renseigner les informations de l'élève",
|
|
19
|
+
"customer-information": "Vos informations",
|
|
20
|
+
optional: "optionnel",
|
|
21
|
+
"form-error": "Une erreur est survenue, veuillez réessayer",
|
|
22
|
+
"form-sent": "Demande envoyée avec succès",
|
|
23
|
+
stay: "Séjour",
|
|
24
|
+
from: "du",
|
|
25
|
+
to: "au",
|
|
26
|
+
select: "Selectionnez"
|
|
27
|
+
},
|
|
28
|
+
en: {
|
|
29
|
+
title: "Order summary",
|
|
30
|
+
"no-product": "No selected product",
|
|
31
|
+
"student-information": "Student information",
|
|
32
|
+
"student-name": "Fullname:",
|
|
33
|
+
birthdate: "Birthdate:",
|
|
34
|
+
level: "Niveau:",
|
|
35
|
+
total: "Total amount",
|
|
36
|
+
voucher: "Discount code",
|
|
37
|
+
order: "Order",
|
|
38
|
+
confirm: "Confirm",
|
|
39
|
+
"send-request": "Send your request",
|
|
40
|
+
"student-form-product": "Selected product:",
|
|
41
|
+
"student-form-price": "Price:",
|
|
42
|
+
"student-form-details": "Details:",
|
|
43
|
+
"student-form-option": "Selected option:",
|
|
44
|
+
"student-form-popup-instructions": "Please fill in the student information",
|
|
45
|
+
"customer-information": "Your information",
|
|
46
|
+
optional: "optional",
|
|
47
|
+
"form-error": "An error occured, please try again",
|
|
48
|
+
"form-sent": "Message sent successfully",
|
|
49
|
+
stay: "Stay",
|
|
50
|
+
from: "from",
|
|
51
|
+
to: "to",
|
|
52
|
+
select: "Choose an option"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export const get = (lang, id) => {
|
|
56
|
+
if (!locales[lang]) return id;
|
|
57
|
+
const messages = locales[lang];
|
|
58
|
+
return messages[id] || messages.en;
|
|
59
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as Data from "./data";
|
|
2
|
+
export const validateField = (type, value) => {
|
|
3
|
+
const regex = Data.TESTS[type];
|
|
4
|
+
return regex && regex.test(value);
|
|
5
|
+
};
|
|
6
|
+
export const formatDate = (lang, date) => {
|
|
7
|
+
const locale = lang === "fr" ? "fr-FR" : "en-UK";
|
|
8
|
+
const d = new Date(date);
|
|
9
|
+
return d.toLocaleString(locale, {
|
|
10
|
+
month: "long",
|
|
11
|
+
day: "numeric",
|
|
12
|
+
year: "numeric"
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export const showHelper = () => {
|
|
16
|
+
if (process.env.NODE_ENV !== "production") {
|
|
17
|
+
console.info("LoyalCustomers: See https://github.com/valraiso-esf/documentation-sites-marchands/tree/master/loyal-customers for more information.");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const buildPayload = (lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher) => {
|
|
21
|
+
const {
|
|
22
|
+
comment,
|
|
23
|
+
email,
|
|
24
|
+
title,
|
|
25
|
+
firstname,
|
|
26
|
+
lastname,
|
|
27
|
+
phone,
|
|
28
|
+
stayFrom,
|
|
29
|
+
stayTo
|
|
30
|
+
} = customerData;
|
|
31
|
+
const storedStay = window.sessionStorage.getItem("stay");
|
|
32
|
+
if ((!stayFrom || !stayTo) && !storedStay) return;
|
|
33
|
+
const {
|
|
34
|
+
from,
|
|
35
|
+
to
|
|
36
|
+
} = storedStay ? JSON.parse(storedStay) : {};
|
|
37
|
+
const genericLines = rows.map(row => {
|
|
38
|
+
const {
|
|
39
|
+
details,
|
|
40
|
+
price,
|
|
41
|
+
selectedOption,
|
|
42
|
+
formData,
|
|
43
|
+
title
|
|
44
|
+
} = row;
|
|
45
|
+
const {
|
|
46
|
+
birthDate,
|
|
47
|
+
level,
|
|
48
|
+
studentName
|
|
49
|
+
} = formData;
|
|
50
|
+
const label = `${title} ${selectedOption} ${details}`;
|
|
51
|
+
const description = `Nom de l'élève : ${studentName.value}
|
|
52
|
+
Niveau : ${level.value}
|
|
53
|
+
Date de naissance : ${formatDate(lang, birthDate.value)}`;
|
|
54
|
+
return {
|
|
55
|
+
label,
|
|
56
|
+
description,
|
|
57
|
+
price
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
const voucherMessage = disableVoucher ? "" : `Code promo : ${voucher}`;
|
|
61
|
+
const message = `Envoyé depuis le formulaire "Clients fidèles".
|
|
62
|
+
${voucherMessage}
|
|
63
|
+
Commentaire : ${comment.value}`;
|
|
64
|
+
return {
|
|
65
|
+
channel,
|
|
66
|
+
resort,
|
|
67
|
+
merchant,
|
|
68
|
+
lang,
|
|
69
|
+
from: stayFrom?.value || from,
|
|
70
|
+
to: stayTo?.value || to,
|
|
71
|
+
message,
|
|
72
|
+
customer: {
|
|
73
|
+
email: email.value,
|
|
74
|
+
title: title.value,
|
|
75
|
+
firstname: firstname.value,
|
|
76
|
+
lastname: lastname.value,
|
|
77
|
+
phone: phone.value
|
|
78
|
+
},
|
|
79
|
+
genericLines
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
const SvgIcon = ({ ...props
|
|
5
|
+
}) => _jsx("svg", {
|
|
6
|
+
viewBox: "0 0 32 32",
|
|
7
|
+
...props,
|
|
8
|
+
children: props.children
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const LocationIcon = props => _jsx(SvgIcon, { ...props,
|
|
12
|
+
children: _jsx("path", {
|
|
13
|
+
d: "M16 3c-5 0-9 4-9 9 0 7 9 17 9 17s9-10 9-17c0-5-4-9-9-9zm0 12a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
export const MeetingIcon = props => _jsx(SvgIcon, { ...props,
|
|
17
|
+
children: _jsx("path", {
|
|
18
|
+
d: "M31 32H0l1.5-2.6 4.8-8.2c.9-1.4 2.3-1.4 3.1 0l1.2 2.1 4-6.8c1-1.5 2.3-1.5 3.2 0L24.5 28l1-1.7c.6-1 1.6-1 2.2 0l2.2 3.8L31 32zM18.3 4.5c0 .7-.2 1.4-.5 2l-4 7.9-4.2-8c-.3-.6-.5-1.2-.5-2 0-2.4 2-4.4 4.6-4.4 2.5 0 4.6 2 4.6 4.5zm-1.9 0c0-1.5-1.2-2.7-2.7-2.7A2.7 2.7 0 0 0 11 4.5c0 1.5 1.2 2.7 2.7 2.7 1.5 0 2.7-1.2 2.7-2.7z"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
export const MountainIcon = props => _jsx(SvgIcon, { ...props,
|
|
22
|
+
children: _jsx("path", {
|
|
23
|
+
d: "M31.3 30.9l-9.8-14.5a.9.9 0 0 0-1.4 0l-1.9 2.7-.7 1-3.8-5.6a1 1 0 0 0-1.8 0L.8 30.9 0 32h32l-.7-1.1zm-14-8.2l3-4.5a.7.7 0 0 1 1.1 0l2.7 4 2.8 4.2-4.3-4-.2.5-.1.2-1.1-1.2-.8.6-.2.3-.4-.8V22l-2 1.6 1 1.5.9 1.4-4.7-4.6-.3-.3-.7.9-.3.4-.7-1.2-.3-.6-.7 1.3-.4.8-.5-1.2-.8.4-2.2 2-2.2 2 6.3-9.4a.7.7 0 0 1 1.2 0L16 21l1.1 1.7z"
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
export const ExternalLinkIcon = props => _jsx(SvgIcon, { ...props,
|
|
27
|
+
children: _jsx("path", {
|
|
28
|
+
d: "M25 25H7V7h9V4H4v24h24V16h-3v9zM19 4v3h4L10 20l2 2L25 9v4h3V4h-9z"
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
export const CloseIcon = props => _jsx(SvgIcon, { ...props,
|
|
32
|
+
children: _jsx("path", {
|
|
33
|
+
d: "M25.3 8.5l-1.8-1.8L16 14 8.5 6.7 6.7 8.5 14 16l-7.4 7.5 1.8 1.8L16 18l7.5 7.4 1.8-1.8L18 16l7.4-7.5z"
|
|
34
|
+
})
|
|
35
|
+
});
|