ublo-lib 1.7.0 → 1.7.2

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 (42) hide show
  1. package/es/common/components/cookie-consent/cookie-consent.js +4 -4
  2. package/es/common/components/custom-contact-form/custom-contact-form.js +1 -0
  3. package/es/common/components/custom-contact-form/utils.js +2 -2
  4. package/es/common/components/date-picker/calendar.js +2 -2
  5. package/es/common/components/date-picker/date-picker.js +3 -3
  6. package/es/common/components/faq.js +1 -1
  7. package/es/common/components/gesco-contact-form/gesco-contact-form.js +2 -2
  8. package/es/common/components/info-buttons.js +2 -2
  9. package/es/common/components/plausible/services/callback.js +1 -0
  10. package/es/common/components/scroll-spy.js +1 -1
  11. package/es/common/components/search-bar/search-bar.js +2 -2
  12. package/es/common/hooks/use-packages.js +1 -6
  13. package/es/common/hooks/use-scroll-direction.d.ts +1 -1
  14. package/es/common/hooks/use-scroll-direction.d.ts.map +1 -1
  15. package/es/common/hooks/use-scroll-direction.js +1 -1
  16. package/es/common/hooks/use-youtube-popup.js +1 -1
  17. package/es/common/hooks/use-zone-sync.js +1 -1
  18. package/es/common/utils/fetcher.js +1 -0
  19. package/es/esf/components/covid-link/index.js +6 -97
  20. package/es/esf/components/covid-link/mask-icon.js +1 -0
  21. package/es/esf/components/covid-link/vax-pass-icon.js +1 -0
  22. package/es/esf/components/instructors-book/instructors-book.js +15 -15
  23. package/es/esf/components/instructors-book/list.js +1 -1
  24. package/es/esf/components/instructors-book/messages.js +1 -1
  25. package/es/esf/components/magic-box/magic-box.d.ts +19 -0
  26. package/es/esf/components/magic-box/magic-box.d.ts.map +1 -0
  27. package/es/esf/components/magic-box/magic-box.js +62 -114
  28. package/es/esf/components/magic-box/services/api.js +2 -7
  29. package/es/esf/components/period-picker/services/events.js +1 -1
  30. package/es/esf/components/reviews.js +1 -1
  31. package/es/esf/components/village-maps/index.js +2 -2
  32. package/es/esf/components/week-picker/index.js +10 -9
  33. package/es/esf/components/week-picker/messages.js +1 -1
  34. package/es/esf/components/week-picker-2/index.js +10 -9
  35. package/es/esf/components/week-picker-2/messages.js +1 -1
  36. package/es/esf/hooks/use-booking-links.js +1 -1
  37. package/es/esf/hooks/use-reviews.js +1 -1
  38. package/es/esf/hooks/use-season-products.js +1 -1
  39. package/es/lbm/components/msem-linker/actions.js +0 -1
  40. package/es/lbm/components/msem-linker/editor/ski-pass.js +0 -1
  41. package/package.json +4 -2
  42. package/es/common/components/unsupported-browser.js +0 -150
@@ -28,7 +28,7 @@ const CookieConsent = ({
28
28
  updateConsent(true);
29
29
  }
30
30
  }
31
- }, [isEnabled, mounted]);
31
+ }, [isEnabled, mounted, updateConsent]);
32
32
  if (!mounted) return null;
33
33
  const classes = classnames(css.banner, {
34
34
  [css.opened]: consent === null
@@ -80,9 +80,9 @@ export const useCookieConsent = () => {
80
80
  const updateConsent = value => {
81
81
  try {
82
82
  if (value === null || value === undefined) {
83
- localStorage.removeItem(COOKIE_STORAGE);
83
+ window.localStorage.removeItem(COOKIE_STORAGE);
84
84
  } else {
85
- localStorage.setItem(COOKIE_STORAGE, value);
85
+ window.localStorage.setItem(COOKIE_STORAGE, value);
86
86
  }
87
87
  setConsent(value);
88
88
  } catch (e) {
@@ -91,7 +91,7 @@ export const useCookieConsent = () => {
91
91
  };
92
92
  React.useEffect(() => {
93
93
  try {
94
- const stored = localStorage.getItem(COOKIE_STORAGE);
94
+ const stored = window.localStorage.getItem(COOKIE_STORAGE);
95
95
  const currentConsent = !stored ? null : Boolean(stored);
96
96
  setConsent(currentConsent);
97
97
  } catch (e) {
@@ -7,6 +7,7 @@ import Button from "dt-design-system/es/button";
7
7
  import * as Messages from "./messages";
8
8
  import * as Icons from "./icons";
9
9
  import * as DTIcons from "dt-design-system/es/icons";
10
+ import * as Plausible from "../plausible";
10
11
  import styles from "./custom-contact-form.module.css";
11
12
  import { getInitialFormState, getSettings, send } from "./utils";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -83,7 +83,7 @@ export const validate = (type, value, required) => {
83
83
  return regex.test(value);
84
84
  };
85
85
  export const convertToFileList = list => {
86
- const dataTransfer = new DataTransfer();
86
+ const dataTransfer = new window.DataTransfer();
87
87
  list.forEach(item => dataTransfer.items.add(item));
88
88
  return dataTransfer.files;
89
89
  };
@@ -96,7 +96,7 @@ export const send = async ({
96
96
  }) => {
97
97
  const endpoint = `https://contacts.valraiso.net/api/contact/${site}`;
98
98
  const dataKeys = Object.keys(data);
99
- const formData = new FormData();
99
+ const formData = new window.FormData();
100
100
  dataKeys.forEach(key => {
101
101
  if (key === "attachment") {
102
102
  return Array.from(data[key].value).forEach(file => {
@@ -86,7 +86,7 @@ const Calendar = ({
86
86
  setYear(newYear);
87
87
  };
88
88
  const submit = () => {
89
- const hasCart = sessionStorage.cartId !== undefined;
89
+ const hasCart = window.sessionStorage.cartId !== undefined;
90
90
  if (hasCart) {
91
91
  setShowPopup(true);
92
92
  } else {
@@ -220,7 +220,7 @@ const Calendar = ({
220
220
  lang: lang,
221
221
  cancel: () => setShowPopup(false),
222
222
  confirm: () => {
223
- sessionStorage.removeItem("cartId");
223
+ window.sessionStorage.removeItem("cartId");
224
224
  onSubmit(selectedDates);
225
225
  setShowPopup(false);
226
226
  }
@@ -38,7 +38,7 @@ const DatePicker = ({
38
38
  return Data.MODES.CUSTOM;
39
39
  };
40
40
  const [currentMode, setCurrentMode] = React.useState(getDefaultMode());
41
- const resized = () => {
41
+ const resized = React.useCallback(() => {
42
42
  if (window.innerWidth <= Data.BREAKPOINTS.PHONE) {
43
43
  setDisplay(Data.DISPLAYS.PHONE);
44
44
  return;
@@ -48,12 +48,12 @@ const DatePicker = ({
48
48
  return;
49
49
  }
50
50
  setDisplay(Data.DISPLAYS.DESKTOP);
51
- };
51
+ }, []);
52
52
  React.useEffect(() => {
53
53
  resized();
54
54
  const isCompatible = typeof ResizeObserver !== "undefined";
55
55
  if (isCompatible) {
56
- const observer = new ResizeObserver(resized);
56
+ const observer = new window.ResizeObserver(resized);
57
57
  observer.observe(document.body);
58
58
  return () => {
59
59
  observer.unobserve(document.body);
@@ -14,7 +14,7 @@ const Faq = ({
14
14
  const [count, setCount] = useState(0);
15
15
  const [current, setCurrent] = useState();
16
16
  useEffect(() => {
17
- if (location.hostname === "localhost") {
17
+ if (window.location.hostname === "localhost") {
18
18
  console.warn("Faq is deprecated, prefer useFaq (ublo-lib/es/common/hooks/use-faq)");
19
19
  }
20
20
  }, []);
@@ -136,13 +136,13 @@ const ContactForm = ({
136
136
  type: "success",
137
137
  message: Messages.get(widgetLang, "messageSent")
138
138
  });
139
+ const country = params.countries.find(country => country.code === payload.country);
140
+ const subject = params.subjects.find(subject => subject.id === Number(payload.subject));
139
141
  Plausible.sendGoal("Contact-us", {
140
142
  Country: country?.name,
141
143
  Subject: subject?.label
142
144
  });
143
145
  setFields(Data.DEFAULT_FIELDS);
144
- const country = params.countries.find(country => country.code === payload.country);
145
- const subject = params.subjects.find(subject => subject.id === Number(payload.subject));
146
146
  }
147
147
  }
148
148
  setSubmiting(false);
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const SLASH = "/";
9
9
  const modules = {
10
- Levels: Levels
10
+ Levels
11
11
  };
12
12
  const isLocalUrl = href => href !== null && href !== undefined && href.length > 2 && href[0] === SLASH && href[1] !== SLASH;
13
13
  const pdfRegex = /.*\.pdf$/;
@@ -68,7 +68,7 @@ const InfoButtons = ({
68
68
  setClosed(true);
69
69
  };
70
70
  useEffect(() => {
71
- if (location.hostname === "localhost") {
71
+ if (window.location.hostname === "localhost") {
72
72
  console.warn("InfoButtons is deprecated, prefer useInfoButtons");
73
73
  }
74
74
  }, []);
@@ -1,3 +1,4 @@
1
+
1
2
  import sendGoal from "./send-goal";
2
3
  const EVENT_NAMES = {
3
4
  view_item: "MseM: View item",
@@ -32,7 +32,7 @@ const ScrollSpy = ({
32
32
  const element = document.getElementById(item);
33
33
  return element ? [...acc, element] : acc;
34
34
  }, defaultTargets) : defaultTargets;
35
- const observer = new IntersectionObserver(callback, {
35
+ const observer = new window.IntersectionObserver(callback, {
36
36
  rootMargin
37
37
  });
38
38
  targets.forEach(observer.observe, observer);
@@ -108,14 +108,14 @@ const SearchBar = ({
108
108
  if (keyId === KeyboardKeys.K && (ctrlKey || metaKey)) {
109
109
  focusInput();
110
110
  }
111
- }, []);
111
+ }, [text]);
112
112
  useEffect(() => {
113
113
  if (autofocus) focusInput();
114
114
  window.addEventListener("keydown", handleKeyPresses);
115
115
  return () => {
116
116
  window.removeEventListener("keydown", handleKeyPresses);
117
117
  };
118
- }, []);
118
+ }, [autofocus, handleKeyPresses]);
119
119
  const Icon = search?.loading ? Icons.LoadIcon : Icons.SearchIcon;
120
120
  const classes = classnames("search-bar", {
121
121
  "search-bar--opened": search?.result,
@@ -1,14 +1,9 @@
1
1
  import * as React from "react";
2
2
  import { useUbloContext } from "ublo/with-ublo";
3
3
  import PackagesSelector from "../components/packages-selector";
4
- import { loadJS } from "../utils/load-js";
5
4
  import { openMseM } from "../utils/msem-widget";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  const preview = typeof window !== "undefined" && window.location.search.indexOf("preview") !== -1;
8
- const loadWigetMseM = () => {
9
- const widgetUrl = "https://widget.msem.tech/static/js/widget-msem.js";
10
- return loadJS(widgetUrl, "widget-msem");
11
- };
12
7
  const buttonStyles = `
13
8
  display: table;
14
9
  position: absolute;
@@ -88,7 +83,7 @@ const usePackages = (defaultPopupContent, setPopupContent, cartUrl, selector = "
88
83
  cartUrl
89
84
  };
90
85
  await openMseM("widgetPackage", options);
91
- }, [cartUrl, cmsMode, resort, selector]);
86
+ }, [cartUrl, channel, cmsMode, resort, selector]);
92
87
  const callback = React.useCallback(e => {
93
88
  const {
94
89
  section: newSection
@@ -4,7 +4,7 @@ declare type Props = {
4
4
  thresholdPixels?: number;
5
5
  off?: boolean;
6
6
  };
7
- declare const useScrollDirection: ({ initialDirection, thresholdPixels, off, }: Props) => {
7
+ declare const useScrollDirection: ({ initialDirection, thresholdPixels, off, }?: Props) => {
8
8
  scrollDir: "up" | "down" | undefined;
9
9
  };
10
10
  export default useScrollDirection;
@@ -1 +1 @@
1
- {"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAEA,aAAK,SAAS,GAAG,IAAI,GAAG,MAAM,CAAC;AAE/B,aAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAKF,QAAA,MAAM,kBAAkB,gDAIrB,KAAK;;CAoCP,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAEA,aAAK,SAAS,GAAG,IAAI,GAAG,MAAM,CAAC;AAE/B,aAAK,KAAK,GAAG;IACX,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAKF,QAAA,MAAM,kBAAkB,iDAIrB,KAAK;;CAoCP,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { useState, useEffect } from "react";
2
2
  const SCROLL_UP = "up";
3
3
  const SCROLL_DOWN = "down";
4
- const useScrollDirection = ({ initialDirection, thresholdPixels, off, }) => {
4
+ const useScrollDirection = ({ initialDirection, thresholdPixels, off, } = {}) => {
5
5
  const [scrollDir, setScrollDir] = useState(initialDirection);
6
6
  useEffect(() => {
7
7
  const threshold = thresholdPixels || 0;
@@ -7,7 +7,7 @@ const extractYoutubeVideoID = url => {
7
7
  if (match && match[7].length === 11) {
8
8
  return match[7];
9
9
  } else {
10
- alert("Could not extract video ID.");
10
+ window.alert("Could not extract video ID.");
11
11
  }
12
12
  };
13
13
  const useYoutubePopup = (selector, setPopupContent) => {
@@ -16,7 +16,7 @@ const useZoneSync = (zoneRef, twinZoneParentSelector) => {
16
16
  if (!zone) return;
17
17
  const twinZone = document.querySelector(`${twinZoneParentSelector} [data-cms-key=${zone.dataset.cmsKey}]`);
18
18
  const section = e?.detail?.section || zone.querySelector("section");
19
- const observer = new MutationObserver(mutations => {
19
+ const observer = new window.MutationObserver(mutations => {
20
20
  mutations.forEach(mutation => {
21
21
  if (mutation.type === "attributes") {
22
22
  updateTwinZoneContent(twinZone, section.outerHTML);
@@ -12,6 +12,7 @@ export const fetcher = method => async (_url, body, params = {}, _headers = {})
12
12
  ...defaultContentType,
13
13
  ..._headers
14
14
  };
15
+
15
16
  try {
16
17
  const qs = buildQueryString(params);
17
18
  const url = qs.length === 0 ? _url : `${_url}?${qs}`;
@@ -1,28 +1,10 @@
1
- import * as React from "react";
2
- import * as ReactDOM from "react-dom";
3
- import Popup from "../../../common/components/popup";
4
- import VaxPassIcon from "./vax-pass-icon";
5
- import MaskIcon from "./mask-icon";
6
- import css from "./index.module.css";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
- import { Fragment as _Fragment } from "react/jsx-runtime";
1
+
2
+
10
3
  const DEFAULT_TOOLTIP = {
11
4
  fr: "Informations Covid-19",
12
5
  en: "Covid-19 Information"
13
6
  };
14
- const DEFAULT_STYLES = {
15
- "--background-color": "#cc0900",
16
- "--color": "#fff",
17
- "--z-index": 5
18
- };
19
- const TAG_TRIGGER = "covid-link";
20
- const COVID_PAGE = {
21
- fr: "https://www.esf.net/informations-coronavirus/",
22
- en: "https://www.esf-en.net/informations-coronavirus/"
23
- };
24
7
 
25
- const cartWords = ["/cart", "/panier", "/carrello", "/cesta", "/cistella", "/mandje", "/korzina"];
26
8
  const CovidLink = ({
27
9
  lang,
28
10
  site,
@@ -35,82 +17,9 @@ const CovidLink = ({
35
17
  openInPopup,
36
18
  hideFixedButton
37
19
  }) => {
38
- const [loaded, setLoaded] = React.useState(false);
39
- const [open, setOpen] = React.useState(false);
40
- const [content, setContent] = React.useState(null);
41
- const Tag = hrefs && !openInPopup ? "a" : "button";
42
- const href = hrefs?.[lang];
43
- const hrefAttribute = !openInPopup ? href : undefined;
44
- const tooltip = tooltips[lang] || tooltips.en;
45
- const iframeSrc = COVID_PAGE[lang] || COVID_PAGE.en;
46
- const styles = {
47
- ...DEFAULT_STYLES,
48
- ...customStyles
49
- };
50
- const fetchContent = React.useCallback(async () => {
51
- const response = await fetch(`https://ublo.valraiso.net/api/zone?site=${site}&lang=${lang}&path=${href}&id=${zoneId}`);
52
- const html = await response.text();
53
- return html;
54
- }, [href, lang, site, zoneId]);
55
- const togglePopup = React.useCallback(async () => {
56
- if (open) {
57
- setOpen(false);
58
- setContent(null);
59
- return;
60
- }
61
- if (href && openInPopup) {
62
- const html = await fetchContent();
63
- setContent(html);
64
- }
65
- setOpen(true);
66
- }, [fetchContent, href, open, openInPopup]);
67
- const onClick = !hrefs || openInPopup ? togglePopup : undefined;
68
- const onSectionClick = React.useCallback(e => {
69
- if (!document.body.classList.contains("cms--editing")) {
70
- e.preventDefault();
71
- togglePopup();
72
- }
73
- }, [togglePopup]);
74
- const init = React.useCallback(sections => {
75
- sections.forEach(section => section.addEventListener("click", onSectionClick));
76
- }, [onSectionClick]);
77
- const cleanup = React.useCallback(sections => {
78
- sections.forEach(section => section.removeEventListener("click", onSectionClick));
79
- }, [onSectionClick]);
80
- React.useEffect(() => {
81
- }, [init, cleanup, loaded]);
82
- if (!loaded) return null;
83
- const covidLink = _jsxs(_Fragment, {
84
- children: [!hideFixedButton && _jsxs(Tag, {
85
- id: id,
86
- className: css.index,
87
- style: styles,
88
- "data-tooltip": tooltip,
89
- href: hrefAttribute,
90
- onClick: onClick,
91
- children: [_jsx(MaskIcon, {
92
- className: css.icon
93
- }), _jsx(VaxPassIcon, {
94
- className: css.icon
95
- })]
96
- }), open && _jsx(Popup, {
97
- close: togglePopup,
98
- html: content,
99
- className: css.popup,
100
- backdrop: true,
101
- children: !content ? _jsx("div", {
102
- className: css.loader,
103
- style: {
104
- "--background-color": styles["--background-color"]
105
- },
106
- children: _jsx("iframe", {
107
- title: "Covid-19",
108
- className: css.iframe,
109
- src: iframeSrc
110
- })
111
- }) : undefined
112
- })]
113
- });
114
- return ReactDOM.createPortal(covidLink, document.body);
20
+
21
+ return null;
22
+
115
23
  };
24
+
116
25
  export default CovidLink;
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { jsxs as _jsxs } from "react/jsx-runtime";
3
4
  const VaxPassIcon = props => _jsxs("svg", {
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { jsxs as _jsxs } from "react/jsx-runtime";
3
4
  const VaxPassIcon = props => _jsxs("svg", {
@@ -48,30 +48,30 @@ const InstructorsBook = ({
48
48
  const [instructorsCtx, setInstructorsCtx] = useState(instructorsContext);
49
49
  const [activity, setActivity] = useState();
50
50
  const [language, setLanguage] = useState();
51
+ const fetchNewContext = React.useCallback(async (activity, language) => {
52
+ const newContext = await fetchInstructorsContext(resort, lang, {
53
+ activity,
54
+ language
55
+ });
56
+ setInstructorsCtx(newContext);
57
+ }, [lang, resort]);
51
58
  useEffect(() => {
52
59
  const {
53
60
  activity,
54
61
  language
55
62
  } = propsFromQueryString();
56
63
  if (activity) {
57
- sessionStorage.activity = activity;
64
+ window.sessionStorage.activity = activity;
58
65
  }
59
66
  if (language) {
60
- sessionStorage.language = language;
67
+ window.sessionStorage.language = language;
61
68
  }
62
- setActivity(sessionStorage.activity);
63
- setLanguage(sessionStorage.language);
64
- if ((sessionStorage.activity || sessionStorage.language) && !instructor) {
65
- fetchNewContext(sessionStorage.activity, sessionStorage.language);
69
+ setActivity(window.sessionStorage.activity);
70
+ setLanguage(window.sessionStorage.language);
71
+ if ((window.sessionStorage.activity || window.sessionStorage.language) && !instructor) {
72
+ fetchNewContext(window.sessionStorage.activity, window.sessionStorage.language);
66
73
  }
67
- }, []);
68
- const fetchNewContext = async (activity, language) => {
69
- const newContext = await fetchInstructorsContext(resort, lang, {
70
- activity,
71
- language
72
- });
73
- setInstructorsCtx(newContext);
74
- };
74
+ }, [fetchNewContext, instructor]);
75
75
  const selectInstructor = uri => {
76
76
  return {
77
77
  href: path.concat(hasTrailingSlash(path) ? "" : "/").concat(uri)
@@ -83,7 +83,7 @@ const InstructorsBook = ({
83
83
  };
84
84
  };
85
85
  const selectFilter = async (filter, value) => {
86
- sessionStorage[filter] = value;
86
+ window.sessionStorage[filter] = value;
87
87
  if (filter === "activity") {
88
88
  setActivity(value);
89
89
  await fetchNewContext(value, language);
@@ -165,7 +165,7 @@ const List = ({
165
165
  })
166
166
  })]
167
167
  })]
168
- }, uri ? uri : `instructor-${index}`);
168
+ }, uri || `instructor-${index}`);
169
169
  };
170
170
  return _jsxs("div", {
171
171
  className: "instructors-book-list",
@@ -36,7 +36,7 @@ const getMessage = lang => {
36
36
  if (messages[lang] !== undefined) {
37
37
  return messages[lang];
38
38
  } else {
39
- return messages["en"];
39
+ return messages.en;
40
40
  }
41
41
  };
42
42
  export default getMessage;
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ declare type Stay = {
3
+ from: string;
4
+ to: string;
5
+ };
6
+ declare type Props = {
7
+ stay?: Stay;
8
+ cartUrl: string;
9
+ channel: "ESF" | "MSEM";
10
+ className?: string;
11
+ alignContent?: "left" | "center" | "right";
12
+ maxCPDuration?: number;
13
+ minDays?: number;
14
+ maxDays?: number;
15
+ children?: React.ReactNode;
16
+ };
17
+ declare const _default: React.MemoExoticComponent<({ stay, cartUrl, channel, className, alignContent, maxCPDuration, minDays, maxDays, children, }: Props) => JSX.Element>;
18
+ export default _default;
19
+ //# sourceMappingURL=magic-box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magic-box.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/magic-box/magic-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,aAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;;AA6HF,wBAAoC"}
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
2
  import * as React from "react";
2
3
  import classnames from "classnames";
3
4
  import { useUbloContext } from "ublo/with-ublo";
@@ -6,119 +7,66 @@ import * as Icons from "dt-design-system/es/icons";
6
7
  import Filters from "./filters";
7
8
  import Booking from "./booking";
8
9
  import { message } from "./messages";
9
- import { fetchFilters, fetchWelcome } from "./services/api";
10
+ import * as API from "./services/api";
10
11
  import css from "./magic-box.module.css";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Fragment as _Fragment } from "react/jsx-runtime";
14
- const MagicBox = ({
15
- stay,
16
- cartUrl,
17
- channel = "ESF",
18
- className,
19
- alignContent,
20
- maxCPDuration,
21
- minDays = 0,
22
- children
23
- }) => {
24
- const [filters, setFilters] = React.useState();
25
- const [values, setValues] = React.useState();
26
- const [currentStep, setCurrentStep] = React.useState(0);
27
- const {
28
- lang,
29
- config
30
- } = useUbloContext();
31
- const {
32
- resort
33
- } = config;
34
- const validate = React.useCallback(() => {
35
- let valid = true;
36
- if (stay && filters && values) {
37
- Object.keys(values).forEach(key => {
38
- if (values[key] === "") valid = false;
39
- });
40
- } else {
41
- valid = false;
42
- }
43
- return valid;
44
- }, [filters, stay, values]);
45
- const isValid = validate();
46
- const refreshFilters = React.useCallback(async (filters, activities) => {
47
- const {
48
- from: stayFrom,
49
- to: stayTo
50
- } = stay;
51
- const welcomeResult = await fetchWelcome({
52
- lang,
53
- resort,
54
- stayFrom,
55
- stayTo,
56
- preview: true
57
- });
58
- const {
59
- season: currentSeason,
60
- availableSeasons
61
- } = welcomeResult;
62
- const season = currentSeason || availableSeasons[0] || "2022";
63
- const filtersResult = await fetchFilters({
64
- lang,
65
- resort,
66
- season,
67
- stayFrom,
68
- stayTo,
69
- filters,
70
- activities
71
- });
72
- const newFilters = Object.keys(filtersResult.filters).reduce((acc, key) => {
73
- const filter = filtersResult.filters[key];
74
- const values = key !== "days" ? filter : filter.filter(item => item.value >= minDays);
75
- return {
76
- ...acc,
77
- [key]: values
78
- };
79
- }, {});
80
- setFilters(newFilters);
81
- const defaultValues = Object.keys(newFilters).reduce((acc, key) => ({
82
- ...acc,
83
- [key]: ""
84
- }), {});
85
- setValues(defaultValues);
86
- }, [lang, minDays, resort, stay]);
87
- React.useEffect(() => {
88
- if (stay?.from && stay.to) {
89
- refreshFilters();
90
- setCurrentStep(0);
91
- }
92
- }, [refreshFilters, stay?.from, stay?.to]);
93
- const showFilter = stay && filters && values;
94
- const classes = classnames(css.root, className);
95
- return _jsx("div", {
96
- className: classes,
97
- "data-align": alignContent,
98
- children: _jsxs("div", {
99
- className: css.top,
100
- children: [children, currentStep === 0 && _jsxs(_Fragment, {
101
- children: [!filters && _jsx("div", {
102
- className: css.loader
103
- }), showFilter && _jsx(Filters, {
104
- filters: filters,
105
- values: values,
106
- setValues: setValues
107
- }), _jsxs(Button, {
108
- className: css.confirm,
109
- onClick: () => setCurrentStep(1),
110
- disabled: !isValid,
111
- children: [message(lang, "confirm"), _jsx(Icons.Search, {})]
112
- })]
113
- }), currentStep === 1 && _jsx(Booking, {
114
- stay: stay,
115
- cartUrl: cartUrl,
116
- channel: channel,
117
- values: values,
118
- maxCPDuration: maxCPDuration,
119
- setCurrentStep: setCurrentStep
120
- })]
121
- })
122
- });
12
+ const MagicBox = ({ stay, cartUrl, channel = "ESF", className, alignContent, maxCPDuration, minDays = 0, maxDays = Infinity, children, }) => {
13
+ const [filters, setFilters] = React.useState();
14
+ const [values, setValues] = React.useState();
15
+ const [currentStep, setCurrentStep] = React.useState(0);
16
+ const { lang, config } = useUbloContext();
17
+ const { resort } = config;
18
+ const validate = React.useCallback(() => {
19
+ let valid = true;
20
+ if (stay && filters && values) {
21
+ Object.keys(values).forEach((key) => {
22
+ if (values[key] === "")
23
+ valid = false;
24
+ });
25
+ }
26
+ else {
27
+ valid = false;
28
+ }
29
+ return valid;
30
+ }, [filters, stay, values]);
31
+ const isValid = validate();
32
+ const refreshFilters = React.useCallback(async () => {
33
+ if (stay) {
34
+ const { from: stayFrom, to: stayTo } = stay;
35
+ const welcomeResult = await API.fetchWelcome({
36
+ lang,
37
+ resort,
38
+ stayFrom,
39
+ stayTo,
40
+ });
41
+ const { season: currentSeason, availableSeasons } = welcomeResult;
42
+ const season = currentSeason || availableSeasons[0] || "2022";
43
+ const filtersResult = await API.fetchFilters({
44
+ lang,
45
+ resort,
46
+ season,
47
+ stayFrom,
48
+ stayTo,
49
+ });
50
+ const newFilters = Object.keys(filtersResult.filters).reduce((acc, key) => {
51
+ const filter = filtersResult.filters[key];
52
+ const values = key !== "days"
53
+ ? filter
54
+ : filter.filter((item) => {
55
+ return item.value >= minDays && item.value <= maxDays;
56
+ });
57
+ return { ...acc, [key]: values };
58
+ }, {});
59
+ setFilters(newFilters);
60
+ const defaultValues = Object.keys(newFilters).reduce((acc, key) => ({ ...acc, [key]: "" }), {});
61
+ setValues(defaultValues);
62
+ }
63
+ }, [lang, maxDays, minDays, resort, stay]);
64
+ React.useEffect(() => {
65
+ refreshFilters();
66
+ setCurrentStep(0);
67
+ }, [refreshFilters, stay]);
68
+ const showFilter = stay && filters && values;
69
+ const classes = classnames(css.root, className);
70
+ return (_jsx("div", { className: classes, "data-align": alignContent, children: _jsxs("div", { className: css.top, children: [children, currentStep === 0 && (_jsxs(_Fragment, { children: [!filters && _jsx("div", { className: css.loader }), showFilter && (_jsx(Filters, { filters: filters, values: values, setValues: setValues })), _jsxs(Button, { className: css.confirm, onClick: () => setCurrentStep(1), disabled: !isValid, children: [message(lang, "confirm"), _jsx(Icons.Search, {})] })] })), currentStep === 1 && (_jsx(Booking, { stay: stay, cartUrl: cartUrl, channel: channel, values: values, maxCPDuration: maxCPDuration, setCurrentStep: setCurrentStep }))] }) }));
123
71
  };
124
- export default React.memo(MagicBox);
72
+ export default React.memo(MagicBox);
@@ -18,11 +18,8 @@ export const fetchFilters = async ({
18
18
  stayFrom,
19
19
  stayTo,
20
20
  kinds = ["CP"],
21
- engagement = true,
22
- filters,
23
- activities
21
+ engagement = true
24
22
  }) => {
25
- const selectedActivities = activities ? new Array(activities) : undefined;
26
23
  return Fetcher.post(`${velApi}/filters`, {
27
24
  lang,
28
25
  resort,
@@ -30,8 +27,6 @@ export const fetchFilters = async ({
30
27
  stayFrom,
31
28
  stayTo,
32
29
  kinds,
33
- engagement,
34
- filters,
35
- activities: selectedActivities
30
+ engagement
36
31
  });
37
32
  };
@@ -1,5 +1,5 @@
1
1
  export const fire = (domain, name, detail = {}) => {
2
- const event = new CustomEvent(name, {
2
+ const event = new window.CustomEvent(name, {
3
3
  detail,
4
4
  bubbles: true
5
5
  });
@@ -19,7 +19,7 @@ const Reviews = ({
19
19
  });
20
20
  };
21
21
  resort && setTimeout(run, 3000);
22
- }, [resort, reviewsLang]);
22
+ }, [resort, reviewsLang, selector]);
23
23
  return _jsx("div", {
24
24
  id: selector
25
25
  });
@@ -23,9 +23,9 @@ const BottomDropdown = ({
23
23
  } = village;
24
24
  return _jsxs("a", {
25
25
  href: link,
26
- className: "villages-map__bottom-dropdown-village"
27
- ,
26
+ className: "villages-map__bottom-dropdown-village",
28
27
  target: "_blank",
28
+ rel: "noreferrer",
29
29
  children: [_jsx(ExternalLinkIcon, {
30
30
  className: "villages-map__bottom-dropdown-icon"
31
31
  }), name]
@@ -74,10 +74,10 @@ const WeekPicker = ({
74
74
  "week-picker--editing": !mustFilterSections
75
75
  });
76
76
  const selectWeek = useCallback((week, force = false) => {
77
- const hasCart = sessionStorage.cartId !== undefined;
77
+ const hasCart = window.sessionStorage.cartId !== undefined;
78
78
  if (force || !hasCart) {
79
79
  if (previous.current !== undefined && previous.current !== null && previous.current !== week) {
80
- sessionStorage.removeItem("cartId");
80
+ window.sessionStorage.removeItem("cartId");
81
81
  }
82
82
  setWarn(-1);
83
83
  setSelected(week);
@@ -90,36 +90,37 @@ const WeekPicker = ({
90
90
  } else {
91
91
  setWarn(week);
92
92
  }
93
- }, [mustFilterSections]);
93
+ },
94
+ [mustFilterSections]);
94
95
  useEffect(() => {
95
96
  if (!mustFilterSections) {
96
97
  removeSectionFilters();
97
98
  }
98
99
  }, [mustFilterSections]);
99
100
  useEffect(() => {
100
- const stored = sessionStorage.getItem(WEEK_STORAGE);
101
+ const stored = window.sessionStorage.getItem(WEEK_STORAGE);
101
102
  selectWeek(stored !== null ? Number(stored) : null, true);
102
103
  setBrowser(true);
103
104
  }, [selectWeek]);
104
105
  useEffect(() => {
105
106
  if (selected !== null && selected !== undefined) {
106
- const stored = sessionStorage.getItem(WEEK_STORAGE);
107
+ const stored = window.sessionStorage.getItem(WEEK_STORAGE);
107
108
  const storedSelected = stored !== null ? Number(stored) : null;
108
109
  if (storedSelected !== selected) {
109
- sessionStorage.setItem(WEEK_STORAGE, selected);
110
+ window.sessionStorage.setItem(WEEK_STORAGE, selected);
110
111
  const startDate = weekToDate(selected, endWeek, forceSeasonSwitch);
111
112
  const endDate = weekToDate(selected + 1, endWeek, forceSeasonSwitch);
112
113
  const range = {
113
114
  from: formatDate(startDate),
114
115
  to: formatDate(endDate)
115
116
  };
116
- sessionStorage.stay = JSON.stringify(range);
117
- sessionStorage.Stay = JSON.stringify(range);
117
+ window.sessionStorage.stay = JSON.stringify(range);
118
+ window.sessionStorage.Stay = JSON.stringify(range);
118
119
  if (typeof onChange === "function") {
119
120
  onChange(range);
120
121
  }
121
122
  if (!noRoughValidation) {
122
- sessionStorage.roughStay = true;
123
+ window.sessionStorage.roughStay = true;
123
124
  }
124
125
  }
125
126
  }
@@ -28,7 +28,7 @@ const getMessage = (lang, messages = locales) => {
28
28
  if (messages[lang] !== undefined) {
29
29
  return messages[lang];
30
30
  } else {
31
- return messages["en"];
31
+ return messages.en;
32
32
  }
33
33
  };
34
34
  export default getMessage;
@@ -74,10 +74,10 @@ const WeekPicker = ({
74
74
  "week-picker--editing": !mustFilterSections
75
75
  });
76
76
  const selectWeek = useCallback((week, force = false) => {
77
- const hasCart = sessionStorage.cartId !== undefined;
77
+ const hasCart = window.sessionStorage.cartId !== undefined;
78
78
  if (force || !hasCart) {
79
79
  if (previous.current !== undefined && previous.current !== null && previous.current !== week) {
80
- sessionStorage.removeItem("cartId");
80
+ window.sessionStorage.removeItem("cartId");
81
81
  }
82
82
  setWarn(-1);
83
83
  setSelected(week);
@@ -90,36 +90,37 @@ const WeekPicker = ({
90
90
  } else {
91
91
  setWarn(week);
92
92
  }
93
- }, [mustFilterSections]);
93
+ },
94
+ [mustFilterSections]);
94
95
  useEffect(() => {
95
96
  if (!mustFilterSections) {
96
97
  removeSectionFilters();
97
98
  }
98
99
  }, [mustFilterSections]);
99
100
  useEffect(() => {
100
- const stored = sessionStorage.getItem(WEEK_STORAGE);
101
+ const stored = window.sessionStorage.getItem(WEEK_STORAGE);
101
102
  selectWeek(stored !== null ? Number(stored) : null, true);
102
103
  setBrowser(true);
103
104
  }, [selectWeek]);
104
105
  useEffect(() => {
105
106
  if (selected !== null && selected !== undefined) {
106
- const stored = sessionStorage.getItem(WEEK_STORAGE);
107
+ const stored = window.sessionStorage.getItem(WEEK_STORAGE);
107
108
  const storedSelected = stored !== null ? Number(stored) : null;
108
109
  if (storedSelected !== selected) {
109
- sessionStorage.setItem(WEEK_STORAGE, selected);
110
+ window.sessionStorage.setItem(WEEK_STORAGE, selected);
110
111
  const startDate = weekToDate(selected, endWeek, forceSeasonSwitch);
111
112
  const endDate = weekToDate(selected + 1, endWeek, forceSeasonSwitch);
112
113
  const range = {
113
114
  from: formatDate(startDate),
114
115
  to: formatDate(endDate)
115
116
  };
116
- sessionStorage.stay = JSON.stringify(range);
117
- sessionStorage.Stay = JSON.stringify(range);
117
+ window.sessionStorage.stay = JSON.stringify(range);
118
+ window.sessionStorage.Stay = JSON.stringify(range);
118
119
  if (typeof onChange === "function") {
119
120
  onChange(range);
120
121
  }
121
122
  if (!noRoughValidation) {
122
- sessionStorage.roughStay = true;
123
+ window.sessionStorage.roughStay = true;
123
124
  }
124
125
  }
125
126
  }
@@ -21,5 +21,5 @@ const locales = {
21
21
  "week-picker-cancel": "Annuleren"
22
22
  }
23
23
  };
24
- const getMessage = (lang, messages = locales) => messages[lang] || messages["en"];
24
+ const getMessage = (lang, messages = locales) => messages[lang] || messages.en;
25
25
  export default getMessage;
@@ -40,6 +40,6 @@ const useBookingLinks = (cart, multipleVillages, setupCallback, channel) => {
40
40
  setupCallback?.();
41
41
  };
42
42
  run();
43
- }, [bookingLang, breadcrumb, cart, hasLangPrefix, multipleVillages, setupCallback]);
43
+ }, [bookingLang, breadcrumb, cart, channel, hasLangPrefix, multipleVillages, setupCallback]);
44
44
  };
45
45
  export default useBookingLinks;
@@ -20,6 +20,6 @@ const useReviews = (lang, resort, containerId = "msem-reviews", preventInit) =>
20
20
  });
21
21
  };
22
22
  !preventInit && reviews && setTimeout(run, 3000);
23
- }, [containerId, language, resort, reviews]);
23
+ }, [containerId, language, preventInit, resort, reviews]);
24
24
  };
25
25
  export default useReviews;
@@ -83,6 +83,6 @@ const useSeasonProducts = menuPath => {
83
83
  }
84
84
  }
85
85
  }
86
- }, [seasonProductsPage, updateStay]);
86
+ }, [isEnabled, seasonProductsPage, updateStay]);
87
87
  };
88
88
  export default useSeasonProducts;
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import * as Icons from "dt-design-system/es/icons";
3
3
  import MseMLogo from "./msem-logo";
4
4
  import { CONNECTED, EDITING } from "./index";
5
- import * as UI from "./services/ui";
6
5
  import styles from "./actions.module.css";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -75,7 +75,6 @@ const SkiPass = ({
75
75
  const [filters, setFilters] = React.useState();
76
76
  const [data, setData] = React.useState(getDefaultData(config));
77
77
  const [presetUrl, setPresetUrl] = React.useState("");
78
- console.log(config);
79
78
  const resortData = resorts?.find(r => {
80
79
  return r.resort === parseInt(selectedResort);
81
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "next": "^12.0.0",
@@ -29,6 +29,7 @@
29
29
  "eslint-config-prettier": "^8.5.0",
30
30
  "eslint-config-standard": "^17.0.0",
31
31
  "eslint-plugin-jsx-a11y": "^6.6.1",
32
+ "eslint-plugin-n": "^15.5.1",
32
33
  "eslint-plugin-node": "^11.1.0",
33
34
  "eslint-plugin-promise": "^6.0.1",
34
35
  "eslint-plugin-react": "^7.31.7",
@@ -46,7 +47,8 @@
46
47
  "build": "babel src -x '.js,.ts,.tsx' -d es && tsc",
47
48
  "postbuild": "cpx 'src/**/*.{json,css}' es",
48
49
  "prepublishOnly": "yarn clean && yarn build",
49
- "watch": "yarn clean && babel ./src -x '.js,.ts,.tsx' -d ./es -w & cpx 'src/**/*.{json,css}' ./es -w"
50
+ "watch": "yarn clean && babel ./src -x '.js,.ts,.tsx' -d es -w & cpx './src/**/*.{json,css}' es -w",
51
+ "lint": "eslint 'src/**/*.{js, ts, tsx}'"
50
52
  },
51
53
  "packageManager": "yarn@1.22.18",
52
54
  "files": [
@@ -1,150 +0,0 @@
1
- import * as React from "react";
2
- import classnames from "classnames";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
- const locales = {
6
- fr: {
7
- download: "Télécharger",
8
- updateOS: "Mettre à jour le système",
9
- title: "Désolé, nous ne supportons plus ce navigateur 😔",
10
- msg1: "Vous voyez ce message parce que nous avons détecté que votre navigateur n'est plus pris en charge.",
11
- msg2: "Nous vous recommandons vivement de le mettre à jour car il pose des problèmes de sécurité.",
12
- reco: "Voici les possibilités que nous vous recommandons :"
13
- },
14
- en: {
15
- download: "Download",
16
- updateOS: "Update the system",
17
- title: "Sorry, we don't support this browser anymore 😔",
18
- msg1: "You are seeing this message because we have detected that your browser is no longer supported",
19
- msg2: "We strongly recommend that you update your browser because it has security issues.",
20
- reco: "Here are the features we recommend:"
21
- }
22
- };
23
- const browsers = {
24
- chrome: {
25
- icon: "chrome",
26
- message: "download",
27
- link: "https://www.google.com/chrome/"
28
- },
29
- firefox: {
30
- icon: "firefox",
31
- message: "download",
32
- link: "https://www.mozilla.org/fr/firefox/all/"
33
- },
34
- edge: {
35
- icon: "edge",
36
- message: "download",
37
- link: "https://www.microsoft.com/edge"
38
- },
39
- safari: {
40
- icon: "safari",
41
- message: "updateOS",
42
- link: "https://support.apple.com/HT201475"
43
- },
44
- safariMobile: {
45
- icon: "safari",
46
- message: "updateOS",
47
- link: "https://support.apple.com/HT204204"
48
- },
49
- chromeMobile: {
50
- icon: "chrome",
51
- message: "download",
52
- link: "https://play.google.com/store/apps/details?id=com.android.chrome"
53
- }
54
- };
55
- const platforms = {
56
- windows: [browsers.chrome, browsers.firefox, browsers.edge],
57
- mac: [browsers.chrome, browsers.firefox, browsers.safari],
58
- iOS: [browsers.safariMobile],
59
- android: [browsers.chromeMobile],
60
- other: [browsers.chrome, browsers.firefox]
61
- };
62
- const isIOS = () => {
63
- const iOSDevices = ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"];
64
- return iOSDevices.indexOf(navigator.platform) !== -1 || navigator.userAgent.indexOf("Mac") !== -1 && "ontouchend" in document;
65
- };
66
- const isAndroid = () => {
67
- const ua = navigator.userAgent.toLowerCase();
68
- return ua.indexOf("android") > -1;
69
- };
70
- const isWindows = () => {
71
- return navigator.platform.toUpperCase().indexOf("WIN") !== -1;
72
- };
73
- const isMac = () => {
74
- return navigator.platform.toUpperCase().indexOf("MAC") !== -1;
75
- };
76
- const Browser = ({
77
- icon,
78
- message,
79
- link,
80
- messages
81
- }) => _jsxs("a", {
82
- className: "unsupported-browser__browser",
83
- href: link,
84
- target: "_blank",
85
- rel: "noopener noreferrer",
86
- children: [_jsx("img", {
87
- className: "unsupported-browser__browser-icon",
88
- src: `/static/images/browsers/${icon}.svg`,
89
- width: "64",
90
- height: "64",
91
- alt: ""
92
- }), _jsx("span", {
93
- className: "unsupported-browser__browser-name",
94
- children: icon
95
- }), _jsx("span", {
96
- className: "unsupported-browser__browser-action",
97
- children: messages[message]
98
- })]
99
- });
100
- const UnsupportedBrowser = ({
101
- options
102
- }) => {
103
- const platform = isIOS() ? "iOS" : isAndroid() ? "android" : isWindows() ? "windows" : isMac() ? "mac" : "other";
104
- const lang = options.lang === "en" ? "en" : "fr";
105
- const messages = locales[lang];
106
- const backdropClasses = classnames("unsupported-browser", {
107
- "unsupported-browser--grounded": options.groundedTo !== undefined
108
- });
109
- return _jsx("div", {
110
- className: backdropClasses,
111
- children: _jsxs("div", {
112
- className: "unsupported-browser__unsupported",
113
- children: [_jsx("div", {
114
- className: "unsupported-browser__title",
115
- children: messages.title
116
- }), _jsxs("div", {
117
- className: "unsupported-browser__messages",
118
- children: [_jsx("p", {
119
- className: "unsupported-browser__message",
120
- children: messages.msg1
121
- }), _jsx("p", {
122
- className: "unsupported-browser__message",
123
- children: messages.msg2
124
- })]
125
- }), _jsx("div", {
126
- className: "unsupported-browser__reco",
127
- children: messages.reco
128
- }), _jsx("div", {
129
- className: "unsupported-browser__browsers",
130
- children: platforms[platform].map(browser => _jsx(Browser, {
131
- messages: messages,
132
- ...browser
133
- }, browser.icon))
134
- })]
135
- })
136
- });
137
- };
138
- export const isBrowserSupported = () => {
139
- const supportCssCustomProps = window.CSS && CSS.supports("color", "var(--primary)");
140
- if (!supportCssCustomProps) return false;
141
- const apple = navigator.vendor.toLocaleLowerCase().indexOf("apple") !== -1;
142
- if (!apple) return true;
143
- try {
144
- new Function('import("")');
145
- return true;
146
- } catch (err) {
147
- return false;
148
- }
149
- };
150
- export default UnsupportedBrowser;