ublo-lib 1.42.41 → 1.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,5 @@ declare function CookieConsent({ lang, consent, updateConsent }: {
4
4
  lang: any;
5
5
  consent: any;
6
6
  updateConsent: any;
7
- }): React.ReactPortal;
8
- import * as React from "react";
7
+ }): import("react-dom/node_modules/@types/react").ReactPortal;
9
8
  //# sourceMappingURL=cookie-consent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-consent.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cookie-consent/cookie-consent.js"],"names":[],"mappings":"AAsGO,0CA6BN;;AArHD;;;;sBAsFC;uBApGsB,OAAO"}
1
+ {"version":3,"file":"cookie-consent.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cookie-consent/cookie-consent.js"],"names":[],"mappings":"AAsGO,0CA6BN;;AArHD;;;;8DAsFC"}
@@ -1,3 +1,2 @@
1
- export default function EditableCalendar(): React.ReactPortal[];
2
- import * as React from "react";
1
+ export default function EditableCalendar(): import("react-dom/node_modules/@types/react").ReactPortal[];
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/index.js"],"names":[],"mappings":"AAOA,gEAiDC;uBAxDsB,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/index.js"],"names":[],"mappings":"AAOA,wGAiDC"}
@@ -0,0 +1,38 @@
1
+ {
2
+ "fr": {
3
+ "maximize": "Agrandir le texte",
4
+ "minimize": "Réduire le texte",
5
+ "close": "Fermer",
6
+ "showInformation": "Information importante"
7
+ },
8
+ "en": {
9
+ "maximize": "Enlarge text",
10
+ "minimize": "Reduce text",
11
+ "close": "Close",
12
+ "showInformation": "Important information"
13
+ },
14
+ "es": {
15
+ "maximize": "Ampliar texto",
16
+ "minimize": "Reducir texto",
17
+ "close": "Cerrar",
18
+ "showInformation": "Información importante"
19
+ },
20
+ "ca": {
21
+ "maximize": "Ampliar text",
22
+ "minimize": "Reduir text",
23
+ "close": "Tancar",
24
+ "showInformation": "Informació important"
25
+ },
26
+ "nl": {
27
+ "maximize": "Tekst vergroten",
28
+ "minimize": "Tekst verkleinen",
29
+ "close": "Sluiten",
30
+ "showInformation": "Belangrijke informatie"
31
+ },
32
+ "it": {
33
+ "maximize": "Ingrandisci testo",
34
+ "minimize": "Riduci testo",
35
+ "close": "Chiudi",
36
+ "showInformation": "Informazioni importanti"
37
+ }
38
+ }
@@ -1,6 +1,11 @@
1
- export default function Information({ source, zone, preventOpening, }: {
1
+ type Props = {
2
2
  source?: string;
3
3
  zone?: string;
4
- preventOpening: any;
5
- }): import("react/jsx-runtime").JSX.Element;
4
+ preventOpening?: boolean;
5
+ mode?: "popup" | "popin";
6
+ className?: string;
7
+ buttonClassName?: string;
8
+ };
9
+ export default function Information({ source, zone, preventOpening, mode, className, buttonClassName, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
6
11
  //# sourceMappingURL=information.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"information.d.ts","sourceRoot":"","sources":["../../../../src/common/components/information/information.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAiB,EACjB,IAAgB,EAChB,cAAc,GACf;;;;CAAA,2CA2CA"}
1
+ {"version":3,"file":"information.d.ts","sourceRoot":"","sources":["../../../../src/common/components/information/information.tsx"],"names":[],"mappings":"AAeA,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAiB,EACjB,IAAgB,EAChB,cAAc,EACd,IAAc,EACd,SAAS,EACT,eAAe,GAChB,EAAE,KAAK,2CAmKP"}
@@ -1,18 +1,59 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
+ import classNames from "classnames";
3
4
  import Router from "next/router";
4
5
  import { useUbloContext } from "ublo/with-ublo";
5
6
  import { fetchZone, fetchMenus } from "ublo/fetcher";
7
+ import Portal from "dt-design-system/es/portal";
6
8
  import Dialog from "dt-design-system/es/dialog";
9
+ import Tooltip from "dt-design-system/es/tooltip";
10
+ import Button from "dt-design-system/es/button";
11
+ import * as Icons from "dt-design-system/es/icons";
12
+ import i18n from "./i18n.json";
7
13
  import styles from "./information.module.css";
8
14
  const STORAGE_KEY = "information_viewed";
9
- export default function Information({ source = "/popup", zone = "content", preventOpening, }) {
15
+ export default function Information({ source = "/popup", zone = "content", preventOpening, mode = "popup", className, buttonClassName, }) {
16
+ const ref = React.useRef(null);
17
+ const [enabled, setEnabled] = React.useState(false);
18
+ const [minimized, setMinimized] = React.useState(false);
19
+ const [maximized, setMaximized] = React.useState(false);
20
+ const [hasOverflow, setHasOverflow] = React.useState(false);
10
21
  const [content, setContent] = React.useState();
11
22
  const { config, lang } = useUbloContext();
12
23
  const { ubloApi, site } = config;
13
- const close = React.useCallback(() => {
24
+ const isPopin = mode === "popin";
25
+ const isOpened = isPopin ? !minimized && Boolean(content) : Boolean(content);
26
+ const maximize = () => {
27
+ sessionStorage.setItem(STORAGE_KEY, "true");
28
+ setMaximized(true);
29
+ setMinimized(false);
30
+ };
31
+ const unmaximize = () => {
32
+ setMaximized(false);
33
+ setMinimized(false);
34
+ };
35
+ const minimize = () => {
36
+ sessionStorage.setItem(STORAGE_KEY, "true");
37
+ setMinimized(true);
38
+ setMaximized(false);
39
+ };
40
+ const unminimize = async () => {
41
+ setMinimized(false);
42
+ setMaximized(false);
43
+ checkOverflow();
44
+ };
45
+ const close = () => {
14
46
  sessionStorage.setItem(STORAGE_KEY, "true");
15
47
  setContent(undefined);
48
+ };
49
+ const checkOverflow = React.useCallback(() => {
50
+ window.requestAnimationFrame(() => {
51
+ const inner = document.querySelector(`.${styles.inner}`);
52
+ if (inner) {
53
+ const hasOverflow = inner.scrollHeight > inner.clientHeight;
54
+ setHasOverflow(hasOverflow);
55
+ }
56
+ });
16
57
  }, []);
17
58
  const getContent = React.useCallback(async () => {
18
59
  const menus = await fetchMenus(ubloApi, site, lang, source, 1, true);
@@ -24,16 +65,44 @@ export default function Information({ source = "/popup", zone = "content", preve
24
65
  }
25
66
  }, [lang, site, source, ubloApi, zone]);
26
67
  React.useEffect(() => {
27
- const alreadySeen = sessionStorage.getItem(STORAGE_KEY) ||
28
- sessionStorage.getItem("cms_token");
29
- if (!preventOpening && !alreadySeen) {
68
+ const isAlreadySeen = sessionStorage.getItem(STORAGE_KEY);
69
+ const isEnabled = isPopin
70
+ ? !preventOpening && !sessionStorage.getItem("cms_token")
71
+ : !preventOpening &&
72
+ !sessionStorage.getItem("cms_token") &&
73
+ !isAlreadySeen;
74
+ setEnabled(isEnabled);
75
+ if (isAlreadySeen) {
76
+ minimize();
77
+ }
78
+ }, [isPopin, preventOpening]);
79
+ React.useEffect(() => {
80
+ if (enabled) {
30
81
  getContent();
31
82
  }
32
- }, [getContent, preventOpening]);
83
+ }, [getContent, enabled]);
84
+ React.useEffect(() => {
85
+ checkOverflow();
86
+ }, [checkOverflow, content]);
33
87
  Router.ready(() => {
34
88
  Router.events.on("routeChangeComplete", () => {
35
- close();
89
+ if (isPopin) {
90
+ minimize();
91
+ }
92
+ else {
93
+ close();
94
+ }
36
95
  });
37
96
  });
38
- return (_jsx(Dialog, { className: styles.information, close: close, isOpened: !!content, children: _jsx("div", { className: styles.inner, dangerouslySetInnerHTML: { __html: content }, "data-information-popup": "" }) }));
97
+ if (!enabled)
98
+ return null;
99
+ const classes = classNames(styles.information, className, {
100
+ [styles.popin]: isPopin,
101
+ [styles.overflow]: hasOverflow,
102
+ [styles.minimized]: minimized,
103
+ [styles.maximized]: maximized,
104
+ });
105
+ const buttonClasses = classNames(styles.informationButton, buttonClassName);
106
+ const messages = i18n[lang];
107
+ return (_jsxs(_Fragment, { children: [isPopin && minimized && (_jsx(Portal, { asChild: true, children: _jsx(Tooltip, { content: messages.showInformation, children: _jsx(Button, { className: buttonClasses, onClick: unminimize, "data-information-popup-button": "", children: _jsx(Icons.Bell, {}) }) }) })), _jsxs(Dialog, { className: classes, close: isPopin ? minimize : close, isOpened: isOpened, showAsModal: !isPopin, showCloseButton: !isPopin, disableBackdrop: isPopin, title: messages.showInformation, children: [isPopin && (_jsxs("div", { className: styles.controls, children: [maximized && (_jsx(Tooltip, { content: messages.minimize, children: _jsx(Button, { variant: "secondary", onClick: unmaximize, children: _jsx(Icons.ArrowDown, {}) }) })), !maximized && hasOverflow && (_jsx(Tooltip, { content: messages.maximize, children: _jsx(Button, { variant: "secondary", onClick: maximize, children: _jsx(Icons.ArrowUp, {}) }) })), _jsx(Tooltip, { content: messages.close, children: _jsx(Button, { onClick: minimize, children: _jsx(Icons.Cross, {}) }) })] })), _jsx("div", { ref: ref, className: styles.inner, dangerouslySetInnerHTML: { __html: content }, "data-information-popup": "" })] })] }));
39
108
  }
@@ -1,9 +1,80 @@
1
- .information {
2
- @media (min-width: 700px) {
1
+ /* stylelint-disable selector-class-pattern */
2
+ /* stylelint-disable media-feature-range-notation */
3
+ /* stylelint-disable at-rule-empty-line-before */
4
+
5
+ @media (min-width: 700px) {
6
+ .information {
3
7
  width: 700px;
4
8
  }
5
9
  }
6
10
 
11
+ .popin {
12
+ top: unset;
13
+ bottom: 0;
14
+ border-radius: var(--ds-radius-200, 8px) var(--ds-radius-200, 8px) 0 0;
15
+ overflow: hidden;
16
+ overflow: clip;
17
+ }
18
+
19
+ @media (min-width: 700px) {
20
+ .popin {
21
+ left: unset;
22
+ right: 10px;
23
+ }
24
+ }
25
+
26
+ .overflow::after {
27
+ content: "";
28
+ position: absolute;
29
+ bottom: 0;
30
+ left: 0;
31
+ right: 0;
32
+ width: 100%;
33
+ height: calc(100% - 70px);
34
+ background: linear-gradient(to top, var(--ds-grey-000, #ffffff), transparent);
35
+ pointer-events: none;
36
+ }
37
+
38
+ .maximized {
39
+ overflow: auto;
40
+ }
41
+
42
+ .maximized::after {
43
+ content: none;
44
+ }
45
+
46
+ .controls {
47
+ position: absolute;
48
+ top: 16px;
49
+ right: 16px;
50
+ display: flex;
51
+ align-items: center;
52
+ gap: 6px;
53
+ }
54
+
7
55
  .inner {
8
56
  padding: 26px;
9
57
  }
58
+
59
+ .popin .inner {
60
+ max-height: 295px;
61
+ padding: 22px 12px;
62
+ }
63
+
64
+ .maximized .inner {
65
+ max-height: none;
66
+ }
67
+
68
+ .popin .inner > *:first-child {
69
+ padding-right: 65px;
70
+ }
71
+
72
+ .informationButton {
73
+ --ds-button-radius: var(--ds-radius-200, 8px) var(--ds-radius-200, 8px) 0 0;
74
+
75
+ position: sticky;
76
+ left: calc(96% - 40px);
77
+ bottom: 0;
78
+ margin-top: 10px;
79
+ transform-origin: top center;
80
+ }
@@ -4,6 +4,5 @@ export default function Popup({ mustFilterSections, showDialog, opened, onChange
4
4
  opened: any;
5
5
  onChange: any;
6
6
  selectAndClose: any;
7
- }): React.ReactPortal;
8
- import * as React from "react";
7
+ }): import("react-dom/node_modules/@types/react").ReactPortal;
9
8
  //# sourceMappingURL=popup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/popup.js"],"names":[],"mappings":"AAKA;;;;;;sBA2BC;uBAhCsB,OAAO"}
1
+ {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/popup.js"],"names":[],"mappings":"AAKA;;;;;;8DA2BC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ski-passes.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-passes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAiFF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,eAAe,EACf,MAAM,EACN,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,KAAK,2CAgUP"}
1
+ {"version":3,"file":"ski-passes.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/msem-preset-editor/editors/ski-passes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAiFF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,eAAe,EACf,MAAM,EACN,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,KAAK,2CA4UP"}
@@ -166,7 +166,7 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
166
166
  const initFilters = async () => {
167
167
  setLoading(true);
168
168
  const filters = await API.getSkiPassesFilters(msemServicesUrl, merchant, catalog);
169
- console.log(filters);
169
+ 4;
170
170
  const filteredFilters = Object.keys(filters).reduce((acc, key) => {
171
171
  const filter = filters[key];
172
172
  return ALLOWED_FILTERS.includes(key)
@@ -190,21 +190,29 @@ export default function SkiPasses({ msemServicesUrl, preset, setPreset, stay, se
190
190
  }, [catalog, merchant, msemServicesUrl]);
191
191
  React.useEffect(() => {
192
192
  setPreset((current = {}) => {
193
- const { hide, minimalistLiftScreen, ...rest } = data;
194
- const newPreset = {
195
- ...current,
196
- options: {
197
- ...(current?.options || {}),
198
- catalog,
199
- hide,
200
- minimalistLiftScreen,
201
- },
202
- presets: {
203
- ...(current?.presets || {}),
204
- ...rest,
205
- },
206
- url: urlOverride || undefined,
193
+ const firstSkiDate = data.firstSkiDate || undefined;
194
+ const skiers = data.skiers?.length ? data.skiers : undefined;
195
+ const activities = data.activities?.length ? data.activities : undefined;
196
+ const domains = data.domains?.length ? data.domains : undefined;
197
+ const durations = data.durations?.length ? data.durations : undefined;
198
+ const hide = data.hide?.length ? data.hide : undefined;
199
+ const minimalistLiftScreen = data.minimalistLiftScreen || undefined;
200
+ const url = urlOverride || undefined;
201
+ const options = {
202
+ ...(current?.options || {}),
203
+ catalog,
204
+ hide,
205
+ minimalistLiftScreen,
207
206
  };
207
+ const presets = {
208
+ ...(current?.presets || {}),
209
+ skiers,
210
+ firstSkiDate,
211
+ activities,
212
+ domains,
213
+ durations,
214
+ };
215
+ const newPreset = { ...current, options, presets, url };
208
216
  onChange?.(newPreset);
209
217
  return newPreset;
210
218
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.42.41",
3
+ "version": "1.43.1",
4
4
  "peerDependencies": {
5
5
  "classnames": "^2.5.1",
6
- "dt-design-system": "^3.10.8",
6
+ "dt-design-system": "^3.11.8",
7
7
  "framer-motion": "^11.11.9",
8
8
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
9
9
  "react": "^18.2.0 || ^19.0.0",
@@ -28,7 +28,7 @@
28
28
  "@typescript-eslint/parser": "^7.18.0",
29
29
  "classnames": "^2.5.1",
30
30
  "cpx2": "^7.0.2",
31
- "dt-design-system": "^3.11.6",
31
+ "dt-design-system": "^3.11.8",
32
32
  "eslint": "^8.57.1",
33
33
  "eslint-plugin-react": "^7.37.2",
34
34
  "eslint-plugin-react-hooks": "^4.6.2",