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.
Files changed (168) hide show
  1. package/es/common/components/admin-links/admin-links.js +107 -0
  2. package/es/common/components/admin-links/admin-links.module.css +85 -0
  3. package/es/common/components/admin-links/index.js +2 -0
  4. package/es/common/components/analytics.js +46 -0
  5. package/es/common/components/breadcrumb.js +69 -0
  6. package/es/common/components/carousel-zone.js +61 -0
  7. package/es/common/components/carousel.js +365 -0
  8. package/es/common/components/cookie-consent/cookie-consent.js +111 -0
  9. package/es/common/components/cookie-consent/cookie-consent.module.css +103 -0
  10. package/es/common/components/cookie-consent/index.js +3 -0
  11. package/es/common/components/cookie-consent/messages.js +31 -0
  12. package/es/common/components/custom-contact-form/attachment.js +229 -0
  13. package/es/common/components/custom-contact-form/attachment.module.css +211 -0
  14. package/es/common/components/custom-contact-form/custom-contact-form.js +168 -0
  15. package/es/common/components/custom-contact-form/field.js +294 -0
  16. package/es/common/components/custom-contact-form/field.module.css +17 -0
  17. package/es/common/components/custom-contact-form/icons.js +55 -0
  18. package/es/common/components/custom-contact-form/index.js +2 -0
  19. package/es/common/components/custom-contact-form/index.module.css +119 -0
  20. package/es/common/components/custom-contact-form/messages.js +79 -0
  21. package/es/common/components/custom-contact-form/utils.js +132 -0
  22. package/es/common/components/date-picker/calendar.js +246 -0
  23. package/es/common/components/date-picker/calendar.module.css +123 -0
  24. package/es/common/components/date-picker/data.js +96 -0
  25. package/es/common/components/date-picker/date-item.js +127 -0
  26. package/es/common/components/date-picker/date-item.module.css +78 -0
  27. package/es/common/components/date-picker/date-picker.js +119 -0
  28. package/es/common/components/date-picker/date-picker.module.css +111 -0
  29. package/es/common/components/date-picker/helper.js +41 -0
  30. package/es/common/components/date-picker/helper.module.css +81 -0
  31. package/es/common/components/date-picker/index.js +3 -0
  32. package/es/common/components/date-picker/messages.js +34 -0
  33. package/es/common/components/date-picker/modes.js +42 -0
  34. package/es/common/components/date-picker/modes.module.css +90 -0
  35. package/es/common/components/date-picker/month.js +78 -0
  36. package/es/common/components/date-picker/month.module.css +54 -0
  37. package/es/common/components/date-picker/utils.js +121 -0
  38. package/es/common/components/error-404/error-404.js +51 -0
  39. package/es/common/components/error-404/error-404.module.css +55 -0
  40. package/es/common/components/error-404/index.js +2 -0
  41. package/es/common/components/error-404/messages.js +29 -0
  42. package/es/common/components/faq.js +54 -0
  43. package/es/common/components/info-buttons.js +116 -0
  44. package/es/common/components/plausible/hooks/use-plausible.js +33 -0
  45. package/es/common/components/plausible/index.js +7 -0
  46. package/es/common/components/plausible/plausible.js +20 -0
  47. package/es/common/components/plausible/services/callback.js +63 -0
  48. package/es/common/components/plausible/services/load.js +7 -0
  49. package/es/common/components/plausible/services/send-goal.js +10 -0
  50. package/es/common/components/popup.js +90 -0
  51. package/es/common/components/scroll-spy.js +53 -0
  52. package/es/common/components/tabbed-zones.js +110 -0
  53. package/es/common/components/unsupported-browser.js +158 -0
  54. package/es/common/components/video-player/controls.js +125 -0
  55. package/es/common/components/video-player/icons.js +45 -0
  56. package/es/common/components/video-player/index.js +1 -0
  57. package/es/common/components/video-player/player.module.css +151 -0
  58. package/es/common/components/video-player/utils.js +43 -0
  59. package/es/common/components/video-player/video-player.js +111 -0
  60. package/es/common/hooks/use-faq.js +44 -0
  61. package/es/common/hooks/use-in-view.js +73 -0
  62. package/es/common/hooks/use-injected-cms-markup.js +50 -0
  63. package/es/common/hooks/use-packages.js +127 -0
  64. package/es/common/hooks/use-scroll-direction.js +44 -0
  65. package/es/common/hooks/use-stay.js +32 -0
  66. package/es/common/hooks/use-sticky.js +38 -0
  67. package/es/common/hooks/use-tunnel.js +50 -0
  68. package/es/common/hooks/use-window-sizes.js +37 -0
  69. package/es/common/hooks/use-youtube-popup.js +62 -0
  70. package/es/common/hooks/use-zone-sync.js +65 -0
  71. package/es/common/utils/cookies.js +13 -0
  72. package/es/common/utils/copy.js +11 -0
  73. package/es/common/utils/dates.js +8 -0
  74. package/es/common/utils/events.js +25 -0
  75. package/es/common/utils/fetcher.js +37 -0
  76. package/es/common/utils/file-manager.js +14 -0
  77. package/es/common/utils/load-js.js +11 -0
  78. package/es/common/utils/msem-widget.js +16 -0
  79. package/es/common/utils/touch-device.js +1 -0
  80. package/es/common/utils/url-parameters.js +12 -0
  81. package/es/empty.d.ts +4 -0
  82. package/es/empty.d.ts.map +1 -0
  83. package/es/empty.js +6 -0
  84. package/es/esf/components/booking-form/data.js +213 -0
  85. package/es/esf/components/booking-form/field.js +140 -0
  86. package/es/esf/components/booking-form/hooks/use-custom-fields.js +20 -0
  87. package/es/esf/components/booking-form/hooks/use-stay.js +12 -0
  88. package/es/esf/components/booking-form/icons.js +50 -0
  89. package/es/esf/components/booking-form/index.js +78 -0
  90. package/es/esf/components/booking-form/lesson.js +59 -0
  91. package/es/esf/components/booking-form/lessons.js +93 -0
  92. package/es/esf/components/booking-form/messages.js +52 -0
  93. package/es/esf/components/booking-form/personal-data.js +73 -0
  94. package/es/esf/components/booking-form/progress-bar.js +35 -0
  95. package/es/esf/components/booking-form/response.js +42 -0
  96. package/es/esf/components/booking-form/steps.js +81 -0
  97. package/es/esf/components/booking-form/summary.js +138 -0
  98. package/es/esf/components/booking-form/utils.js +72 -0
  99. package/es/esf/components/contact-form/api.js +36 -0
  100. package/es/esf/components/contact-form/contact-form.js +293 -0
  101. package/es/esf/components/contact-form/contact-form.module.css +51 -0
  102. package/es/esf/components/contact-form/data.js +53 -0
  103. package/es/esf/components/contact-form/index.js +2 -0
  104. package/es/esf/components/contact-form/messages.js +75 -0
  105. package/es/esf/components/contact-form/validation.js +63 -0
  106. package/es/esf/components/covid-link/index.js +119 -0
  107. package/es/esf/components/covid-link/index.module.css +108 -0
  108. package/es/esf/components/covid-link/mask-icon.js +17 -0
  109. package/es/esf/components/covid-link/vax-pass-icon.js +34 -0
  110. package/es/esf/components/cp-form.js +65 -0
  111. package/es/esf/components/instructor-suggestions/fetcher.js +17 -0
  112. package/es/esf/components/instructor-suggestions/icons.js +266 -0
  113. package/es/esf/components/instructor-suggestions/index.js +181 -0
  114. package/es/esf/components/instructor-suggestions/loader.js +10 -0
  115. package/es/esf/components/instructor-suggestions/messages.js +16 -0
  116. package/es/esf/components/instructors-book/container.js +18 -0
  117. package/es/esf/components/instructors-book/details.js +120 -0
  118. package/es/esf/components/instructors-book/icons.js +266 -0
  119. package/es/esf/components/instructors-book/index.js +15 -0
  120. package/es/esf/components/instructors-book/link.js +17 -0
  121. package/es/esf/components/instructors-book/list-utils.js +21 -0
  122. package/es/esf/components/instructors-book/list.js +184 -0
  123. package/es/esf/components/instructors-book/loader.js +10 -0
  124. package/es/esf/components/instructors-book/messages.js +44 -0
  125. package/es/esf/components/instructors-book/utils.js +5 -0
  126. package/es/esf/components/levels.js +265 -0
  127. package/es/esf/components/loyal-customers/api.js +24 -0
  128. package/es/esf/components/loyal-customers/components/bin-icon.js +31 -0
  129. package/es/esf/components/loyal-customers/components/bin-icon.module.css +9 -0
  130. package/es/esf/components/loyal-customers/components/customer-form.js +105 -0
  131. package/es/esf/components/loyal-customers/components/customer-form.module.css +40 -0
  132. package/es/esf/components/loyal-customers/components/field.js +119 -0
  133. package/es/esf/components/loyal-customers/components/field.module.css +3 -0
  134. package/es/esf/components/loyal-customers/components/row.js +77 -0
  135. package/es/esf/components/loyal-customers/components/row.module.css +95 -0
  136. package/es/esf/components/loyal-customers/components/rows.js +38 -0
  137. package/es/esf/components/loyal-customers/components/rows.module.css +11 -0
  138. package/es/esf/components/loyal-customers/components/stay.js +37 -0
  139. package/es/esf/components/loyal-customers/components/stay.module.css +18 -0
  140. package/es/esf/components/loyal-customers/components/student-form.js +105 -0
  141. package/es/esf/components/loyal-customers/components/student-form.module.css +68 -0
  142. package/es/esf/components/loyal-customers/components/voucher.js +26 -0
  143. package/es/esf/components/loyal-customers/components/voucher.module.css +7 -0
  144. package/es/esf/components/loyal-customers/content.js +55 -0
  145. package/es/esf/components/loyal-customers/data.js +131 -0
  146. package/es/esf/components/loyal-customers/hooks/use-stored-rows.js +14 -0
  147. package/es/esf/components/loyal-customers/index.js +2 -0
  148. package/es/esf/components/loyal-customers/loyal-customers.js +141 -0
  149. package/es/esf/components/loyal-customers/loyal-customers.module.css +62 -0
  150. package/es/esf/components/loyal-customers/messages.js +59 -0
  151. package/es/esf/components/loyal-customers/utils.js +81 -0
  152. package/es/esf/components/village-maps/icons.js +35 -0
  153. package/es/esf/components/village-maps/index.js +214 -0
  154. package/es/esf/components/village-maps/messages.js +19 -0
  155. package/es/esf/components/village-maps/utils.js +26 -0
  156. package/es/esf/components/week-picker/index.js +244 -0
  157. package/es/esf/components/week-picker/messages.js +36 -0
  158. package/es/esf/components/week-picker/utils.js +65 -0
  159. package/es/esf/components/week-picker/week.js +52 -0
  160. package/es/esf/components/week-picker-2/index.js +283 -0
  161. package/es/esf/components/week-picker-2/messages.js +27 -0
  162. package/es/esf/components/week-picker-2/utils.js +65 -0
  163. package/es/esf/components/week-picker-2/week.js +55 -0
  164. package/es/esf/hooks/use-affiliation.js +26 -0
  165. package/es/esf/hooks/use-booking-links.js +36 -0
  166. package/es/esf/hooks/use-reviews.js +28 -0
  167. package/es/esf/hooks/use-season-products.js +100 -0
  168. package/package.json +51 -0
@@ -0,0 +1,107 @@
1
+ import * as React from "react";
2
+ import { useUbloContext } from "ublo/with-ublo";
3
+ import { loadFileManager } from "../../utils/file-manager";
4
+ import styles from "./index.module.css";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
8
+
9
+ const ToggleIcon = () => {
10
+ return _jsx("svg", {
11
+ viewBox: "0 0 24 24",
12
+ width: "24",
13
+ height: "24",
14
+ className: styles.toggleIcon,
15
+ children: _jsx("path", {
16
+ d: "M19.44 12.99l-.01.02c.04-.33.08-.67.08-1.01 0-.34-.03-.66-.07-.99l.01.02 2.44-1.92-2.43-4.22-2.87 1.16.01.01c-.52-.4-1.09-.74-1.71-1h.01L14.44 2H9.57l-.44 3.07h.01c-.62.26-1.19.6-1.71 1l.01-.01-2.88-1.17-2.44 4.22 2.44 1.92.01-.02c-.04.33-.07.65-.07.99 0 .34.03.68.08 1.01l-.01-.02-2.1 1.65-.33.26 2.43 4.2 2.88-1.15-.02-.04c.53.41 1.1.75 1.73 1.01h-.03L9.58 22h4.85s.03-.18.06-.42l.38-2.65h-.01c.62-.26 1.2-.6 1.73-1.01l-.02.04 2.88 1.15 2.43-4.2s-.14-.12-.33-.26l-2.11-1.66zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"
17
+ })
18
+ });
19
+ };
20
+
21
+ const AdminLinks = ({
22
+ customLinks
23
+ }) => {
24
+ const {
25
+ lang,
26
+ cmsMode,
27
+ config
28
+ } = useUbloContext();
29
+ const [open, setOpen] = React.useState(false);
30
+ const hasLangPrefix = config.langPrefix.links;
31
+ const {
32
+ plausibleLink
33
+ } = config;
34
+ const links = {
35
+ msemAdmin: {
36
+ name: "Administration MseM",
37
+ onClick: "https://admin.mon-sejour-en-montagne.com/",
38
+ target: "_blank"
39
+ },
40
+ tutoriels: {
41
+ name: "Tutoriels",
42
+ onClick: "http://esf-tutoriels.valraiso.net/",
43
+ target: "_blank"
44
+ },
45
+ popup: {
46
+ name: "Popup",
47
+ onClick: hasLangPrefix ? `/${lang.concat("/popup")}` : "/popup"
48
+ },
49
+ fileManager: {
50
+ name: "Photothèque",
51
+ onClick: loadFileManager
52
+ },
53
+ plausible: {
54
+ name: "Statistiques",
55
+ onClick: plausibleLink,
56
+ target: "_blank"
57
+ },
58
+ ...customLinks
59
+ };
60
+ return _jsx("div", {
61
+ className: styles.root,
62
+ children: cmsMode && _jsxs(_Fragment, {
63
+ children: [_jsx("div", {
64
+ className: styles.toggle,
65
+ onClick: () => setOpen(!open),
66
+ children: _jsx(ToggleIcon, {})
67
+ }), open && _jsxs("div", {
68
+ className: styles.links,
69
+ children: [_jsx("div", {
70
+ className: styles.linksTitle,
71
+ children: "Liens utiles"
72
+ }), Object.keys(links).map((key, i) => {
73
+ const link = links[key];
74
+ if (!link) return;
75
+ const {
76
+ name,
77
+ onClick,
78
+ target
79
+ } = link;
80
+ const isHrefValid = typeof onClick === "string" && onClick !== "";
81
+ const isFunction = typeof onClick === "function";
82
+
83
+ if (!isHrefValid && !isFunction) {
84
+ return null;
85
+ }
86
+
87
+ const Tag = isHrefValid ? "a" : "button";
88
+ const anchorProps = {
89
+ href: onClick,
90
+ target
91
+ };
92
+ const buttonProps = {
93
+ onClick
94
+ };
95
+ const props = isFunction ? buttonProps : anchorProps;
96
+ return _jsx(Tag, {
97
+ className: styles.link,
98
+ ...props,
99
+ children: name
100
+ }, i);
101
+ })]
102
+ })]
103
+ })
104
+ });
105
+ };
106
+
107
+ export default AdminLinks;
@@ -0,0 +1,85 @@
1
+ .root {
2
+ position: absolute;
3
+ bottom: 5px;
4
+ left: 30px;
5
+ font-family: "Open Sans", sans-serif;
6
+ z-index: 900;
7
+ }
8
+
9
+ .toggle {
10
+ width: 20px;
11
+ height: 20px;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ background-color: #fff;
16
+ border-radius: 50%;
17
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.12);
18
+ cursor: pointer;
19
+ user-select: none;
20
+ z-index: 2;
21
+ }
22
+
23
+ .toggleIcon {
24
+ width: 14px;
25
+ height: 14px;
26
+ fill: #484848;
27
+ }
28
+
29
+ .links {
30
+ position: absolute;
31
+ bottom: 30px;
32
+ left: 0;
33
+ max-width: 90vw;
34
+ display: flex;
35
+ flex-direction: column;
36
+ padding: 16px;
37
+ color: var(--cms-grey-000, #ffffff);
38
+ background: var(
39
+ --cms-blue-gradient,
40
+ linear-gradient(
41
+ 175deg,
42
+ var(--cms-secondary-color, #4177f6),
43
+ var(--cms-primary-color, #004cc2)
44
+ )
45
+ );
46
+ border-radius: var(--cms-radius-300, 15px);
47
+ box-shadow: var(--cms-shadow-300, 0 5px 10px rgba(0, 0, 0, 0.24));
48
+ transform-origin: bottom left;
49
+ animation: admin-links-appearance 240ms
50
+ var(--cms-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
51
+ }
52
+
53
+ @keyframes admin-links-appearance {
54
+ 0% {
55
+ opacity: 0;
56
+ transform: scale(0.7);
57
+ }
58
+ 70% {
59
+ transform: scale(1.025);
60
+ }
61
+ }
62
+
63
+ .linksTitle {
64
+ margin-bottom: 5px;
65
+ font-size: 17px;
66
+ font-weight: 700;
67
+ text-align: left;
68
+ }
69
+
70
+ .link {
71
+ font-size: 15px;
72
+ font-family: inherit;
73
+ color: inherit;
74
+ font-weight: 400;
75
+ text-transform: none;
76
+ text-align: left;
77
+ white-space: nowrap;
78
+ cursor: pointer;
79
+ }
80
+
81
+ .link:hover,
82
+ .link:active,
83
+ .link:focus {
84
+ text-decoration: underline;
85
+ }
@@ -0,0 +1,2 @@
1
+ import AdminLinks from "./admin-links";
2
+ export default AdminLinks;
@@ -0,0 +1,46 @@
1
+ import { useEffect } from "react";
2
+ import { useUbloContext } from "ublo/with-ublo";
3
+
4
+ const loadGTag = id => new Promise(resolve => {
5
+ const script = document.createElement("script");
6
+ script.src = `https://www.googletagmanager.com/gtag/js?id=${id}`;
7
+ script.onload = resolve;
8
+ document.body.appendChild(script);
9
+ });
10
+
11
+ const Analytics = ({
12
+ consent,
13
+ gaAccountOverride
14
+ }) => {
15
+ const {
16
+ config
17
+ } = useUbloContext();
18
+ const {
19
+ gaAccount
20
+ } = config;
21
+ const gaId = gaAccountOverride || gaAccount;
22
+ useEffect(() => {
23
+ const startGTag = async () => {
24
+ await loadGTag(gaId);
25
+ window.dataLayer = window.dataLayer || [];
26
+
27
+ function gtag() {
28
+ window.dataLayer.push(arguments);
29
+ }
30
+
31
+ gtag("js", new Date());
32
+ gtag("config", gaId);
33
+ };
34
+
35
+ const allowAnalytics = consent && gaId;
36
+
37
+ if (allowAnalytics) {
38
+ startGTag();
39
+ }
40
+
41
+ window[`ga-disable-${gaId}`] = !allowAnalytics;
42
+ }, [consent, gaId]);
43
+ return null;
44
+ };
45
+
46
+ export default Analytics;
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import Link from "ublo/link";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+
7
+ const Item = ({
8
+ page,
9
+ path,
10
+ itemTitle,
11
+ nextItem,
12
+ isCurrent
13
+ }) => {
14
+ const hasTemplate = page !== undefined;
15
+ const isExternalUrl = /^((http|https):\/\/)/.test(path);
16
+ const noHref = isCurrent || !hasTemplate;
17
+ const Tag = isExternalUrl ? "a" : noHref ? "span" : Link;
18
+ const linkProps = {
19
+ title: itemTitle,
20
+ page,
21
+ as: path
22
+ };
23
+ const spanProps = {
24
+ dangerouslySetInnerHTML: {
25
+ __html: itemTitle
26
+ }
27
+ };
28
+ const anchorProps = { ...spanProps,
29
+ href: path
30
+ };
31
+ const props = isExternalUrl ? anchorProps : noHref ? spanProps : linkProps;
32
+ return _jsxs(_Fragment, {
33
+ children: [_jsx(Tag, {
34
+ className: "breadcrumb__item",
35
+ ...props
36
+ }), nextItem]
37
+ });
38
+ };
39
+
40
+ const renderBreadcrumbItems = (rawItem, exclusions) => {
41
+ const {
42
+ next,
43
+ title,
44
+ path,
45
+ page,
46
+ shortTitle
47
+ } = rawItem;
48
+ const isCurrent = next === undefined;
49
+ const isNextExcluded = !isCurrent && exclusions.includes(next.name);
50
+ const itemToRender = isNextExcluded ? next.next : next;
51
+ const nextItem = !isCurrent && renderBreadcrumbItems(itemToRender, exclusions);
52
+ return _jsx(Item, {
53
+ page: page,
54
+ path: path,
55
+ itemTitle: shortTitle || title,
56
+ nextItem: nextItem,
57
+ isCurrent: isCurrent
58
+ });
59
+ };
60
+
61
+ const Breadcrumb = ({
62
+ breadcrumb,
63
+ exclusions = []
64
+ }) => _jsx("div", {
65
+ className: "breadcrumb",
66
+ children: renderBreadcrumbItems(breadcrumb, exclusions)
67
+ });
68
+
69
+ export default Breadcrumb;
@@ -0,0 +1,61 @@
1
+ import * as React from "react";
2
+ import Zone from "ublo/zone";
3
+ import { useUbloContext } from "ublo/with-ublo";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+
6
+ const CarouselZone = ({
7
+ id,
8
+ options = {},
9
+ ...props
10
+ }) => {
11
+ const {
12
+ cmsMode
13
+ } = useUbloContext();
14
+ const {
15
+ duration = 5000,
16
+ transition = 160,
17
+ fade = true,
18
+ auto = true,
19
+ prevButton,
20
+ nextButton,
21
+ navigation
22
+ } = options;
23
+ const carouselOpt = {
24
+ duration,
25
+ transition,
26
+ fade: cmsMode === "editing" ? false : fade,
27
+ auto,
28
+ prevButton: cmsMode === "editing" ? _jsx("div", {
29
+ className: "carousel__button carousel__button--editing carousel__button--left",
30
+ children: _jsx("svg", {
31
+ className: "carousel__icon",
32
+ viewBox: "0 0 24 24",
33
+ children: _jsx("path", {
34
+ d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"
35
+ })
36
+ })
37
+ }) : prevButton,
38
+ nextButton: cmsMode === "editing" ? _jsx("div", {
39
+ className: "carousel__button carousel__button--editing carousel__button--right",
40
+ children: _jsx("svg", {
41
+ className: "carousel__icon",
42
+ viewBox: "0 0 24 24",
43
+ children: _jsx("path", {
44
+ d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
45
+ })
46
+ })
47
+ }) : nextButton,
48
+ navigation
49
+ };
50
+ return _jsx("div", {
51
+ className: "carousel-zone",
52
+ children: _jsx(Zone, {
53
+ id: id,
54
+ carousel: true,
55
+ carouselOpt: carouselOpt,
56
+ ...props
57
+ })
58
+ });
59
+ };
60
+
61
+ export default CarouselZone;