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,184 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import Container from "./container";
|
|
4
|
+
import Loader from "./loader";
|
|
5
|
+
import { flags, PersonIcon, OverlayIcon } from "./icons";
|
|
6
|
+
import getMessage from "./messages";
|
|
7
|
+
import { formatNames } from "./utils";
|
|
8
|
+
import { filter } from "./list-utils";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
const List = ({
|
|
14
|
+
instructors,
|
|
15
|
+
activities,
|
|
16
|
+
languages,
|
|
17
|
+
trombi,
|
|
18
|
+
lang,
|
|
19
|
+
activity,
|
|
20
|
+
language,
|
|
21
|
+
selectInstructor,
|
|
22
|
+
selectFilter
|
|
23
|
+
}) => {
|
|
24
|
+
const [search, setSearch] = useState("");
|
|
25
|
+
const [displayedInstructors, setDisplayedInstructors] = useState(filter(instructors));
|
|
26
|
+
const texts = getMessage(lang);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const displayedInstructors = filter(instructors, search);
|
|
29
|
+
setDisplayedInstructors(displayedInstructors);
|
|
30
|
+
}, [instructors, search]);
|
|
31
|
+
|
|
32
|
+
const changeFilter = filter => e => {
|
|
33
|
+
if (selectFilter !== undefined) {
|
|
34
|
+
selectFilter(filter, e.target.value);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const renderHeader = () => {
|
|
39
|
+
return _jsxs("div", {
|
|
40
|
+
className: "instructors-book-list__top",
|
|
41
|
+
children: [_jsxs("div", {
|
|
42
|
+
className: "instructors-book-list__top-left",
|
|
43
|
+
children: [_jsx("h2", {
|
|
44
|
+
className: "instructors-book-list__title",
|
|
45
|
+
children: texts["instructors-book-title-1"]
|
|
46
|
+
}), _jsx("div", {
|
|
47
|
+
className: "instructors-book-list__tagline",
|
|
48
|
+
children: texts["instructors-book-title-2"]
|
|
49
|
+
}), _jsx("div", {
|
|
50
|
+
className: "instructors-book-list__helper",
|
|
51
|
+
children: texts["instructors-book-intro"]
|
|
52
|
+
})]
|
|
53
|
+
}), _jsxs("div", {
|
|
54
|
+
className: "instructors-book-list__filters",
|
|
55
|
+
children: [_jsxs("div", {
|
|
56
|
+
className: "instructors-book-list__filters-title",
|
|
57
|
+
children: [texts["instructors-book-search-1"], " ", _jsx("span", {
|
|
58
|
+
className: "instructors-book-list__filters-title-span",
|
|
59
|
+
children: texts["instructors-book-search-2"]
|
|
60
|
+
})]
|
|
61
|
+
}), _jsx("div", {
|
|
62
|
+
className: "instructors-book-list__input-filler",
|
|
63
|
+
children: _jsx("input", {
|
|
64
|
+
value: search,
|
|
65
|
+
className: "instructors-book-list__input",
|
|
66
|
+
placeholder: texts["instructors-book-placeholder-search"],
|
|
67
|
+
onChange: e => setSearch(e.target.value.toLowerCase())
|
|
68
|
+
})
|
|
69
|
+
}), _jsx("label", {
|
|
70
|
+
htmlFor: "instructors-book-practice-filter",
|
|
71
|
+
className: "instructors-book-list__label",
|
|
72
|
+
children: texts["instructors-book-filter-activity"]
|
|
73
|
+
}), _jsx("div", {
|
|
74
|
+
className: "instructors-book-list__input-filler instructors-book-list__input-filler--select",
|
|
75
|
+
children: _jsxs("select", {
|
|
76
|
+
value: activity,
|
|
77
|
+
id: "instructors-book-practice-filter",
|
|
78
|
+
className: "instructors-book-list__input instructors-book-list__input--select",
|
|
79
|
+
onChange: changeFilter("activity"),
|
|
80
|
+
children: [_jsx("option", {
|
|
81
|
+
value: "",
|
|
82
|
+
children: texts["instructors-book-placeholder-activity"]
|
|
83
|
+
}), activities && activities.map(({
|
|
84
|
+
code,
|
|
85
|
+
label
|
|
86
|
+
}) => _jsx("option", {
|
|
87
|
+
value: code,
|
|
88
|
+
children: label
|
|
89
|
+
}, code))]
|
|
90
|
+
})
|
|
91
|
+
}), _jsx("label", {
|
|
92
|
+
htmlFor: "instructors-book-language-filter",
|
|
93
|
+
className: "instructors-book-list__label",
|
|
94
|
+
children: texts["instructors-book-filter-language"]
|
|
95
|
+
}), _jsx("div", {
|
|
96
|
+
className: "instructors-book-list__input-filler instructors-book-list__input-filler--select",
|
|
97
|
+
children: _jsxs("select", {
|
|
98
|
+
value: language,
|
|
99
|
+
id: "instructors-book-language-filter",
|
|
100
|
+
className: "instructors-book-list__input instructors-book-list__input--select",
|
|
101
|
+
onChange: changeFilter("language"),
|
|
102
|
+
children: [_jsx("option", {
|
|
103
|
+
value: "",
|
|
104
|
+
children: texts["instructors-book-placeholder-language"]
|
|
105
|
+
}), languages && languages.map(({
|
|
106
|
+
code,
|
|
107
|
+
label
|
|
108
|
+
}) => _jsx("option", {
|
|
109
|
+
value: code,
|
|
110
|
+
children: label
|
|
111
|
+
}, code))]
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const renderInstructor = (instructor, index) => {
|
|
119
|
+
const {
|
|
120
|
+
firstname,
|
|
121
|
+
lastname,
|
|
122
|
+
photo,
|
|
123
|
+
activities,
|
|
124
|
+
languages,
|
|
125
|
+
uri
|
|
126
|
+
} = instructor;
|
|
127
|
+
return _jsxs(Container, {
|
|
128
|
+
trombi: trombi,
|
|
129
|
+
className: "instructors-book-list__instructor",
|
|
130
|
+
...selectInstructor(uri),
|
|
131
|
+
children: [_jsxs("div", {
|
|
132
|
+
className: "instructors-book-list__instructor-image-container",
|
|
133
|
+
children: [!trombi && _jsx("div", {
|
|
134
|
+
className: "instructors-book-list__instructor-overlay",
|
|
135
|
+
children: _jsx(OverlayIcon, {
|
|
136
|
+
className: "instructors-book-list__instructor-overlay-icon"
|
|
137
|
+
})
|
|
138
|
+
}), photo ? _jsx("img", {
|
|
139
|
+
loading: "lazy",
|
|
140
|
+
src: photo,
|
|
141
|
+
className: "instructors-book-list__instructor-image",
|
|
142
|
+
alt: `${firstname} ${lastname}`
|
|
143
|
+
}) : _jsx(PersonIcon, {
|
|
144
|
+
className: "instructors-book-list__instructor-imageplaceholder"
|
|
145
|
+
})]
|
|
146
|
+
}), _jsxs("div", {
|
|
147
|
+
className: "instructors-book-list__instructor-name",
|
|
148
|
+
children: [formatNames(firstname), " ", _jsx("span", {
|
|
149
|
+
className: "instructors-book-list__instructor-lastname",
|
|
150
|
+
children: formatNames(lastname)
|
|
151
|
+
})]
|
|
152
|
+
}), trombi && _jsxs(_Fragment, {
|
|
153
|
+
children: [_jsx("div", {
|
|
154
|
+
className: "instructors-book-list__instructor-practices",
|
|
155
|
+
children: activities && activities.map(({
|
|
156
|
+
label
|
|
157
|
+
}) => label).join(" - ")
|
|
158
|
+
}), _jsx("div", {
|
|
159
|
+
className: "instructors-book-list__instructor-langs",
|
|
160
|
+
children: languages && languages.map(({
|
|
161
|
+
code,
|
|
162
|
+
label
|
|
163
|
+
}) => {
|
|
164
|
+
const Flag = flags[code];
|
|
165
|
+
return _jsx(Flag, {
|
|
166
|
+
className: "instructors-book-list__instructor-lang",
|
|
167
|
+
title: label
|
|
168
|
+
}, code);
|
|
169
|
+
})
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
172
|
+
}, uri ? uri : `instructor-${index}`);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
return _jsxs("div", {
|
|
176
|
+
className: "instructors-book-list",
|
|
177
|
+
children: [renderHeader(), _jsx("div", {
|
|
178
|
+
className: "instructors-book-list__inner",
|
|
179
|
+
children: displayedInstructors ? displayedInstructors.map((instructor, index) => renderInstructor(instructor, index)) : _jsx(Loader, {})
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export default List;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const messages = {
|
|
2
|
+
fr: {
|
|
3
|
+
"instructors-book-title-1": "le book",
|
|
4
|
+
"instructors-book-title-2": "des moniteurs",
|
|
5
|
+
"instructors-book-intro": "Cliquez sur un moniteur pour afficher ses informations",
|
|
6
|
+
"instructors-book-search-1": "recherchez",
|
|
7
|
+
"instructors-book-search-2": "votre moniteur",
|
|
8
|
+
"instructors-book-filter-activity": "Filtrer par pratique",
|
|
9
|
+
"instructors-book-filter-language": "Filtrer par langue",
|
|
10
|
+
"instructors-book-placeholder-search": "Nom, prénom...",
|
|
11
|
+
"instructors-book-placeholder-activity": "Sélectionnez une pratique",
|
|
12
|
+
"instructors-book-placeholder-language": "Sélectionnez une langue",
|
|
13
|
+
"instructors-book-activities": "Mes spécialités sont : ",
|
|
14
|
+
"instructors-book-about": "À propos",
|
|
15
|
+
"instructors-book-and": " et ",
|
|
16
|
+
"instructors-book-back-to-list": "Retour"
|
|
17
|
+
},
|
|
18
|
+
en: {
|
|
19
|
+
"instructors-book-title-1": "ski instructors'",
|
|
20
|
+
"instructors-book-title-2": "book",
|
|
21
|
+
"instructors-book-intro": "Click an instructor bellow to display his informations",
|
|
22
|
+
"instructors-book-search-1": "search",
|
|
23
|
+
"instructors-book-search-2": "your instructor",
|
|
24
|
+
"instructors-book-filter-activity": "Filter by discipline",
|
|
25
|
+
"instructors-book-filter-language": "Filter by spoken language",
|
|
26
|
+
"instructors-book-placeholder-search": "Lastname, firstname...",
|
|
27
|
+
"instructors-book-placeholder-activity": "Select a discipline",
|
|
28
|
+
"instructors-book-placeholder-language": "Select a language",
|
|
29
|
+
"instructors-book-activities": "My disciplines are : ",
|
|
30
|
+
"instructors-book-about": "About",
|
|
31
|
+
"instructors-book-and": " and ",
|
|
32
|
+
"instructors-book-back-to-list": "Go back"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const getMessage = lang => {
|
|
37
|
+
if (messages[lang] !== undefined) {
|
|
38
|
+
return messages[lang];
|
|
39
|
+
} else {
|
|
40
|
+
return messages["en"];
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default getMessage;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const formatNames = name => {
|
|
2
|
+
const lowercasedName = name && name.toLowerCase();
|
|
3
|
+
return lowercasedName.charAt(0).toUpperCase() + lowercasedName.slice(1);
|
|
4
|
+
};
|
|
5
|
+
export const includesString = (source, included) => source.toLowerCase().includes(included.toLowerCase());
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
5
|
+
import { fetchMenus, fetchZones } from "ublo/fetcher";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
const LevelDetail = ({
|
|
10
|
+
selectedLevel,
|
|
11
|
+
contents
|
|
12
|
+
}) => {
|
|
13
|
+
const zoneId = `detail-${selectedLevel}`;
|
|
14
|
+
const content = contents[zoneId];
|
|
15
|
+
return _jsx("div", {
|
|
16
|
+
className: "evaluate-level__detail",
|
|
17
|
+
dangerouslySetInnerHTML: {
|
|
18
|
+
__html: content
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Level = ({
|
|
24
|
+
level,
|
|
25
|
+
contents,
|
|
26
|
+
setSelectedLevel,
|
|
27
|
+
selectedLevel
|
|
28
|
+
}) => {
|
|
29
|
+
const {
|
|
30
|
+
name,
|
|
31
|
+
title
|
|
32
|
+
} = level;
|
|
33
|
+
const zoneId = `photo-${name}`;
|
|
34
|
+
const content = contents[zoneId];
|
|
35
|
+
|
|
36
|
+
const clicked = name => e => setSelectedLevel(name);
|
|
37
|
+
|
|
38
|
+
const selected = name === selectedLevel;
|
|
39
|
+
const levelClasses = classnames("evaluate-level__level", {
|
|
40
|
+
"evaluate-level__level--selected": selected
|
|
41
|
+
});
|
|
42
|
+
return _jsxs("div", {
|
|
43
|
+
className: levelClasses,
|
|
44
|
+
onClick: clicked(name),
|
|
45
|
+
children: [_jsx("h3", {
|
|
46
|
+
className: "evaluate-level__level-title",
|
|
47
|
+
children: title
|
|
48
|
+
}), _jsx("div", {
|
|
49
|
+
className: "evaluate-level__level-medal",
|
|
50
|
+
dangerouslySetInnerHTML: {
|
|
51
|
+
__html: content
|
|
52
|
+
}
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const Levels = ({
|
|
58
|
+
levels,
|
|
59
|
+
contents,
|
|
60
|
+
selectedActivity,
|
|
61
|
+
selectedAge,
|
|
62
|
+
setSelectedLevel,
|
|
63
|
+
selectedLevel
|
|
64
|
+
}) => {
|
|
65
|
+
return _jsxs("div", {
|
|
66
|
+
className: "evaluate-level__levels",
|
|
67
|
+
children: [_jsxs("div", {
|
|
68
|
+
className: "evaluate-level__levels-title",
|
|
69
|
+
children: [selectedActivity.title, " ", _jsx("span", {
|
|
70
|
+
children: selectedAge.title
|
|
71
|
+
})]
|
|
72
|
+
}), _jsx("div", {
|
|
73
|
+
className: "evaluate-level__levels-outer",
|
|
74
|
+
children: levels.map(level => {
|
|
75
|
+
return _jsx(Level, {
|
|
76
|
+
level: level,
|
|
77
|
+
contents: contents,
|
|
78
|
+
setSelectedLevel: setSelectedLevel,
|
|
79
|
+
selectedLevel: selectedLevel
|
|
80
|
+
}, level.name);
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const AgeClasses = ({
|
|
87
|
+
ages,
|
|
88
|
+
selectedAge,
|
|
89
|
+
ageChanged
|
|
90
|
+
}) => {
|
|
91
|
+
const clicked = age => e => ageChanged(age);
|
|
92
|
+
|
|
93
|
+
return _jsx("div", {
|
|
94
|
+
className: "evaluate-level__ages",
|
|
95
|
+
children: ages.map(age => {
|
|
96
|
+
const {
|
|
97
|
+
name,
|
|
98
|
+
title,
|
|
99
|
+
path
|
|
100
|
+
} = age;
|
|
101
|
+
const selected = selectedAge.path === path;
|
|
102
|
+
const ageClasses = classnames("evaluate-level__age", {
|
|
103
|
+
"evaluate-level__age--selected": selected
|
|
104
|
+
});
|
|
105
|
+
return _jsxs("div", {
|
|
106
|
+
className: ageClasses,
|
|
107
|
+
onClick: clicked(age),
|
|
108
|
+
children: [_jsx("div", {
|
|
109
|
+
className: "evaluate-level__radio-button"
|
|
110
|
+
}), title]
|
|
111
|
+
}, name);
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const Activities = ({
|
|
117
|
+
activities,
|
|
118
|
+
activityChanged,
|
|
119
|
+
selectedActivity,
|
|
120
|
+
selectedAge,
|
|
121
|
+
ageChanged
|
|
122
|
+
}) => {
|
|
123
|
+
const clicked = activity => e => activityChanged(activity);
|
|
124
|
+
|
|
125
|
+
return _jsx("div", {
|
|
126
|
+
className: "evaluate-level__activities",
|
|
127
|
+
children: activities.map(activity => {
|
|
128
|
+
const {
|
|
129
|
+
name,
|
|
130
|
+
path,
|
|
131
|
+
title,
|
|
132
|
+
subs
|
|
133
|
+
} = activity;
|
|
134
|
+
const hasSubs = subs !== undefined;
|
|
135
|
+
const selected = path === selectedActivity.path && hasSubs;
|
|
136
|
+
const isFreestyle = name === "levels-freestyle";
|
|
137
|
+
const activityClasses = classnames("evaluate-level__item", {
|
|
138
|
+
"evaluate-level__item--selected": selected
|
|
139
|
+
});
|
|
140
|
+
return _jsxs("div", {
|
|
141
|
+
className: activityClasses,
|
|
142
|
+
children: [_jsxs("div", {
|
|
143
|
+
className: "evaluate-level__activity",
|
|
144
|
+
onClick: clicked(activity),
|
|
145
|
+
children: [_jsx("div", {
|
|
146
|
+
className: "evaluate-level__radio-button"
|
|
147
|
+
}), title]
|
|
148
|
+
}), selected && !isFreestyle && _jsx(AgeClasses, {
|
|
149
|
+
ages: subs,
|
|
150
|
+
selectedAge: selectedAge,
|
|
151
|
+
ageChanged: ageChanged
|
|
152
|
+
})]
|
|
153
|
+
}, name);
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const EvaluateLevel = ({
|
|
159
|
+
menu
|
|
160
|
+
}) => {
|
|
161
|
+
const {
|
|
162
|
+
config,
|
|
163
|
+
lang
|
|
164
|
+
} = useUbloContext();
|
|
165
|
+
const {
|
|
166
|
+
ubloApi,
|
|
167
|
+
site
|
|
168
|
+
} = config;
|
|
169
|
+
const [activities, setActivities] = useState([]);
|
|
170
|
+
const [levels, setLevels] = useState([]);
|
|
171
|
+
const [contents, setContents] = useState({});
|
|
172
|
+
const [selectedActivity, setSelectedActivity] = useState({});
|
|
173
|
+
const [selectedAge, setSelectedAge] = useState({});
|
|
174
|
+
const [selectedLevel, setSelectedLevel] = useState();
|
|
175
|
+
|
|
176
|
+
const activityChanged = activity => {
|
|
177
|
+
const {
|
|
178
|
+
name
|
|
179
|
+
} = activity;
|
|
180
|
+
const isFreestyle = name === "levels-freestyle";
|
|
181
|
+
setSelectedActivity(activity);
|
|
182
|
+
setSelectedAge(isFreestyle ? activity : {});
|
|
183
|
+
setLevels([]);
|
|
184
|
+
setSelectedLevel();
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const ageChanged = age => {
|
|
188
|
+
setSelectedAge(age);
|
|
189
|
+
setLevels([]);
|
|
190
|
+
setSelectedLevel();
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
const activitiesLoaded = activities.length > 0;
|
|
195
|
+
|
|
196
|
+
if (menu !== undefined && activitiesLoaded) {
|
|
197
|
+
const isFreestyle = menu.split("/").length - 1 === 2;
|
|
198
|
+
|
|
199
|
+
if (isFreestyle) {
|
|
200
|
+
const [activity] = activities.filter(a => a.menu === menu);
|
|
201
|
+
|
|
202
|
+
if (activity !== undefined) {
|
|
203
|
+
setSelectedActivity(activity);
|
|
204
|
+
setSelectedAge(activity);
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
const activityPath = menu.substring(0, menu.lastIndexOf("/"));
|
|
208
|
+
const [activity] = activities.filter(a => a.menu === activityPath);
|
|
209
|
+
|
|
210
|
+
if (activity !== undefined) {
|
|
211
|
+
const [age] = activity.subs.filter(a => a.menu === menu);
|
|
212
|
+
|
|
213
|
+
if (age !== undefined) {
|
|
214
|
+
setSelectedActivity(activity);
|
|
215
|
+
setSelectedAge(age);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}, [activities, menu]);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
const getActivities = async () => {
|
|
223
|
+
setActivities(await fetchMenus(ubloApi, site, lang, "/levels", 2));
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
getActivities();
|
|
227
|
+
}, [lang, site, ubloApi]);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
const {
|
|
230
|
+
menu
|
|
231
|
+
} = selectedAge;
|
|
232
|
+
|
|
233
|
+
if (menu !== undefined) {
|
|
234
|
+
const getLevels = async () => {
|
|
235
|
+
const [levels, contents] = await Promise.all([fetchMenus(ubloApi, site, lang, menu), fetchZones(ubloApi, site, lang, menu)]);
|
|
236
|
+
setLevels(levels);
|
|
237
|
+
setContents(contents);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
getLevels();
|
|
241
|
+
}
|
|
242
|
+
}, [lang, selectedAge, site, ubloApi]);
|
|
243
|
+
return _jsxs("div", {
|
|
244
|
+
className: "evaluate-level",
|
|
245
|
+
children: [!menu && _jsx(Activities, {
|
|
246
|
+
activities: activities,
|
|
247
|
+
selectedActivity: selectedActivity,
|
|
248
|
+
activityChanged: activityChanged,
|
|
249
|
+
selectedAge: selectedAge,
|
|
250
|
+
ageChanged: ageChanged
|
|
251
|
+
}), selectedAge.path && _jsx(Levels, {
|
|
252
|
+
levels: levels,
|
|
253
|
+
contents: contents,
|
|
254
|
+
selectedActivity: selectedActivity,
|
|
255
|
+
selectedAge: selectedAge,
|
|
256
|
+
setSelectedLevel: setSelectedLevel,
|
|
257
|
+
selectedLevel: selectedLevel
|
|
258
|
+
}), selectedLevel && _jsx(LevelDetail, {
|
|
259
|
+
selectedLevel: selectedLevel,
|
|
260
|
+
contents: contents
|
|
261
|
+
})]
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export default EvaluateLevel;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as Data from "./data";
|
|
2
|
+
|
|
3
|
+
const createGescoFile = async (payload, integration) => {
|
|
4
|
+
const host = integration ? Data.HOSTS.TEST : Data.HOSTS.PROD;
|
|
5
|
+
const res = await fetch(`${host}/api/gesco/files/new-with-generic-lines`, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: {
|
|
8
|
+
"content-type": "application/json;charset=utf-8"
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify(payload)
|
|
11
|
+
});
|
|
12
|
+
return res.json();
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const sendFile = async (payload, integration) => {
|
|
16
|
+
const {
|
|
17
|
+
action,
|
|
18
|
+
error
|
|
19
|
+
} = await createGescoFile(payload, integration);
|
|
20
|
+
return {
|
|
21
|
+
action,
|
|
22
|
+
error
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styles from "./bin-icon.module.css";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
const BinIcon = () => {
|
|
7
|
+
return _jsxs("svg", {
|
|
8
|
+
className: styles.bin,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
children: [_jsx("path", {
|
|
13
|
+
d: "M4.87868 22.1213C4.31607 21.5587 4 20.7956 4 20V7H6V20C6 20.2652 6.10536 20.5196 6.29289 20.7071C6.48043 20.8946 6.73478 21 7 21H17C17.2652 21 17.5196 20.8946 17.7071 20.7071C17.8946 20.5196 18 20.2652 18 20V7H20V20C20 20.7956 19.6839 21.5587 19.1213 22.1213C18.5587 22.6839 17.7956 23 17 23H7C6.20435 23 5.44129 22.6839 4.87868 22.1213Z"
|
|
14
|
+
}), _jsx("path", {
|
|
15
|
+
fillRule: "evenodd",
|
|
16
|
+
clipRule: "evenodd",
|
|
17
|
+
d: "M10 10C10.2652 10 10.5196 10.1054 10.7071 10.2929C10.8946 10.4804 11 10.7348 11 11V17C11 17.2652 10.8946 17.5196 10.7071 17.7071C10.5196 17.8946 10.2652 18 10 18C9.73478 18 9.48043 17.8946 9.29289 17.7071C9.10536 17.5196 9 17.2652 9 17V11C9 10.7348 9.10536 10.4804 9.29289 10.2929C9.48043 10.1054 9.73478 10 10 10ZM14 10C14.2652 10 14.5196 10.1054 14.7071 10.2929C14.8946 10.4804 15 10.7348 15 11V17C15 17.2652 14.8946 17.5196 14.7071 17.7071C14.5196 17.8946 14.2652 18 14 18C13.7348 18 13.4804 17.8946 13.2929 17.7071C13.1054 17.5196 13 17.2652 13 17V11C13 10.7348 13.1054 10.4804 13.2929 10.2929C13.4804 10.1054 13.7348 10 14 10Z"
|
|
18
|
+
}), _jsxs("g", {
|
|
19
|
+
className: styles.handle,
|
|
20
|
+
children: [_jsx("path", {
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
clipRule: "evenodd",
|
|
23
|
+
d: "M2 6C2 5.73478 2.10536 5.48043 2.29289 5.29289C2.48043 5.10536 2.73478 5 3 5H21C21.2652 5 21.5196 5.10536 21.7071 5.29289C21.8946 5.48043 22 5.73478 22 6C22 6.26522 21.8946 6.51957 21.7071 6.70711C21.5196 6.89464 21.2652 7 21 7H3C2.73478 7 2.48043 6.89464 2.29289 6.70711C2.10536 6.51957 2 6.26522 2 6Z"
|
|
24
|
+
}), _jsx("path", {
|
|
25
|
+
d: "M9.29289 3.29289C9.48043 3.10536 9.73478 3 10 3H14C14.2652 3 14.5196 3.10536 14.7071 3.29289C14.8946 3.48043 15 3.73478 15 4V5H17V4C17 3.20435 16.6839 2.44129 16.1213 1.87868C15.5587 1.31607 14.7956 1 14 1H10C9.20435 1 8.44129 1.31607 7.87868 1.87868C7.31607 2.44129 7 3.20435 7 4V5H9V4C9 3.73478 9.10536 3.48043 9.29289 3.29289Z"
|
|
26
|
+
})]
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default BinIcon;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ReactDOM from "react-dom";
|
|
3
|
+
import Popup from "../../popup";
|
|
4
|
+
import Button from "dt-design-system/es/button";
|
|
5
|
+
import * as DTIcons from "dt-design-system/es/icons";
|
|
6
|
+
import Field from "./field";
|
|
7
|
+
import * as Messages from "../messages";
|
|
8
|
+
import * as Utils from "../utils";
|
|
9
|
+
import * as Data from "../data";
|
|
10
|
+
import * as Api from "../api";
|
|
11
|
+
import styles from "./customer-form.module.css";
|
|
12
|
+
import Stay from "./stay";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const RESPONSE = {
|
|
16
|
+
ERROR: 0,
|
|
17
|
+
LOADING: 1,
|
|
18
|
+
OK: 2
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getInitialState = fields => Object.keys(fields).reduce((acc, key) => ({ ...acc,
|
|
22
|
+
[key]: {
|
|
23
|
+
value: "",
|
|
24
|
+
validator: !fields[key].required || false
|
|
25
|
+
}
|
|
26
|
+
}), {});
|
|
27
|
+
|
|
28
|
+
const CustomerForm = ({
|
|
29
|
+
lang,
|
|
30
|
+
close,
|
|
31
|
+
open,
|
|
32
|
+
rows,
|
|
33
|
+
setRows,
|
|
34
|
+
voucher,
|
|
35
|
+
setVoucher,
|
|
36
|
+
disableVoucher,
|
|
37
|
+
manualStay,
|
|
38
|
+
channel,
|
|
39
|
+
merchant,
|
|
40
|
+
resort,
|
|
41
|
+
integration
|
|
42
|
+
}) => {
|
|
43
|
+
const fields = manualStay ? { ...Data.stayFields,
|
|
44
|
+
...Data.customerFormFields
|
|
45
|
+
} : Data.customerFormFields;
|
|
46
|
+
const [customerData, setCustomerData] = React.useState(getInitialState(fields));
|
|
47
|
+
const [response, setResponse] = React.useState();
|
|
48
|
+
const isFormValid = Object.keys(customerData).every(key => customerData[key].validator);
|
|
49
|
+
|
|
50
|
+
const onSubmit = async () => {
|
|
51
|
+
setResponse(RESPONSE.LOADING);
|
|
52
|
+
const payload = Utils.buildPayload(lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher);
|
|
53
|
+
const {
|
|
54
|
+
error
|
|
55
|
+
} = await Api.sendFile(payload, integration);
|
|
56
|
+
|
|
57
|
+
if (error) {
|
|
58
|
+
setResponse(RESPONSE.ERROR);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setCustomerData(getInitialState(fields));
|
|
63
|
+
setRows([]);
|
|
64
|
+
setVoucher("");
|
|
65
|
+
setResponse(RESPONSE.OK);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (!open) return null;
|
|
69
|
+
return ReactDOM.createPortal(_jsx(Popup, {
|
|
70
|
+
className: styles.popup,
|
|
71
|
+
close: close,
|
|
72
|
+
title: Messages.get(lang, "customer-information"),
|
|
73
|
+
children: _jsxs("div", {
|
|
74
|
+
className: styles.inner,
|
|
75
|
+
children: [_jsx(Stay, {
|
|
76
|
+
lang: lang
|
|
77
|
+
}), _jsx("div", {
|
|
78
|
+
className: styles.form,
|
|
79
|
+
children: Object.keys(fields).map(key => _jsx(Field, {
|
|
80
|
+
lang: lang,
|
|
81
|
+
name: key,
|
|
82
|
+
field: fields[key],
|
|
83
|
+
data: customerData,
|
|
84
|
+
setData: setCustomerData
|
|
85
|
+
}, key))
|
|
86
|
+
}), _jsxs("div", {
|
|
87
|
+
className: styles.footer,
|
|
88
|
+
children: [_jsxs(Button, {
|
|
89
|
+
className: styles.confirm,
|
|
90
|
+
disabled: !isFormValid || response === RESPONSE.LOADING,
|
|
91
|
+
onClick: onSubmit,
|
|
92
|
+
children: [Messages.get(lang, "send-request"), _jsx(DTIcons.Check, {})]
|
|
93
|
+
}), response === RESPONSE.ERROR && _jsx("div", {
|
|
94
|
+
className: styles.error,
|
|
95
|
+
children: Messages.get(lang, "form-error")
|
|
96
|
+
}), response === RESPONSE.OK && _jsx("div", {
|
|
97
|
+
className: styles.sent,
|
|
98
|
+
children: Messages.get(lang, "form-sent")
|
|
99
|
+
})]
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
}), document.body);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default CustomerForm;
|