ublo-lib 1.0.17 → 1.0.21
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/breadcrumb.d.ts +16 -0
- package/es/common/components/breadcrumb.d.ts.map +1 -0
- package/es/common/components/breadcrumb.js +20 -66
- package/es/common/components/custom-contact-form/utils.js +10 -6
- package/es/common/components/faq.js +5 -0
- package/es/common/components/info-buttons.js +5 -0
- package/es/lbm/components/msem-linker/editor/editor.js +7 -1
- package/es/lbm/components/msem-linker/editor/lodging.js +4 -3
- package/es/lbm/components/msem-linker/editor/ski-pass.js +6 -4
- package/es/lbm/components/msem-linker/hooks/use-widgets.js +2 -2
- package/package.json +11 -8
- package/es/empty.d.ts +0 -4
- package/es/empty.d.ts.map +0 -1
- package/es/empty.js +0 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type ItemProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
shortTitle?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
page: string;
|
|
8
|
+
subs?: ItemProps[];
|
|
9
|
+
};
|
|
10
|
+
declare type BreadcrumbProps = {
|
|
11
|
+
breadcrumb: ItemProps;
|
|
12
|
+
exclusions: string[];
|
|
13
|
+
};
|
|
14
|
+
declare const Breadcrumb: ({ breadcrumb, exclusions }: BreadcrumbProps) => JSX.Element;
|
|
15
|
+
export default Breadcrumb;
|
|
16
|
+
//# sourceMappingURL=breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/common/components/breadcrumb.tsx"],"names":[],"mappings":";AAGA,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0CF,QAAA,MAAM,UAAU,+BAAqC,eAAe,gBAInE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,69 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "ublo/link";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
});
|
|
3
|
+
const Item = ({ page, path, itemTitle, nextItem, isCurrent }) => {
|
|
4
|
+
const hasTemplate = page !== undefined;
|
|
5
|
+
const isExternalUrl = /^((http|https):\/\/)/.test(path);
|
|
6
|
+
const noHref = isCurrent || !hasTemplate;
|
|
7
|
+
const Tag = isExternalUrl ? "a" : noHref ? "span" : Link;
|
|
8
|
+
const linkProps = { title: itemTitle, page, as: path };
|
|
9
|
+
const spanProps = { dangerouslySetInnerHTML: { __html: itemTitle } };
|
|
10
|
+
const anchorProps = { ...spanProps, href: path };
|
|
11
|
+
const props = isExternalUrl ? anchorProps : noHref ? spanProps : linkProps;
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tag, { className: "breadcrumb__item", ...props }), nextItem] }));
|
|
38
13
|
};
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
next
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
});
|
|
14
|
+
const Items = ({ rawItem, exclusions }) => {
|
|
15
|
+
const { next, title, path, page, shortTitle } = rawItem;
|
|
16
|
+
const isCurrent = next === undefined;
|
|
17
|
+
const isNextExcluded = !isCurrent && exclusions.includes(next.name);
|
|
18
|
+
const itemToRender = isNextExcluded ? next.next : next;
|
|
19
|
+
const nextItem = !isCurrent ? (_jsx(Items, { rawItem: itemToRender, exclusions: exclusions })) : null;
|
|
20
|
+
return (_jsx(Item, { page: page, path: path, itemTitle: shortTitle || title, nextItem: nextItem, isCurrent: isCurrent }));
|
|
59
21
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
breadcrumb,
|
|
63
|
-
exclusions = []
|
|
64
|
-
}) => _jsx("div", {
|
|
65
|
-
className: "breadcrumb",
|
|
66
|
-
children: renderBreadcrumbItems(breadcrumb, exclusions)
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export default Breadcrumb;
|
|
22
|
+
const Breadcrumb = ({ breadcrumb, exclusions = [] }) => (_jsx("div", { className: "breadcrumb", children: _jsx(Items, { rawItem: breadcrumb, exclusions: exclusions }) }));
|
|
23
|
+
export default Breadcrumb;
|
|
@@ -23,12 +23,16 @@ export const getInitialFormState = (fields, presets) => Object.keys(fields).redu
|
|
|
23
23
|
type
|
|
24
24
|
} = field;
|
|
25
25
|
if (type === "title") return acc;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
|
|
27
|
+
if (key === "subject") {
|
|
28
|
+
const value = presets?.[key] ?? "";
|
|
29
|
+
return { ...acc,
|
|
30
|
+
[key]: {
|
|
31
|
+
value,
|
|
32
|
+
valid: true
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
if (type === "checkbox") {
|
|
34
38
|
const value = presets?.[key] ?? false;
|
|
@@ -14,6 +14,11 @@ const Faq = ({
|
|
|
14
14
|
} = useUbloContext();
|
|
15
15
|
const [count, setCount] = useState(0);
|
|
16
16
|
const [current, setCurrent] = useState();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (location.hostname === "localhost") {
|
|
19
|
+
console.warn("Faq is deprecated, prefer useFaq (ublo-lib/es/common/hooks/use-faq)");
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
17
22
|
useEffect(() => {
|
|
18
23
|
const faq = faqRef.current;
|
|
19
24
|
const sections = faq.querySelectorAll(`section[data-class="${target}"]`);
|
|
@@ -79,6 +79,11 @@ const InfoButtons = ({
|
|
|
79
79
|
setClosed(true);
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (location.hostname === "localhost") {
|
|
84
|
+
console.warn("InfoButtons is deprecated, prefer useInfoButtons");
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
82
87
|
useEffect(() => {
|
|
83
88
|
const infos = ref.current;
|
|
84
89
|
const sections = infos.querySelectorAll(`section${selector}`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
2
3
|
import Lodging from "./lodging";
|
|
3
4
|
import SkiPass from "./ski-pass";
|
|
4
5
|
import * as Icons from "dt-design-system/es/icons";
|
|
@@ -25,6 +26,9 @@ const PresetsEditor = ({
|
|
|
25
26
|
skiPassesUrl,
|
|
26
27
|
skiPassMerchant
|
|
27
28
|
}) => {
|
|
29
|
+
const {
|
|
30
|
+
lang
|
|
31
|
+
} = useUbloContext();
|
|
28
32
|
const [config, setConfig] = React.useState();
|
|
29
33
|
const [ready, setReady] = React.useState(false);
|
|
30
34
|
const Editor = editors[kind];
|
|
@@ -34,6 +38,7 @@ const PresetsEditor = ({
|
|
|
34
38
|
const {
|
|
35
39
|
widget
|
|
36
40
|
} = section.dataset;
|
|
41
|
+
const linkOverride = section.querySelector("a")?.getAttribute("href")?.replace(`/${lang}`, "");
|
|
37
42
|
|
|
38
43
|
const closeEditor = () => {
|
|
39
44
|
setPresetsEditor(undefined);
|
|
@@ -98,7 +103,8 @@ const PresetsEditor = ({
|
|
|
98
103
|
setConfig: setConfig,
|
|
99
104
|
defaultOptions: defaultOptions,
|
|
100
105
|
skiPassesUrl: skiPassesUrl,
|
|
101
|
-
skiPassMerchant: skiPassMerchant
|
|
106
|
+
skiPassMerchant: skiPassMerchant,
|
|
107
|
+
linkOverride: linkOverride
|
|
102
108
|
}), _jsxs("div", {
|
|
103
109
|
className: styles.footer,
|
|
104
110
|
children: [_jsxs(Button, {
|
|
@@ -69,7 +69,8 @@ const Lodging = ({
|
|
|
69
69
|
widgets,
|
|
70
70
|
config,
|
|
71
71
|
setConfig,
|
|
72
|
-
defaultOptions
|
|
72
|
+
defaultOptions,
|
|
73
|
+
linkOverride
|
|
73
74
|
}) => {
|
|
74
75
|
const {
|
|
75
76
|
lang
|
|
@@ -251,9 +252,9 @@ const Lodging = ({
|
|
|
251
252
|
resort: selectedResort,
|
|
252
253
|
previewDetails
|
|
253
254
|
}
|
|
254
|
-
}, openPage, lodgingPrefixUrl, noLodgingPage));
|
|
255
|
+
}, openPage, linkOverride || lodgingPrefixUrl, noLodgingPage));
|
|
255
256
|
}
|
|
256
|
-
}, [data, kind, lodgingPrefixUrl, noLodgingPage, selectedResort, setConfig]);
|
|
257
|
+
}, [data, kind, linkOverride, lodgingPrefixUrl, noLodgingPage, selectedResort, setConfig]);
|
|
257
258
|
React.useEffect(() => {
|
|
258
259
|
if (!data.lodging) {
|
|
259
260
|
setData(data => ({ ...data,
|
|
@@ -19,6 +19,7 @@ const DEFAULT_DATA = {
|
|
|
19
19
|
stayTo: "",
|
|
20
20
|
firstSkiDate: "",
|
|
21
21
|
skiers: [],
|
|
22
|
+
activities: [],
|
|
22
23
|
domains: [],
|
|
23
24
|
durations: []
|
|
24
25
|
};
|
|
@@ -52,7 +53,8 @@ const SkiPass = ({
|
|
|
52
53
|
config,
|
|
53
54
|
setConfig,
|
|
54
55
|
skiPassesUrl,
|
|
55
|
-
skiPassMerchant
|
|
56
|
+
skiPassMerchant,
|
|
57
|
+
linkOverride
|
|
56
58
|
}) => {
|
|
57
59
|
const {
|
|
58
60
|
lang
|
|
@@ -70,7 +72,7 @@ const SkiPass = ({
|
|
|
70
72
|
});
|
|
71
73
|
const merchantSlug = resortData?.merchant || skiPassMerchant;
|
|
72
74
|
const selectedResortSkiPassPrefixUrl = resortData?.skiPassesUrls?.[widgets[kind]?.widgetPrefixUrlFacet]?.[lang];
|
|
73
|
-
const widgetUrl = skiPassesUrl || selectedResortSkiPassPrefixUrl;
|
|
75
|
+
const widgetUrl = linkOverride || skiPassesUrl || selectedResortSkiPassPrefixUrl;
|
|
74
76
|
const emptyEntry = {
|
|
75
77
|
label: "",
|
|
76
78
|
value: ""
|
|
@@ -327,13 +329,13 @@ const SkiPass = ({
|
|
|
327
329
|
label: messages.domains,
|
|
328
330
|
options: filters.domains,
|
|
329
331
|
values: selectedDomains,
|
|
330
|
-
|
|
332
|
+
onChange: updateFilter("domains")
|
|
331
333
|
}), data.domains?.length > 0 && filteredDurations?.length > 1 && _jsx(MutlipleSelect, {
|
|
332
334
|
placeholder: "Selectionnez une ou plusieurs options",
|
|
333
335
|
label: messages.durations,
|
|
334
336
|
options: filteredDurations,
|
|
335
337
|
values: selectedDurations,
|
|
336
|
-
|
|
338
|
+
onChange: updateFilter("durations")
|
|
337
339
|
})]
|
|
338
340
|
}), widgetUrl && _jsxs(_Fragment, {
|
|
339
341
|
children: [_jsx("div", {
|
|
@@ -31,10 +31,10 @@ const useWidgets = (widgets, defaultOptions, mode, resorts, skiPassesUrl, setTun
|
|
|
31
31
|
return r.resort === parseInt(selectedResort);
|
|
32
32
|
});
|
|
33
33
|
const selectedResortLodgingPrefixUrl = resortData?.lodgingsUrls?.[widgets[widget]?.widgetPrefixUrlFacet]?.[lang];
|
|
34
|
-
const lodgingPrefixUrl = defaultOptions.lodgingPrefixUrl || selectedResortLodgingPrefixUrl;
|
|
34
|
+
const lodgingPrefixUrl = section.querySelector("a")?.href || defaultOptions.lodgingPrefixUrl || selectedResortLodgingPrefixUrl;
|
|
35
35
|
const noLodgingPage = !!resortData?.noLodgingPage;
|
|
36
36
|
const selectedResortSkiPassPrefixUrl = resortData?.skiPassesUrls?.[widgets[widget]?.widgetPrefixUrlFacet]?.[lang];
|
|
37
|
-
const skiPassWidgetUrl =
|
|
37
|
+
const skiPassWidgetUrl = section.querySelector("a")?.href || skiPassesUrl || selectedResortSkiPassPrefixUrl;
|
|
38
38
|
const {
|
|
39
39
|
paxPlan,
|
|
40
40
|
roomType
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ublo-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^18.2.0",
|
|
6
6
|
"react-dom": "^18.2.0",
|
|
7
|
+
"dt-design-system": "^2.0.0",
|
|
7
8
|
"ublo": "^2.0.0"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
@@ -21,18 +22,20 @@
|
|
|
21
22
|
"@types/react": "^18.0.17",
|
|
22
23
|
"@types/react-dom": "^18.0.6",
|
|
23
24
|
"classnames": "^2.3.1",
|
|
24
|
-
"
|
|
25
|
+
"dt-design-system": "^2.0.0",
|
|
26
|
+
"eslint": "^8.23.0",
|
|
25
27
|
"eslint-config-prettier": "^8.5.0",
|
|
26
|
-
"eslint-config-standard": "^
|
|
27
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
28
|
+
"eslint-config-standard": "^17.0.0",
|
|
29
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
28
30
|
"eslint-plugin-node": "^11.1.0",
|
|
29
|
-
"eslint-plugin-promise": "^6.0.
|
|
30
|
-
"eslint-plugin-react": "^7.
|
|
31
|
-
"eslint-plugin-react-hooks": "^4.
|
|
31
|
+
"eslint-plugin-promise": "^6.0.1",
|
|
32
|
+
"eslint-plugin-react": "^7.31.7",
|
|
33
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
32
34
|
"react": "^18.2.0",
|
|
33
35
|
"react-dom": "^18.2.0",
|
|
34
36
|
"react-scripts": "5.0.1",
|
|
35
|
-
"typescript": "^4.
|
|
37
|
+
"typescript": "^4.8.2",
|
|
38
|
+
"ublo": "^2.0.0"
|
|
36
39
|
},
|
|
37
40
|
"scripts": {
|
|
38
41
|
"clean": "rm -rf es",
|
package/es/empty.d.ts
DELETED
package/es/empty.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../src/empty.tsx"],"names":[],"mappings":";AAIA,QAAA,MAAM,KAAK,mBAMV,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/es/empty.js
DELETED