ublo-lib 1.46.3 → 1.46.5
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/date-picker/data.d.ts.map +1 -1
- package/es/common/components/editable-calendar/data.d.ts.map +1 -1
- package/es/common/components/search-bar/utils/keyboard-keys.d.ts.map +1 -1
- package/es/esf/components/instant-search/images/page-placeholder.png +0 -0
- package/es/esf/components/instant-search/instant-search.d.ts +2 -0
- package/es/esf/components/instant-search/instant-search.d.ts.map +1 -1
- package/es/esf/components/instant-search/links.d.ts +7 -2
- package/es/esf/components/instant-search/links.d.ts.map +1 -1
- package/es/esf/components/instant-search/links.js +7 -7
- package/es/esf/components/instant-search/products.d.ts +9 -1
- package/es/esf/components/instant-search/products.d.ts.map +1 -1
- package/es/esf/components/instant-search/products.js +77 -7
- package/es/esf/components/instant-search/products.module.css +9 -1
- package/es/esf/components/instant-search/results.d.ts +8 -1
- package/es/esf/components/instant-search/results.d.ts.map +1 -1
- package/es/esf/components/instant-search/results.js +5 -2
- package/es/esf/components/instant-search/services/utils.d.ts +1 -0
- package/es/esf/components/instant-search/services/utils.d.ts.map +1 -1
- package/es/esf/components/instant-search/services/utils.js +5 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/data.js"],"names":[],"mappings":";;;;;;;;;;;AAaA,+BAA6D;AAE7D,gCAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2H/D
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/data.js"],"names":[],"mappings":";;;;;;;;;;;AAaA,+BAA6D;AAE7D,gCAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2H/D,+BAAgC;AAEzB,kEAyCN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/data.js"],"names":[],"mappings":"AA2FA,iEAmCC;AA5HD,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFpD
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/data.js"],"names":[],"mappings":"AA2FA,iEAmCC;AA5HD,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFpD,+BAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-keys.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/utils/keyboard-keys.js"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"keyboard-keys.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/utils/keyboard-keys.js"],"names":[],"mappings":"AAAA,mBAAoB;AACpB,yBAA0B;AAC1B,2BAA4B;AAC5B,uBAAwB;AACxB,wBAAyB"}
|
|
Binary file
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResultsOptions } from "./results";
|
|
1
2
|
import { SearchOptions } from "./hooks/use-search";
|
|
2
3
|
type Props = {
|
|
3
4
|
lang: string;
|
|
@@ -13,6 +14,7 @@ type Props = {
|
|
|
13
14
|
en?: string[];
|
|
14
15
|
};
|
|
15
16
|
options?: SearchOptions;
|
|
17
|
+
resultsOptions?: ResultsOptions;
|
|
16
18
|
};
|
|
17
19
|
export default function InstantSearch({ lang, suggestions, className, ubloContext, options, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instant-search.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/instant-search.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"instant-search.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/instant-search.tsx"],"names":[],"mappings":"AASA,OAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAK9D,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;QAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,WAAW,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;KACf,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,WAAW,EACX,SAAS,EACT,WAAW,EACX,OAAY,GACb,EAAE,KAAK,2CA+HP"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { Hit } from "./results";
|
|
2
|
+
export type LinkOptions = {
|
|
3
|
+
parentTitleField?: string | false;
|
|
4
|
+
titleField?: string | false;
|
|
5
|
+
textField?: string | false;
|
|
6
|
+
};
|
|
2
7
|
type Props = {
|
|
3
8
|
linksTitle: string;
|
|
4
9
|
icon: "FileText" | "Info" | "Question" | "User";
|
|
5
10
|
links: Hit[];
|
|
6
|
-
pageTitleAsTitle?: boolean;
|
|
7
11
|
loading: boolean;
|
|
8
12
|
sendPlausibleGoal: (path: string) => void;
|
|
13
|
+
linkOptions?: LinkOptions;
|
|
9
14
|
};
|
|
10
|
-
export default function Links({ icon, linksTitle, links,
|
|
15
|
+
export default function Links({ icon, linksTitle, links, loading, sendPlausibleGoal, linkOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
16
|
export {};
|
|
12
17
|
//# sourceMappingURL=links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/links.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IAChD,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/links.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC5B,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IAChD,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAMF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,WAAgB,GACjB,EAAE,KAAK,2CAuEP"}
|
|
@@ -10,8 +10,9 @@ import * as Utils from "./services/utils";
|
|
|
10
10
|
import css from "./links.module.css";
|
|
11
11
|
const PLACEHOLDERS = [...new Array(3)];
|
|
12
12
|
const Icons = { FileText, Info, Question, User };
|
|
13
|
-
export default function Links({ icon, linksTitle, links,
|
|
13
|
+
export default function Links({ icon, linksTitle, links, loading, sendPlausibleGoal, linkOptions = {}, }) {
|
|
14
14
|
const Icon = Icons[icon];
|
|
15
|
+
const { parentTitleField = "parentTitle", titleField = "title", textField = "text", } = linkOptions;
|
|
15
16
|
const noResult = !loading && !links.length;
|
|
16
17
|
const createRipple = (e) => {
|
|
17
18
|
Ripple.create(e);
|
|
@@ -23,12 +24,11 @@ export default function Links({ icon, linksTitle, links, pageTitleAsTitle, loadi
|
|
|
23
24
|
return (_jsx("div", { className: css.loaderContainer, children: _jsx(Loader, { className: css.loader, variant: "overlay" }) }, i));
|
|
24
25
|
}), !loading &&
|
|
25
26
|
links.map((link) => {
|
|
26
|
-
const { id,
|
|
27
|
+
const { id, path } = link.document;
|
|
27
28
|
const decodedPath = decodeURIComponent(path);
|
|
28
|
-
const
|
|
29
|
-
const linkTitle = Utils.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return (_jsxs(Link, { href: decodedPath, className: css.link, onClick: () => sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx(Icon, { className: css.linkIcon }), _jsxs("div", { className: css.linkContent, children: [parentTitle && (_jsx("div", { className: css.linkParent, dangerouslySetInnerHTML: { __html: parentTitle } })), _jsx("div", { className: css.linkTitle, dangerouslySetInnerHTML: { __html: linkTitle } }), linkText && (_jsx("div", { className: css.linkText, dangerouslySetInnerHTML: { __html: linkText } }))] })] }, id));
|
|
29
|
+
const linkCategory = Utils.getValueFromHit(link, parentTitleField);
|
|
30
|
+
const linkTitle = Utils.getValueFromHit(link, titleField);
|
|
31
|
+
const linkText = Utils.getValueFromHit(link, textField);
|
|
32
|
+
return (_jsxs(Link, { href: decodedPath, className: css.link, onClick: () => sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx(Icon, { className: css.linkIcon }), _jsxs("div", { className: css.linkContent, children: [linkCategory && (_jsx("div", { className: css.linkParent, dangerouslySetInnerHTML: { __html: linkCategory } })), linkTitle && (_jsx("div", { className: css.linkTitle, dangerouslySetInnerHTML: { __html: linkTitle } })), linkText && (_jsx("div", { className: css.linkText, dangerouslySetInnerHTML: { __html: linkText } }))] })] }, id));
|
|
33
33
|
})] })] }));
|
|
34
34
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Hit } from "./results";
|
|
3
|
+
export type ProductOptions = {
|
|
4
|
+
categoryField?: string | false;
|
|
5
|
+
titleField?: string | false;
|
|
6
|
+
subTitleField?: string | false;
|
|
7
|
+
textField?: string | false;
|
|
8
|
+
tagFields?: string[];
|
|
9
|
+
};
|
|
3
10
|
type Props = {
|
|
4
11
|
lang: string;
|
|
5
12
|
products: Hit[];
|
|
@@ -8,7 +15,8 @@ type Props = {
|
|
|
8
15
|
sendPlausibleGoal: (path: string) => void;
|
|
9
16
|
otherResultsRef: React.RefObject<HTMLDivElement>;
|
|
10
17
|
isOtherResultsEmpty: boolean;
|
|
18
|
+
productOptions?: ProductOptions;
|
|
11
19
|
};
|
|
12
|
-
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
21
|
export {};
|
|
14
22
|
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/products.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/products.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAWrC,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACjD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAmB,GACpB,EAAE,KAAK,2CA8IP"}
|
|
@@ -8,9 +8,12 @@ import * as Ripple from "dt-design-system/es/ripple";
|
|
|
8
8
|
import * as Utils from "./services/utils";
|
|
9
9
|
import message from "./services/messages";
|
|
10
10
|
import NoProduct from "./no-product";
|
|
11
|
+
import pagePlaceholder from "./images/page-placeholder.png";
|
|
12
|
+
import { Award, DownhillSkiing, File, Home, Smile, } from "dt-design-system/es/icons";
|
|
11
13
|
import css from "./products.module.css";
|
|
12
14
|
const PLACEHOLDERS = [...new Array(5)];
|
|
13
|
-
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, }) {
|
|
15
|
+
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions = {}, }) {
|
|
16
|
+
const { categoryField = "parentTitle", titleField = "pageTitle", subTitleField = "title", textField = "text", tagFields = ["time"], } = productOptions;
|
|
14
17
|
const filteredProducts = Utils.filterProducts(products, weekNumber);
|
|
15
18
|
const noProduct = !loading && !filteredProducts.length;
|
|
16
19
|
const scrollToOtherResults = () => {
|
|
@@ -29,14 +32,81 @@ export default function Products({ lang, products, weekNumber, loading, sendPlau
|
|
|
29
32
|
return (_jsx("div", { className: css.loaderContainer, children: _jsx(Loader, { className: css.loader, variant: "overlay" }) }, i));
|
|
30
33
|
}), !loading &&
|
|
31
34
|
filteredProducts.map((product) => {
|
|
32
|
-
const { id,
|
|
35
|
+
const { id, title, image = "", imagePlaceholder, price, path, } = product.document;
|
|
33
36
|
const decodedPath = decodeURIComponent(path);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const productText = Utils.
|
|
37
|
+
const productCategory = Utils.getValueFromHit(product, categoryField);
|
|
38
|
+
const productPageTitle = Utils.getValueFromHit(product, titleField);
|
|
39
|
+
const productTitle = Utils.getValueFromHit(product, subTitleField);
|
|
40
|
+
const productText = Utils.getValueFromHit(product, textField);
|
|
38
41
|
const showPrice = price !== undefined && weekNumber !== null;
|
|
39
42
|
const imagePlaceholderStategy = imagePlaceholder ? "blur" : "empty";
|
|
40
|
-
|
|
43
|
+
const showImage = Boolean(image);
|
|
44
|
+
return (_jsxs(Link, { className: css.product, href: decodedPath, onClick: () => sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [showImage ? (_jsx(Image, { className: css.productImage, src: image, alt: title, width: 220, height: 180, placeholder: imagePlaceholderStategy, blurDataURL: imagePlaceholder })) : (_jsx(Placeholder, { lang: lang, doc: product.document })), _jsxs("div", { className: css.productContent, children: [productCategory && (_jsx("div", { className: css.productParent, dangerouslySetInnerHTML: { __html: productCategory } })), productPageTitle && (_jsx("div", { className: css.productPageTitle, dangerouslySetInnerHTML: { __html: productPageTitle } })), productTitle && (_jsx("div", { className: css.productTitle, dangerouslySetInnerHTML: { __html: productTitle } })), _jsx("div", { className: css.productTags, children: tagFields.map((tagField) => {
|
|
45
|
+
const tagHtml = Utils.getValueFromHit(product, tagField);
|
|
46
|
+
return tagHtml ? (_jsx("div", { className: css.productTag, dangerouslySetInnerHTML: { __html: tagHtml } })) : null;
|
|
47
|
+
}) }), productText && (_jsx("div", { className: css.productText, dangerouslySetInnerHTML: { __html: productText } })), showPrice && (_jsx("div", { className: css.productPrice, dangerouslySetInnerHTML: { __html: price } }))] })] }, id));
|
|
41
48
|
}), !noProduct && !isOtherResultsEmpty && (_jsx("div", { className: css.otherProducts, children: _jsxs(Button, { className: css.otherProductsButton, onClick: scrollToOtherResults, children: [message(lang, "showOtherResults"), _jsx(ArrowDownIcon, {})] }) }))] }));
|
|
42
49
|
}
|
|
50
|
+
function Placeholder({ doc }) {
|
|
51
|
+
const activity = parseActivity([
|
|
52
|
+
doc.title,
|
|
53
|
+
doc.pageTitle,
|
|
54
|
+
doc.parentTitle,
|
|
55
|
+
doc.seoKeywords,
|
|
56
|
+
doc.seoTitle,
|
|
57
|
+
doc.shortTitle,
|
|
58
|
+
doc.text,
|
|
59
|
+
].join(" "));
|
|
60
|
+
const icons = {
|
|
61
|
+
ski: DownhillSkiing,
|
|
62
|
+
snowboard: DownhillSkiing,
|
|
63
|
+
nordic: DownhillSkiing,
|
|
64
|
+
snowshoe: DownhillSkiing,
|
|
65
|
+
sled: DownhillSkiing,
|
|
66
|
+
touring: DownhillSkiing,
|
|
67
|
+
freestyle: DownhillSkiing,
|
|
68
|
+
telemark: DownhillSkiing,
|
|
69
|
+
competition: Award,
|
|
70
|
+
pioupiou: Smile,
|
|
71
|
+
garderie: Home,
|
|
72
|
+
unknown: File,
|
|
73
|
+
};
|
|
74
|
+
const Icon = icons[activity];
|
|
75
|
+
return (_jsxs("div", { className: css.placeholder, children: [_jsx(Image, { className: css.productImage, src: pagePlaceholder, width: 220, height: 180, alt: "placeholder" }), _jsx(Icon, { className: css.icon })] }));
|
|
76
|
+
}
|
|
77
|
+
const parseActivity = (text) => {
|
|
78
|
+
const hasCompet = text.match(/(comp[eé]tition|chrono|fl[eè]che|chamois|)/i);
|
|
79
|
+
if (hasCompet)
|
|
80
|
+
return "competition";
|
|
81
|
+
const hasSki = text.match(/ski/i);
|
|
82
|
+
if (hasSki)
|
|
83
|
+
return "ski";
|
|
84
|
+
const hasSnowboard = text.match(/snowboard/i);
|
|
85
|
+
if (hasSnowboard)
|
|
86
|
+
return "snowboard";
|
|
87
|
+
const hasTelemark = text.match(/telemark/i);
|
|
88
|
+
if (hasTelemark)
|
|
89
|
+
return "telemark";
|
|
90
|
+
const hasNordic = text.match(/(nordic|biathlon|ski de fond)/i);
|
|
91
|
+
if (hasNordic)
|
|
92
|
+
return "nordic";
|
|
93
|
+
const hasFreestyle = text.match(/freestyle/i);
|
|
94
|
+
if (hasFreestyle)
|
|
95
|
+
return "freestyle";
|
|
96
|
+
const hasSnowshoe = text.match(/(raquette|snowshoe)/i);
|
|
97
|
+
if (hasSnowshoe)
|
|
98
|
+
return "snowshoe";
|
|
99
|
+
const hasSled = text.match(/(luge|sled)/i);
|
|
100
|
+
if (hasSled)
|
|
101
|
+
return "sled";
|
|
102
|
+
const hasSkiTouring = text.match(/(randonnée|touring)/i);
|
|
103
|
+
if (hasSkiTouring)
|
|
104
|
+
return "touring";
|
|
105
|
+
const hasGarderie = text.match(/(garderie|cr[eè]che)/i);
|
|
106
|
+
if (hasGarderie)
|
|
107
|
+
return "garderie";
|
|
108
|
+
const hasPiou = text.match(/(piou piou)/i);
|
|
109
|
+
if (hasPiou)
|
|
110
|
+
return "pioupiou";
|
|
111
|
+
return "unknown";
|
|
112
|
+
};
|
|
@@ -111,8 +111,16 @@
|
|
|
111
111
|
font-size: 12px;
|
|
112
112
|
border-radius: var(--ds-radius-100, 6px);
|
|
113
113
|
}
|
|
114
|
+
.productTags {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
gap: 4px;
|
|
118
|
+
flex-wrap: wrap;
|
|
119
|
+
justify-content: start;
|
|
120
|
+
align-items: center;
|
|
121
|
+
}
|
|
114
122
|
|
|
115
|
-
.
|
|
123
|
+
.productTag {
|
|
116
124
|
font-size: 8px;
|
|
117
125
|
text-transform: uppercase;
|
|
118
126
|
font-weight: 700;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LinkOptions } from "./links";
|
|
2
|
+
import { ProductOptions } from "./products";
|
|
1
3
|
type Document = {
|
|
2
4
|
id: string;
|
|
3
5
|
image?: string;
|
|
@@ -48,6 +50,10 @@ type GroupedHit = {
|
|
|
48
50
|
group_key: string[];
|
|
49
51
|
hits: Hit[];
|
|
50
52
|
};
|
|
53
|
+
export type ResultsOptions = {
|
|
54
|
+
productOptions?: ProductOptions;
|
|
55
|
+
linkOptions?: LinkOptions;
|
|
56
|
+
};
|
|
51
57
|
type RequestParams = {
|
|
52
58
|
collection_name: string;
|
|
53
59
|
per_page: number;
|
|
@@ -70,7 +76,8 @@ type Props = {
|
|
|
70
76
|
openPeriodPicker: () => void;
|
|
71
77
|
sendPlausibleGoal: (path: string) => void;
|
|
72
78
|
loading: boolean;
|
|
79
|
+
resultsOptions?: ResultsOptions;
|
|
73
80
|
};
|
|
74
|
-
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, resultsOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
75
82
|
export {};
|
|
76
83
|
//# sourceMappingURL=results.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/results.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/instant-search/results.tsx"],"names":[],"mappings":"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"}
|
|
@@ -10,7 +10,7 @@ import message from "./services/messages";
|
|
|
10
10
|
import css from "./results.module.css";
|
|
11
11
|
const { publicRuntimeConfig } = getConfig();
|
|
12
12
|
const { season } = publicRuntimeConfig;
|
|
13
|
-
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, }) {
|
|
13
|
+
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, resultsOptions = {}, }) {
|
|
14
14
|
const ref = React.useRef(null);
|
|
15
15
|
const { grouped_hits: groupedHits = [] } = results || {};
|
|
16
16
|
const flattenedHits = groupedHits.reduce((acc, group) => {
|
|
@@ -37,5 +37,8 @@ export default function Results({ lang, text, results, weekNumber, openPeriodPic
|
|
|
37
37
|
instructors.length ||
|
|
38
38
|
filteredFaqs.length ||
|
|
39
39
|
information.length);
|
|
40
|
-
return (_jsx("div", { className: css.results, children: (loading || text.length > 0) && (_jsxs("div", { className: css.inner, children: [_jsxs("div", { ref: ref, className: css.left, children: [_jsx(Links, { linksTitle: message(lang, "pages"), icon: "FileText", links: pages, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "instructors"), icon: "User", links: instructors, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "faqs"), icon: "Question", links: filteredFaqs, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "information"), icon: "Info", links: information, loading: loading, sendPlausibleGoal: sendPlausibleGoal,
|
|
40
|
+
return (_jsx("div", { className: css.results, children: (loading || text.length > 0) && (_jsxs("div", { className: css.inner, children: [_jsxs("div", { ref: ref, className: css.left, children: [_jsx(Links, { linksTitle: message(lang, "pages"), icon: "FileText", links: pages, loading: loading, sendPlausibleGoal: sendPlausibleGoal, linkOptions: resultsOptions.linkOptions }), _jsx(Links, { linksTitle: message(lang, "instructors"), icon: "User", links: instructors, loading: loading, sendPlausibleGoal: sendPlausibleGoal, linkOptions: resultsOptions.linkOptions }), _jsx(Links, { linksTitle: message(lang, "faqs"), icon: "Question", links: filteredFaqs, loading: loading, sendPlausibleGoal: sendPlausibleGoal, linkOptions: resultsOptions.linkOptions }), _jsx(Links, { linksTitle: message(lang, "information"), icon: "Info", links: information, loading: loading, sendPlausibleGoal: sendPlausibleGoal, linkOptions: {
|
|
41
|
+
...resultsOptions.linkOptions,
|
|
42
|
+
titleField: "pageTitle",
|
|
43
|
+
} })] }), _jsxs("div", { className: css.right, children: [!loading && products.length > 0 && weekSystemEnabled && (_jsx(_Fragment, { children: showProductsTitle ? (_jsxs("div", { className: css.resultsWithWeekTitle, children: [message(lang, "productTitleWithWeek"), Dates.weekToLongDate(weekNumber, season.end, season.forceSeasonSwitch), _jsxs(Button, { onClick: openPeriodPicker, children: [_jsx(CalendarIcon, {}), message(lang, "updateWeek")] })] })) : (_jsxs("div", { className: css.resultsWithoutWeekTitle, children: [message(lang, "productTitleWithoutWeek"), _jsxs(Button, { onClick: openPeriodPicker, children: [_jsx(CalendarIcon, {}), message(lang, "chooseWeek")] })] })) })), _jsx(Products, { lang: lang, products: products, weekNumber: weekNumber, loading: loading, sendPlausibleGoal: sendPlausibleGoal, otherResultsRef: ref, isOtherResultsEmpty: isOtherResultsEmpty, productOptions: resultsOptions.productOptions })] })] })) }));
|
|
41
44
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hit, PurpleHighlight } from "../results";
|
|
2
|
+
export declare function getValueFromHit(hit: Hit, field: string | false): any;
|
|
2
3
|
export declare function getHighlight(property: string, highlight: PurpleHighlight, withExtractQuotes?: boolean): any;
|
|
3
4
|
export declare function filterProducts(products: Hit[], weekNumber: number | null): Hit[];
|
|
4
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/instant-search/services/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,eAAe,EAC1B,iBAAiB,GAAE,OAAe,OAoBnC;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,SAkBxE"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/instant-search/services/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,OAI9D;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,eAAe,EAC1B,iBAAiB,GAAE,OAAe,OAoBnC;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,SAkBxE"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export function getValueFromHit(hit, field) {
|
|
2
|
+
return field === false
|
|
3
|
+
? undefined
|
|
4
|
+
: getHighlight(field, hit.highlight) || hit.document[field];
|
|
5
|
+
}
|
|
1
6
|
export function getHighlight(property, highlight, withExtractQuotes = false) {
|
|
2
7
|
if (!highlight[property]?.snippet)
|
|
3
8
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ublo-lib",
|
|
3
|
-
"version": "1.46.
|
|
3
|
+
"version": "1.46.5",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"classnames": "^2.5.1",
|
|
6
6
|
"dt-design-system": "^3.12.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
35
35
|
"framer-motion": "^11.18.2",
|
|
36
36
|
"mv": "^2.1.1",
|
|
37
|
-
"node-html-parser": "^6.1.13",
|
|
38
37
|
"next": "^14.2.23",
|
|
38
|
+
"node-html-parser": "^6.1.13",
|
|
39
39
|
"react": "^19.0.0",
|
|
40
40
|
"react-dom": "^19.0.0",
|
|
41
41
|
"typescript": "^5.7.3",
|