ublo-lib 1.35.19 → 1.36.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.
- package/es/common/components/msem-preset-linker/hooks/use-msem-presets.d.ts.map +1 -1
- package/es/common/components/msem-preset-linker/hooks/use-msem-presets.js +3 -2
- package/es/common/components/scrolling-carousel/scrolling-carousel.module.css +4 -0
- package/es/lbm/components/instant-search/facet-switch.d.ts +8 -0
- package/es/lbm/components/instant-search/facet-switch.d.ts.map +1 -0
- package/es/lbm/components/instant-search/facet-switch.js +15 -0
- package/es/lbm/components/instant-search/facet-switch.module.css +19 -0
- package/es/lbm/components/instant-search/faqs.d.ts +12 -0
- package/es/lbm/components/instant-search/faqs.d.ts.map +1 -0
- package/es/lbm/components/instant-search/faqs.js +44 -0
- package/es/lbm/components/instant-search/faqs.module.css +102 -0
- package/es/lbm/components/instant-search/hooks/use-constant.d.ts +2 -0
- package/es/lbm/components/instant-search/hooks/use-constant.d.ts.map +1 -0
- package/es/lbm/components/instant-search/hooks/use-constant.js +8 -0
- package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts +11 -0
- package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts.map +1 -0
- package/es/lbm/components/instant-search/hooks/use-debounced-search.js +12 -0
- package/es/lbm/components/instant-search/hooks/use-search.d.ts +17 -0
- package/es/lbm/components/instant-search/hooks/use-search.d.ts.map +1 -0
- package/es/lbm/components/instant-search/hooks/use-search.js +10 -0
- package/es/lbm/components/instant-search/i18n.json +32 -0
- package/es/lbm/components/instant-search/index.d.ts +3 -0
- package/es/lbm/components/instant-search/index.d.ts.map +1 -0
- package/es/lbm/components/instant-search/index.js +2 -0
- package/es/lbm/components/instant-search/instant-search.d.ts +19 -0
- package/es/lbm/components/instant-search/instant-search.d.ts.map +1 -0
- package/es/lbm/components/instant-search/instant-search.js +64 -0
- package/es/lbm/components/instant-search/instant-search.module.css +8 -0
- package/es/lbm/components/instant-search/links.d.ts +12 -0
- package/es/lbm/components/instant-search/links.d.ts.map +1 -0
- package/es/lbm/components/instant-search/links.js +30 -0
- package/es/lbm/components/instant-search/links.module.css +96 -0
- package/es/lbm/components/instant-search/no-product.d.ts +6 -0
- package/es/lbm/components/instant-search/no-product.d.ts.map +1 -0
- package/es/lbm/components/instant-search/no-product.js +4 -0
- package/es/lbm/components/instant-search/products.d.ts +14 -0
- package/es/lbm/components/instant-search/products.d.ts.map +1 -0
- package/es/lbm/components/instant-search/products.js +47 -0
- package/es/lbm/components/instant-search/products.module.css +163 -0
- package/es/lbm/components/instant-search/results.d.ts +79 -0
- package/es/lbm/components/instant-search/results.d.ts.map +1 -0
- package/es/lbm/components/instant-search/results.js +34 -0
- package/es/lbm/components/instant-search/results.module.css +85 -0
- package/es/lbm/components/instant-search/search-input.d.ts +15 -0
- package/es/lbm/components/instant-search/search-input.d.ts.map +1 -0
- package/es/lbm/components/instant-search/search-input.js +56 -0
- package/es/lbm/components/instant-search/search-input.module.css +88 -0
- package/es/lbm/components/instant-search/services/api.d.ts +2 -0
- package/es/lbm/components/instant-search/services/api.d.ts.map +1 -0
- package/es/lbm/components/instant-search/services/api.js +22 -0
- package/es/lbm/components/instant-search/services/lumiplan-api.d.ts +9 -0
- package/es/lbm/components/instant-search/services/lumiplan-api.d.ts.map +1 -0
- package/es/lbm/components/instant-search/services/lumiplan-api.js +37 -0
- package/es/lbm/components/instant-search/services/messages.d.ts +2 -0
- package/es/lbm/components/instant-search/services/messages.d.ts.map +1 -0
- package/es/lbm/components/instant-search/services/messages.js +5 -0
- package/es/lbm/components/instant-search/services/utils.d.ts +4 -0
- package/es/lbm/components/instant-search/services/utils.d.ts.map +1 -0
- package/es/lbm/components/instant-search/services/utils.js +28 -0
- package/es/lbm/components/instant-search/widgets/access.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/access.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/access.js +29 -0
- package/es/lbm/components/instant-search/widgets/activity.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/activity.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/activity.js +74 -0
- package/es/lbm/components/instant-search/widgets/activity.module.css +6 -0
- package/es/lbm/components/instant-search/widgets/components/card.d.ts +11 -0
- package/es/lbm/components/instant-search/widgets/components/card.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/components/card.js +15 -0
- package/es/lbm/components/instant-search/widgets/components/card.module.css +60 -0
- package/es/lbm/components/instant-search/widgets/components/metric.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/components/metric.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/components/metric.js +6 -0
- package/es/lbm/components/instant-search/widgets/components/metric.module.css +12 -0
- package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts +9 -0
- package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/components/status-with-icon.js +5 -0
- package/es/lbm/components/instant-search/widgets/components/status-with-icon.module.css +12 -0
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts +9 -0
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.js +37 -0
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.module.css +33 -0
- package/es/lbm/components/instant-search/widgets/lift.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/lift.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/lift.js +52 -0
- package/es/lbm/components/instant-search/widgets/lift.module.css +6 -0
- package/es/lbm/components/instant-search/widgets/lifts.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/lifts.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/lifts.js +26 -0
- package/es/lbm/components/instant-search/widgets/msem-widget.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/msem-widget.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/msem-widget.js +31 -0
- package/es/lbm/components/instant-search/widgets/msem-widget.module.css +51 -0
- package/es/lbm/components/instant-search/widgets/openings.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/openings.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/openings.js +32 -0
- package/es/lbm/components/instant-search/widgets/slope.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/slope.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/slope.js +73 -0
- package/es/lbm/components/instant-search/widgets/slope.module.css +26 -0
- package/es/lbm/components/instant-search/widgets/slopes.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/slopes.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/slopes.js +26 -0
- package/es/lbm/components/instant-search/widgets/snow.d.ts +9 -0
- package/es/lbm/components/instant-search/widgets/snow.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/snow.js +25 -0
- package/es/lbm/components/instant-search/widgets/types.d.ts +27 -0
- package/es/lbm/components/instant-search/widgets/types.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/types.js +1 -0
- package/es/lbm/components/instant-search/widgets/weather.d.ts +9 -0
- package/es/lbm/components/instant-search/widgets/weather.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/weather.js +36 -0
- package/es/lbm/components/instant-search/widgets/weather.module.css +32 -0
- package/es/lbm/components/instant-search/widgets/webcam.d.ts +8 -0
- package/es/lbm/components/instant-search/widgets/webcam.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets/webcam.js +9 -0
- package/es/lbm/components/instant-search/widgets/webcam.module.css +13 -0
- package/es/lbm/components/instant-search/widgets.d.ts +11 -0
- package/es/lbm/components/instant-search/widgets.d.ts.map +1 -0
- package/es/lbm/components/instant-search/widgets.js +68 -0
- package/es/lbm/components/instant-search/widgets.module.css +14 -0
- package/package.json +3 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Fetcher from "../../../../common/utils/fetcher";
|
|
2
|
+
import getConfig from "next/config";
|
|
3
|
+
const { publicRuntimeConfig } = getConfig();
|
|
4
|
+
const { lumiplanApi, lumiplanResorts } = publicRuntimeConfig;
|
|
5
|
+
const resort = lumiplanResorts[0].id;
|
|
6
|
+
export async function fetchPois() {
|
|
7
|
+
const endpoint = `${lumiplanApi}/pois`;
|
|
8
|
+
return Fetcher.get(endpoint, { resort, operating: "all" }, undefined, undefined);
|
|
9
|
+
}
|
|
10
|
+
export async function fetchResortOpening() {
|
|
11
|
+
const endpoint = `${lumiplanApi}/resort-opening`;
|
|
12
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
13
|
+
}
|
|
14
|
+
export async function fetchWeather() {
|
|
15
|
+
const endpoint = `${lumiplanApi}/weather`;
|
|
16
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
17
|
+
}
|
|
18
|
+
export async function fetchSnow() {
|
|
19
|
+
const endpoint = `${lumiplanApi}/snow`;
|
|
20
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
21
|
+
}
|
|
22
|
+
export async function fetchResortAccess() {
|
|
23
|
+
const endpoint = `${lumiplanApi}/resort-access`;
|
|
24
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
25
|
+
}
|
|
26
|
+
export async function fetchSlopes() {
|
|
27
|
+
const endpoint = `${lumiplanApi}/slopes`;
|
|
28
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
29
|
+
}
|
|
30
|
+
export async function fetchLifts() {
|
|
31
|
+
const endpoint = `${lumiplanApi}/lifts`;
|
|
32
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
33
|
+
}
|
|
34
|
+
export async function fetchWebcams() {
|
|
35
|
+
const endpoint = `${lumiplanApi}/resort-webcam`;
|
|
36
|
+
return Fetcher.get(endpoint, { resort }, undefined, undefined);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/messages.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAGvD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PurpleHighlight } from "../results";
|
|
2
|
+
export declare function getHighlight(property: string, highlight: PurpleHighlight, withExtractQuotes?: boolean): any;
|
|
3
|
+
export declare function wrapWithMark(text: string, matchedTokens: string[]): string;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,eAAe,EAC1B,iBAAiB,GAAE,OAAe,OAoBnC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAajE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function getHighlight(property, highlight, withExtractQuotes = false) {
|
|
2
|
+
if (!highlight[property]?.snippet)
|
|
3
|
+
return;
|
|
4
|
+
let snippet = highlight[property].snippet;
|
|
5
|
+
if (!withExtractQuotes)
|
|
6
|
+
return snippet;
|
|
7
|
+
const startsWithMaj = /[A-Z]/.test(snippet);
|
|
8
|
+
const endsWithDot = snippet[snippet.length - 1] === ".";
|
|
9
|
+
if (!startsWithMaj) {
|
|
10
|
+
snippet = `...${snippet}`;
|
|
11
|
+
}
|
|
12
|
+
if (!endsWithDot) {
|
|
13
|
+
snippet = `${snippet}...`;
|
|
14
|
+
}
|
|
15
|
+
return snippet;
|
|
16
|
+
}
|
|
17
|
+
export function wrapWithMark(text, matchedTokens) {
|
|
18
|
+
if (!matchedTokens?.length)
|
|
19
|
+
return text;
|
|
20
|
+
let textWithMarks = text;
|
|
21
|
+
matchedTokens.forEach((token) => {
|
|
22
|
+
if (token.length < 2)
|
|
23
|
+
return;
|
|
24
|
+
textWithMarks = textWithMarks.replaceAll(token, `<mark>${token}</mark>`);
|
|
25
|
+
textWithMarks = textWithMarks.replaceAll(`<mark><mark>${token}</mark></mark>`, `<mark>${token}</mark>`);
|
|
26
|
+
});
|
|
27
|
+
return textWithMarks;
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hit } from "../results";
|
|
2
|
+
type Props = {
|
|
3
|
+
doc: Hit;
|
|
4
|
+
sendPlausibleGoal: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Access: ({ ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Access;
|
|
8
|
+
//# sourceMappingURL=access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/access.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAKtC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IAET,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,QAAA,MAAM,MAAM,iBAAkB,KAAK,4CAoClC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LumiplanApi from "../services/lumiplan-api";
|
|
4
|
+
import Card from "./components/card";
|
|
5
|
+
import Loader from "dt-design-system/es/loader";
|
|
6
|
+
import Metric from "./components/metric";
|
|
7
|
+
const Access = ({ ...props }) => {
|
|
8
|
+
const [equipement, setEquipement] = React.useState("");
|
|
9
|
+
const [open, setOpen] = React.useState("");
|
|
10
|
+
const [surface, setSurface] = React.useState("");
|
|
11
|
+
const [loading, setLoading] = React.useState(true);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const runEffect = async () => {
|
|
14
|
+
setLoading(true);
|
|
15
|
+
const { roadConditions } = await LumiplanApi.fetchResortAccess();
|
|
16
|
+
const { equipment, status, surface } = roadConditions[0];
|
|
17
|
+
setOpen(status);
|
|
18
|
+
setEquipement(equipment);
|
|
19
|
+
setSurface(surface);
|
|
20
|
+
setLoading(false);
|
|
21
|
+
};
|
|
22
|
+
runEffect();
|
|
23
|
+
}, []);
|
|
24
|
+
if (loading) {
|
|
25
|
+
return (_jsx(Card, { ...props, children: _jsx(Loader, { variant: "overlay" }) }));
|
|
26
|
+
}
|
|
27
|
+
return (_jsxs(Card, { ...props, children: [_jsx(Metric, { long: true, children: _jsx("b", { children: open ? "Route ouverte" : "Route fermée" }) }), equipement === "NORM" ? null : _jsxs("div", { children: ["Equipements : ", equipement] }), _jsxs("div", { children: ["Surface : ", _jsx("b", { children: surface })] })] }));
|
|
28
|
+
};
|
|
29
|
+
export default Access;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hit } from "../results";
|
|
2
|
+
type Props = {
|
|
3
|
+
doc: Hit;
|
|
4
|
+
sendPlausibleGoal: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Activity: ({ doc, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Activity;
|
|
8
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/activity.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AA8CtC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IAET,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,QAAA,MAAM,QAAQ,sBAAuB,KAAK,4CA2CzC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as TrailIcons from "../../lumiplan/icons/trails";
|
|
4
|
+
import * as LumiplanApi from "../services/lumiplan-api";
|
|
5
|
+
import Card from "./components/card";
|
|
6
|
+
import StatusWithIcon from "./components/status-with-icon";
|
|
7
|
+
import Loader from "dt-design-system/es/loader";
|
|
8
|
+
import css from "./activity.module.css";
|
|
9
|
+
const TRAIL_ICONS = {
|
|
10
|
+
BIKE_PARK: TrailIcons.VTT,
|
|
11
|
+
BOARDERCROSS: TrailIcons.BoarderCross,
|
|
12
|
+
BUMP_TRAIL: TrailIcons.ChampDeBosse,
|
|
13
|
+
COASTER: TrailIcons.LugeSurRail,
|
|
14
|
+
CROSS_COUNTRY_MOUNTAIN_BIKING: TrailIcons.BoarderCross,
|
|
15
|
+
CROSS_COUNTRY_SKIING: TrailIcons.SkiAlpin,
|
|
16
|
+
DOWNHILL_MOUNTAIN_BIKING: TrailIcons.VTT,
|
|
17
|
+
DOWNHILL_SKIING: TrailIcons.SkiAlpin,
|
|
18
|
+
EBIKE: TrailIcons.VTT,
|
|
19
|
+
ENDURO: TrailIcons.VTT,
|
|
20
|
+
FREERIDE_AREA_OFF_PIST: TrailIcons.SkiAlpin,
|
|
21
|
+
FREERIDE_SKI_ITINERARY: TrailIcons.SkiAlpin,
|
|
22
|
+
FUN_ZONE: TrailIcons.Freeride,
|
|
23
|
+
GATE: TrailIcons.Freeride,
|
|
24
|
+
GLADES: TrailIcons.Freeride,
|
|
25
|
+
ILLUMINATED_TRAIL: TrailIcons.PisteEclairee,
|
|
26
|
+
MULTI_USE_TRAIL: TrailIcons.Freeride,
|
|
27
|
+
MTB_ENDURO: TrailIcons.VTT,
|
|
28
|
+
PATH: TrailIcons.Pieton,
|
|
29
|
+
PEDESTRIAN: TrailIcons.Pieton,
|
|
30
|
+
ROUTE_OF_CROSS_COUNTRY: TrailIcons.SkiAlpin,
|
|
31
|
+
SKI_TOURING: TrailIcons.Freeride,
|
|
32
|
+
SLEDDING_HILL: TrailIcons.Luge,
|
|
33
|
+
SNOWPARK: TrailIcons.Snowpark,
|
|
34
|
+
SNOWPARK_LINE: TrailIcons.Snowpark,
|
|
35
|
+
SNOWSHOE: TrailIcons.Raquette,
|
|
36
|
+
SNOWTUBING: TrailIcons.Snowtubing,
|
|
37
|
+
TERRAIN_PARK: TrailIcons.Snowpark,
|
|
38
|
+
TERRAIN_PARK_US: TrailIcons.Snowpark,
|
|
39
|
+
TRAIL_RUNNING: TrailIcons.Pieton,
|
|
40
|
+
TREETOP_ADVENTURE_PARK: TrailIcons.Accrobranche,
|
|
41
|
+
TYROLEAN: TrailIcons.Tyrolienne,
|
|
42
|
+
VIDEO_ZONE: TrailIcons.Freeride,
|
|
43
|
+
UNDEF: TrailIcons.Freeride,
|
|
44
|
+
DEFAULT: TrailIcons.Freeride,
|
|
45
|
+
};
|
|
46
|
+
const Activity = ({ doc, ...props }) => {
|
|
47
|
+
const [pois, setPois] = React.useState([]);
|
|
48
|
+
const [loading, setLoading] = React.useState(true);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
const runEffect = async () => {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
const data = await LumiplanApi.fetchPois();
|
|
53
|
+
setPois(data);
|
|
54
|
+
setLoading(false);
|
|
55
|
+
};
|
|
56
|
+
runEffect();
|
|
57
|
+
}, []);
|
|
58
|
+
if (loading) {
|
|
59
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsx(Loader, { variant: "overlay" }) }));
|
|
60
|
+
}
|
|
61
|
+
const activity = pois
|
|
62
|
+
.flatMap((poi) => poi.activities)
|
|
63
|
+
.filter((activity) => activity !== undefined)
|
|
64
|
+
.find((poi) => poi.name === doc.document.title);
|
|
65
|
+
if (!activity) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const Icon = TRAIL_ICONS[activity.activityType] || TRAIL_ICONS.DEFAULT;
|
|
69
|
+
const open = activity.openingStatus && activity.openingStatus === "OPEN";
|
|
70
|
+
const label = open ? "Ouvert" : "Fermé";
|
|
71
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsxs(StatusWithIcon, { icon: Icon, children: [_jsx("b", { className: open ? css.green : css.red, children: label }), activity.openingTimesReal &&
|
|
72
|
+
activity.openingTimesReal.map((time, i) => (_jsxs("div", { children: [time.beginTime, " - ", time.endTime] }, i)))] }) }));
|
|
73
|
+
};
|
|
74
|
+
export default Activity;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Hit } from "../../results";
|
|
3
|
+
type Props = {
|
|
4
|
+
doc: Hit;
|
|
5
|
+
overlayTitle?: boolean;
|
|
6
|
+
sendPlausibleGoal: (path: string) => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export default function Card({ doc, overlayTitle, sendPlausibleGoal, children, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../../../src/lbm/components/instant-search/widgets/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAUpC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,GAAG,EACH,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,KAAK,2CAqBP"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from "ublo/link";
|
|
3
|
+
import * as Ripple from "dt-design-system/es/ripple";
|
|
4
|
+
import * as Utils from "../../services/utils";
|
|
5
|
+
import css from "./card.module.css";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
const createRipple = (e) => {
|
|
8
|
+
Ripple.create(e);
|
|
9
|
+
};
|
|
10
|
+
export default function Card({ doc, overlayTitle, sendPlausibleGoal, children, }) {
|
|
11
|
+
const { document: { title: _title, target, path }, highlight, } = doc;
|
|
12
|
+
const decodedPath = decodeURIComponent(target || path);
|
|
13
|
+
const title = Utils.getHighlight("title", highlight) || _title;
|
|
14
|
+
return (_jsxs(Link, { className: css.card, href: decodedPath, onClick: sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx("div", { dangerouslySetInnerHTML: { __html: title }, className: classNames(css.title, { [css.overlay]: overlayTitle }) }), children] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
height: 75px;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 4px;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
align-items: center;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
color: var(--ds-grey-500, #484848);
|
|
11
|
+
background-color: var(--ds-grey-000, #fff);
|
|
12
|
+
border-radius: var(--ds-input-radius, var(--ds-radius-200, 8px));
|
|
13
|
+
border: var(--ds-input-border, 1px solid var(--ds-grey-300, #d7d7d7));
|
|
14
|
+
font-size: 13px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.card mark {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.card mark::before {
|
|
26
|
+
content: "";
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
|
|
33
|
+
border-radius: calc(var(--ds-radius-100, 6px) / 3);
|
|
34
|
+
opacity: 0.15;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.title {
|
|
38
|
+
font-weight: 700;
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
line-height: 1;
|
|
41
|
+
padding-top: 4px;
|
|
42
|
+
}
|
|
43
|
+
.overlay {
|
|
44
|
+
position: absolute;
|
|
45
|
+
bottom: 8px;
|
|
46
|
+
left: 0;
|
|
47
|
+
text-align: center;
|
|
48
|
+
width: 100%;
|
|
49
|
+
color: hsl(var(--grey-000));
|
|
50
|
+
text-shadow: var(--shadow-200);
|
|
51
|
+
z-index: 1;
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
}
|
|
54
|
+
.overlay mark {
|
|
55
|
+
color: hsl(var(--blue-200));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.overlay mark::before {
|
|
59
|
+
background-color: hsl(var(--grey-000));
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["../../../../../../src/lbm/components/instant-search/widgets/components/metric.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,2CAMvD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import css from "./metric.module.css";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
export default function Metric({ children, long }) {
|
|
5
|
+
return (_jsx("div", { className: classNames(css.metric, { [css.longMetric]: long }), children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
icon: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
4
|
+
iconClassName?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export default function StatusWithIcon({ icon: Icon, iconClassName, children, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=status-with-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-with-icon.d.ts","sourceRoot":"","sources":["../../../../../../src/lbm/components/instant-search/widgets/components/status-with-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EAAE,IAAI,EACV,aAAa,EACb,QAAQ,GACT,EAAE,KAAK,2CASP"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import css from "./status-with-icon.module.css";
|
|
3
|
+
export default function StatusWithIcon({ icon: Icon, iconClassName, children, }) {
|
|
4
|
+
return (_jsxs("div", { className: css.statusWithIcon, children: [_jsx("div", { className: iconClassName, children: _jsx(Icon, {}) }), _jsx("div", { children: children })] }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Hit } from "../results";
|
|
2
|
+
type Props = {
|
|
3
|
+
doc: Hit;
|
|
4
|
+
dawn?: boolean;
|
|
5
|
+
sendPlausibleGoal: (path: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const DawnNightOpenings: ({ dawn, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default DawnNightOpenings;
|
|
9
|
+
//# sourceMappingURL=dawn-nights-openings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dawn-nights-openings.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/dawn-nights-openings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAStC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,QAAA,MAAM,iBAAiB,uBAAwB,KAAK,4CAuDnD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LumiplanApi from "../services/lumiplan-api";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import Card from "./components/card";
|
|
6
|
+
import css from "./dawn-nights-openings.module.css";
|
|
7
|
+
import Loader from "dt-design-system/es/loader";
|
|
8
|
+
const dateLayout = {
|
|
9
|
+
day: "numeric",
|
|
10
|
+
};
|
|
11
|
+
const DawnNightOpenings = ({ dawn, ...props }) => {
|
|
12
|
+
const [dawnSkiingDays, setDawnSkiingDays] = React.useState([]);
|
|
13
|
+
const [nightSkiingDays, setNightSkiingDays] = React.useState([]);
|
|
14
|
+
const [loading, setLoading] = React.useState(true);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
const runEffect = async () => {
|
|
17
|
+
setLoading(true);
|
|
18
|
+
const { availability } = await LumiplanApi.fetchResortOpening();
|
|
19
|
+
setDawnSkiingDays(availability.dawnSkiingDays);
|
|
20
|
+
setNightSkiingDays(availability.nightSkiingDays);
|
|
21
|
+
setLoading(false);
|
|
22
|
+
};
|
|
23
|
+
runEffect();
|
|
24
|
+
}, []);
|
|
25
|
+
if (loading) {
|
|
26
|
+
return (_jsx(Card, { ...props, children: _jsx(Loader, { variant: "overlay" }) }));
|
|
27
|
+
}
|
|
28
|
+
const days = dawn ? dawnSkiingDays : nightSkiingDays;
|
|
29
|
+
return (_jsxs(Card, { ...props, children: [_jsx("div", { className: css.days, children: days.map((day, i) => {
|
|
30
|
+
const weekDayDate = new Date();
|
|
31
|
+
weekDayDate.setDate(weekDayDate.getDate() - ((weekDayDate.getDay() + 6) % 7) + i);
|
|
32
|
+
return (_jsxs("div", { className: classNames(css.day, day.open
|
|
33
|
+
? css.dayOpen
|
|
34
|
+
: css.dayClosed), children: [_jsx("div", { children: weekDayDate.toLocaleDateString("fr", dateLayout) }), _jsx("div", { children: day.dayType[0] })] }, i));
|
|
35
|
+
}) }), days.filter((day) => day.open).length === 0 && (_jsxs("div", { className: css.textCenter, children: ["Aucune ", dawn ? "aurore" : "nocturne", " propos\u00E9e cette semaine"] }))] }));
|
|
36
|
+
};
|
|
37
|
+
export default DawnNightOpenings;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.days {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
font-size: var(--label);
|
|
8
|
+
}
|
|
9
|
+
.day {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 4px;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
padding: 4px 8px;
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
background-color: #f5f5f6;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dayClosed {
|
|
21
|
+
color: #444;
|
|
22
|
+
}
|
|
23
|
+
.dayClosed > :nth-child(2) {
|
|
24
|
+
text-decoration: line-through 2px;
|
|
25
|
+
}
|
|
26
|
+
.dayOpen {
|
|
27
|
+
background-color: #aaf5aa;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.textCenter {
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hit } from "../results";
|
|
2
|
+
type Props = {
|
|
3
|
+
doc: Hit;
|
|
4
|
+
sendPlausibleGoal: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Lift: ({ doc, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Lift;
|
|
8
|
+
//# sourceMappingURL=lift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lift.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/lift.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAwBtC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IAET,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,QAAA,MAAM,IAAI,sBAAuB,KAAK,4CA4CrC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LiftsIcons from "../../lumiplan/icons/lifts";
|
|
4
|
+
import * as LumiplanApi from "../services/lumiplan-api";
|
|
5
|
+
import Card from "./components/card";
|
|
6
|
+
import StatusWithIcon from "./components/status-with-icon";
|
|
7
|
+
import Loader from "dt-design-system/es/loader";
|
|
8
|
+
import css from "./lift.module.css";
|
|
9
|
+
const LIFT_ICONS = {
|
|
10
|
+
TRAIN: LiftsIcons.Teleski,
|
|
11
|
+
FUNICULAR: LiftsIcons.Teleski,
|
|
12
|
+
TRAM: LiftsIcons.Teleski,
|
|
13
|
+
CABRIOLET_GONDOLA: LiftsIcons.Telecabine,
|
|
14
|
+
GONDOLA: LiftsIcons.Telecabine,
|
|
15
|
+
COMBINED_CHAIR_GONDOLA_LIFT: LiftsIcons.Telecabine,
|
|
16
|
+
DETACHABLE_BUBBLE_CHAIRLIFT: LiftsIcons.Telecabine,
|
|
17
|
+
DETACHABLE_CHAIRLIFT: LiftsIcons.TelesiegeDebrayable,
|
|
18
|
+
CHAIRLIFT: LiftsIcons.Telesiege,
|
|
19
|
+
SURFACE_LIFT: LiftsIcons.Teleski,
|
|
20
|
+
MAGIC_CARPET: LiftsIcons.TapisRoulant,
|
|
21
|
+
ROPE_TOW: LiftsIcons.Teleski,
|
|
22
|
+
DEFAULT: LiftsIcons.Teleski,
|
|
23
|
+
};
|
|
24
|
+
const Lift = ({ doc, ...props }) => {
|
|
25
|
+
const [pois, setPois] = React.useState([]);
|
|
26
|
+
const [loading, setLoading] = React.useState(true);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
const runEffect = async () => {
|
|
29
|
+
setLoading(true);
|
|
30
|
+
const data = await LumiplanApi.fetchPois();
|
|
31
|
+
setPois(data);
|
|
32
|
+
setLoading(false);
|
|
33
|
+
};
|
|
34
|
+
runEffect();
|
|
35
|
+
}, []);
|
|
36
|
+
if (loading) {
|
|
37
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsx(Loader, { variant: "overlay" }) }));
|
|
38
|
+
}
|
|
39
|
+
const lift = pois
|
|
40
|
+
.flatMap((poi) => poi.lifts)
|
|
41
|
+
.filter((lift) => lift !== undefined)
|
|
42
|
+
.find((poi) => poi.name === doc.document.title);
|
|
43
|
+
if (!lift) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const Icon = LIFT_ICONS[lift.liftType] || LIFT_ICONS.DEFAULT;
|
|
47
|
+
const open = lift.openingStatus && lift.openingStatus === "OPEN";
|
|
48
|
+
const label = open ? "Ouverte" : "Fermée";
|
|
49
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsxs(StatusWithIcon, { icon: Icon, children: [_jsx("b", { className: open ? css.green : css.red, children: label }), lift.openingTimesReal &&
|
|
50
|
+
lift.openingTimesReal.map((time, i) => (_jsxs("div", { children: [time.beginTime, " - ", time.endTime] }, i)))] }) }));
|
|
51
|
+
};
|
|
52
|
+
export default Lift;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Hit } from "../results";
|
|
2
|
+
type Props = {
|
|
3
|
+
doc: Hit;
|
|
4
|
+
sendPlausibleGoal: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Lifts: ({ doc, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Lifts;
|
|
8
|
+
//# sourceMappingURL=lifts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifts.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/lifts.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAItC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IAET,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,QAAA,MAAM,KAAK,sBAAuB,KAAK,4CAkCtC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LumiplanApi from "../services/lumiplan-api";
|
|
4
|
+
import Card from "./components/card";
|
|
5
|
+
import Metric from "./components/metric";
|
|
6
|
+
import Loader from "dt-design-system/es/loader";
|
|
7
|
+
const Lifts = ({ doc, ...props }) => {
|
|
8
|
+
const [nOpen, setNOpen] = React.useState(0);
|
|
9
|
+
const [nTotal, setNTotal] = React.useState(0);
|
|
10
|
+
const [loading, setLoading] = React.useState(true);
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
const runEffect = async () => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
const data = await LumiplanApi.fetchLifts();
|
|
15
|
+
setNOpen(data.count.open);
|
|
16
|
+
setNTotal(data.count.total);
|
|
17
|
+
setLoading(false);
|
|
18
|
+
};
|
|
19
|
+
runEffect();
|
|
20
|
+
}, []);
|
|
21
|
+
if (loading) {
|
|
22
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsx(Loader, { variant: "overlay" }) }));
|
|
23
|
+
}
|
|
24
|
+
return (_jsx(Card, { doc: doc, ...props, children: _jsxs(Metric, { children: [_jsx("b", { children: nOpen }), nTotal !== 0 && (_jsxs(_Fragment, { children: ["/", _jsx("b", { children: nTotal })] }))] }) }));
|
|
25
|
+
};
|
|
26
|
+
export default Lifts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msem-widget.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/widgets/msem-widget.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAwDjC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,GAAG,CAAC;IAET,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,KAAK,2CA4BhD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Button from "dt-design-system/es/button";
|
|
3
|
+
import * as Utils from "../services/utils";
|
|
4
|
+
import getConfig from "next/config";
|
|
5
|
+
import * as MseM from "../../../../future/components/msem";
|
|
6
|
+
import css from "./msem-widget.module.css";
|
|
7
|
+
const { publicRuntimeConfig } = getConfig();
|
|
8
|
+
const { channel, resort } = publicRuntimeConfig;
|
|
9
|
+
const WIDGET_ICONS = {
|
|
10
|
+
DEFAULT: "cart-circle",
|
|
11
|
+
};
|
|
12
|
+
const startWidget = (widget, merchantCode, merchantSlug) => {
|
|
13
|
+
const options = {
|
|
14
|
+
resort,
|
|
15
|
+
channel,
|
|
16
|
+
verticalMargin: 100,
|
|
17
|
+
merchant: merchantCode,
|
|
18
|
+
theme: "/msem-theme.css",
|
|
19
|
+
};
|
|
20
|
+
const presets = {
|
|
21
|
+
merchantSlug,
|
|
22
|
+
};
|
|
23
|
+
MseM.loadWidget(widget, options, presets);
|
|
24
|
+
};
|
|
25
|
+
export default function MsemWidget({ doc }) {
|
|
26
|
+
const { document: { title: _title, target: widget, path: merchantCodeAndSlug }, highlight, } = doc;
|
|
27
|
+
const [merchantCode, merchantSlug] = merchantCodeAndSlug.split("|");
|
|
28
|
+
const icon = WIDGET_ICONS[widget] || WIDGET_ICONS.DEFAULT;
|
|
29
|
+
const title = Utils.getHighlight("title", highlight) || _title;
|
|
30
|
+
return (_jsx(Button, { tag: "a", className: css.card, onClick: () => startWidget(widget, merchantCode, merchantSlug), noRipple: true, variant: "transparent", children: _jsxs("div", { className: css.iconAndName, children: [_jsx("svg", { width: 36, height: 36, viewBox: "0 0 24 24", children: _jsx("use", { xlinkHref: `/static/images/sprites/icons.svg#icon-${icon}` }) }), _jsx("div", { dangerouslySetInnerHTML: { __html: title }, className: css.title })] }) }));
|
|
31
|
+
}
|