ublo-lib 1.46.7 → 1.46.9
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/esf/components/instant-search/instant-search.d.ts +5 -1
- package/es/esf/components/instant-search/instant-search.d.ts.map +1 -1
- package/es/esf/components/instant-search/instant-search.js +2 -2
- package/es/esf/components/instant-search/products.d.ts +4 -1
- package/es/esf/components/instant-search/products.d.ts.map +1 -1
- package/es/esf/components/instant-search/products.js +19 -4
- package/es/esf/components/instant-search/products.module.css +16 -4
- package/es/esf/components/instant-search/results.d.ts +6 -1
- package/es/esf/components/instant-search/results.d.ts.map +1 -1
- package/es/esf/components/instant-search/results.js +2 -2
- package/es/esf/components/instant-search/services/api.d.ts.map +1 -1
- package/es/esf/components/instant-search/services/api.js +2 -1
- package/es/esf/components/instant-search/services/utils.d.ts.map +1 -1
- package/es/esf/components/instant-search/services/utils.js +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { ResultsOptions } from "./results";
|
|
2
3
|
import { SearchOptions } from "./hooks/use-search";
|
|
3
4
|
type Props = {
|
|
@@ -15,7 +16,10 @@ type Props = {
|
|
|
15
16
|
};
|
|
16
17
|
options?: SearchOptions;
|
|
17
18
|
resultsOptions?: ResultsOptions;
|
|
19
|
+
productImage?: React.ComponentType<{
|
|
20
|
+
text: string;
|
|
21
|
+
}>;
|
|
18
22
|
};
|
|
19
|
-
export default function InstantSearch({ lang, suggestions, className, ubloContext, options, resultsOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default function InstantSearch({ lang, suggestions, className, ubloContext, options, resultsOptions, productImage, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
export {};
|
|
21
25
|
//# sourceMappingURL=instant-search.d.ts.map
|
|
@@ -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":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,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;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,WAAW,EACX,SAAS,EACT,WAAW,EACX,OAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,KAAK,2CAiIP"}
|
|
@@ -11,7 +11,7 @@ import Results from "./results";
|
|
|
11
11
|
import useSearch from "./hooks/use-search";
|
|
12
12
|
import * as Plausible from "../../../common/components/plausible";
|
|
13
13
|
import css from "./instant-search.module.css";
|
|
14
|
-
export default function InstantSearch({ lang, suggestions, className, ubloContext, options = {}, resultsOptions, }) {
|
|
14
|
+
export default function InstantSearch({ lang, suggestions, className, ubloContext, options = {}, resultsOptions, productImage, }) {
|
|
15
15
|
const [opened, setOpened] = React.useState(false);
|
|
16
16
|
const [periodPickerOpened, setPeriodPickerOpened] = React.useState(false);
|
|
17
17
|
const [weekNumber, setWeekNumber] = React.useState(null);
|
|
@@ -83,5 +83,5 @@ export default function InstantSearch({ lang, suggestions, className, ubloContex
|
|
|
83
83
|
window.removeEventListener("keydown", handleKeyPresses);
|
|
84
84
|
};
|
|
85
85
|
}, [handleKeyPresses]);
|
|
86
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "transparent", className: classes, onClick: openSearch, children: _jsx(SearchIcon, { className: css.searchIcon }) }), _jsxs(Dialog, { className: css.dialog, isOpened: opened, showCloseButton: false, close: () => closeSearch(), container: "body", children: [_jsx(Input, { lang: lang, text: text, setText: setText, closeSearch: closeSearch, loading: search.loading === true, suggestions: suggestions }), _jsx(Results, { lang: lang, text: text, results: search.result, weekNumber: weekNumber, openPeriodPicker: openPeriodPicker, loading: search.loading === true && search.result === undefined, sendPlausibleGoal: sendPlausibleGoal, resultsOptions: resultsOptions })] }), _jsx(Dialog, { isOpened: periodPickerOpened, close: closePeriodPicker, container: "body", children: _jsx(PeriodPicker, { onChange: updateWeek, ubloContext: ubloContext }) })] }));
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "transparent", className: classes, onClick: openSearch, children: _jsx(SearchIcon, { className: css.searchIcon }) }), _jsxs(Dialog, { className: css.dialog, isOpened: opened, showCloseButton: false, close: () => closeSearch(), container: "body", children: [_jsx(Input, { lang: lang, text: text, setText: setText, closeSearch: closeSearch, loading: search.loading === true, suggestions: suggestions }), _jsx(Results, { lang: lang, text: text, results: search.result, weekNumber: weekNumber, openPeriodPicker: openPeriodPicker, loading: search.loading === true && search.result === undefined, sendPlausibleGoal: sendPlausibleGoal, resultsOptions: resultsOptions, productImage: productImage })] }), _jsx(Dialog, { isOpened: periodPickerOpened, close: closePeriodPicker, container: "body", children: _jsx(PeriodPicker, { onChange: updateWeek, ubloContext: ubloContext }) })] }));
|
|
87
87
|
}
|
|
@@ -16,7 +16,10 @@ type Props = {
|
|
|
16
16
|
otherResultsRef: React.RefObject<HTMLDivElement>;
|
|
17
17
|
isOtherResultsEmpty: boolean;
|
|
18
18
|
productOptions?: ProductOptions;
|
|
19
|
+
productImage?: React.ComponentType<{
|
|
20
|
+
text: string;
|
|
21
|
+
}>;
|
|
19
22
|
};
|
|
20
|
-
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions, productImage: ProductImage, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
24
|
export {};
|
|
22
25
|
//# 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;AAarC,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;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD,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,EACnB,YAAY,EAAE,YAAY,GAC3B,EAAE,KAAK,2CA0KP"}
|
|
@@ -9,10 +9,10 @@ import * as Utils from "./services/utils";
|
|
|
9
9
|
import message from "./services/messages";
|
|
10
10
|
import NoProduct from "./no-product";
|
|
11
11
|
import pagePlaceholder from "./images/page-placeholder.png";
|
|
12
|
-
import { Award, DownhillSkiing, File, Home, Smile, } from "dt-design-system/es/icons";
|
|
12
|
+
import { Clock, MapPin, Award, DownhillSkiing, File, Home, Smile, } from "dt-design-system/es/icons";
|
|
13
13
|
import css from "./products.module.css";
|
|
14
14
|
const PLACEHOLDERS = [...new Array(5)];
|
|
15
|
-
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions = {}, }) {
|
|
15
|
+
export default function Products({ lang, products, weekNumber, loading, sendPlausibleGoal, otherResultsRef, isOtherResultsEmpty, productOptions = {}, productImage: ProductImage, }) {
|
|
16
16
|
const { categoryField = "parentTitle", titleField = "pageTitle", subTitleField = "title", textField = "text", tagFields = ["time"], } = productOptions;
|
|
17
17
|
const filteredProducts = Utils.filterProducts(products, weekNumber);
|
|
18
18
|
const noProduct = !loading && !filteredProducts.length;
|
|
@@ -38,12 +38,27 @@ export default function Products({ lang, products, weekNumber, loading, sendPlau
|
|
|
38
38
|
const productPageTitle = Utils.getValueFromHit(product, titleField);
|
|
39
39
|
const productTitle = Utils.getValueFromHit(product, subTitleField);
|
|
40
40
|
const productText = textField !== false ? product.document[textField] : undefined;
|
|
41
|
+
const textImage = product.document["imageAlt"];
|
|
41
42
|
const showPrice = price !== undefined && weekNumber !== null;
|
|
42
43
|
const imagePlaceholderStategy = imagePlaceholder ? "blur" : "empty";
|
|
43
44
|
const showImage = Boolean(image);
|
|
44
|
-
|
|
45
|
+
const RenderedImage = () => {
|
|
46
|
+
if (textImage && ProductImage) {
|
|
47
|
+
return _jsx(ProductImage, { text: textImage });
|
|
48
|
+
}
|
|
49
|
+
return 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 }));
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(Link, { className: css.product, href: decodedPath, onClick: () => sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx(RenderedImage, {}), _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
52
|
const tagHtml = Utils.getValueFromHit(product, tagField);
|
|
46
|
-
|
|
53
|
+
const Icon = () => {
|
|
54
|
+
if (tagField === "time" ||
|
|
55
|
+
tagField === "meetingPoint" ||
|
|
56
|
+
tagField === "location") {
|
|
57
|
+
return tagField === "time" ? (_jsx(Clock, { className: css.productTagIcon })) : (_jsx(MapPin, { className: css.productTagIcon }));
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
return tagHtml ? (_jsxs("div", { className: css.productTag, children: [_jsx(Icon, {}), _jsx("div", { className: css.productTagText, dangerouslySetInnerHTML: { __html: tagHtml } })] })) : null;
|
|
47
62
|
}) }), productText && (_jsx("div", { className: css.productText, dangerouslySetInnerHTML: { __html: productText } })), showPrice && (_jsx("div", { className: css.productPrice, dangerouslySetInnerHTML: { __html: price } }))] })] }, id));
|
|
48
63
|
}), !noProduct && !isOtherResultsEmpty && (_jsx("div", { className: css.otherProducts, children: _jsxs(Button, { className: css.otherProductsButton, onClick: scrollToOtherResults, children: [message(lang, "showOtherResults"), _jsx(ArrowDownIcon, {})] }) }))] }));
|
|
49
64
|
}
|
|
@@ -154,17 +154,29 @@
|
|
|
154
154
|
font-size: 12px;
|
|
155
155
|
border-radius: var(--ds-radius-100, 6px);
|
|
156
156
|
}
|
|
157
|
+
|
|
157
158
|
.productTags {
|
|
158
159
|
display: flex;
|
|
159
|
-
flex-direction:
|
|
160
|
+
flex-direction: column;
|
|
160
161
|
gap: 4px;
|
|
161
162
|
flex-wrap: wrap;
|
|
162
|
-
|
|
163
|
-
align-items: center;
|
|
163
|
+
align-items: flex-start;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
.productTag {
|
|
167
|
-
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 5px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.productTagIcon {
|
|
173
|
+
height: 14px;
|
|
174
|
+
width: 14px;
|
|
175
|
+
fill: currentcolor;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.productTagText {
|
|
179
|
+
font-size: 9px;
|
|
168
180
|
text-transform: uppercase;
|
|
169
181
|
font-weight: 700;
|
|
170
182
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { LinkOptions } from "./links";
|
|
2
3
|
import { ProductOptions } from "./products";
|
|
3
4
|
type Document = {
|
|
@@ -9,6 +10,7 @@ type Document = {
|
|
|
9
10
|
parentTitle?: string;
|
|
10
11
|
path: string;
|
|
11
12
|
price?: string;
|
|
13
|
+
imageAlt?: string;
|
|
12
14
|
site: string;
|
|
13
15
|
text?: string;
|
|
14
16
|
time?: string;
|
|
@@ -77,7 +79,10 @@ type Props = {
|
|
|
77
79
|
sendPlausibleGoal: (path: string) => void;
|
|
78
80
|
loading: boolean;
|
|
79
81
|
resultsOptions?: ResultsOptions;
|
|
82
|
+
productImage?: React.ComponentType<{
|
|
83
|
+
text: string;
|
|
84
|
+
}>;
|
|
80
85
|
};
|
|
81
|
-
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, resultsOptions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, resultsOptions, productImage, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
82
87
|
export {};
|
|
83
88
|
//# 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":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQtD,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EA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EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,iBAAiB,EACjB,cAAmB,EACnB,YAAY,GACb,EAAE,KAAK,2CAkIP"}
|
|
@@ -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, resultsOptions = {}, }) {
|
|
13
|
+
export default function Results({ lang, text, results, weekNumber, openPeriodPicker, loading, sendPlausibleGoal, resultsOptions = {}, productImage, }) {
|
|
14
14
|
const ref = React.useRef(null);
|
|
15
15
|
const { grouped_hits: groupedHits = [] } = results || {};
|
|
16
16
|
const flattenedHits = groupedHits.reduce((acc, group) => {
|
|
@@ -40,5 +40,5 @@ export default function Results({ lang, text, results, weekNumber, openPeriodPic
|
|
|
40
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
41
|
...resultsOptions.linkOptions,
|
|
42
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 })] })] })) }));
|
|
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, productImage: productImage })] })] })) }));
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/instant-search/services/api.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAU,EACtB,OAAO,GAAE,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/instant-search/services/api.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAU,EACtB,OAAO,GAAE,MAA+F,EACxG,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,OAAO,gBAoBnB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Fetcher from "../../../../common/utils/fetcher";
|
|
2
2
|
const api = "https://search.ublo.app/api";
|
|
3
|
-
export function fetchResults(site, lang, query, groupLimit = 8, queryBy = "title,text,pageTitle,seoKeywords,parentTitle,seoTitle,meetingPoint", queryByWeights, semantic) {
|
|
3
|
+
export function fetchResults(site, lang, query, groupLimit = 8, queryBy = "title,subtitle,text,pageTitle,seoKeywords,parentTitle,seoTitle,meetingPoint,imageAlt", queryByWeights, semantic) {
|
|
4
4
|
const endpoint = `${api}/ublo-search/search/esf${semantic ? "/semantic" : ""}`;
|
|
5
5
|
return Fetcher.post(endpoint, {
|
|
6
6
|
q: query,
|
|
@@ -11,5 +11,6 @@ export function fetchResults(site, lang, query, groupLimit = 8, queryBy = "title
|
|
|
11
11
|
: undefined,
|
|
12
12
|
group_limit: groupLimit,
|
|
13
13
|
per_page: 30,
|
|
14
|
+
exhaustive_search: true,
|
|
14
15
|
}, { site, lang });
|
|
15
16
|
}
|
|
@@ -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,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,
|
|
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,SAmBxE"}
|
|
@@ -27,9 +27,10 @@ export function filterProducts(products, weekNumber) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
return products.reduce((acc, product) => {
|
|
30
|
-
const { image, pageTitle } = product.document;
|
|
30
|
+
const { image, pageTitle, imageAlt } = product.document;
|
|
31
31
|
const isAlreadyInAcc = acc.some((item) => {
|
|
32
32
|
return (normalizeImage(item.document.image) === normalizeImage(image) &&
|
|
33
|
+
item.document.imageAlt === imageAlt &&
|
|
33
34
|
item.document.pageTitle === pageTitle);
|
|
34
35
|
});
|
|
35
36
|
if (isAlreadyInAcc)
|