ublo-lib 1.38.45 → 1.39.0
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/gesco-contact-form/gesco-contact-form.d.ts +1 -2
- package/es/common/components/gesco-contact-form/gesco-contact-form.d.ts.map +1 -1
- package/es/common/components/gesco-contact-form/gesco-contact-form.js +7 -7
- package/es/market-place/components/instant-search/google-results.d.ts +9 -0
- package/es/market-place/components/instant-search/google-results.d.ts.map +1 -0
- package/es/market-place/components/instant-search/google-results.js +24 -0
- package/es/market-place/components/instant-search/google-results.module.css +109 -0
- package/es/market-place/components/instant-search/hooks/use-constant.d.ts +2 -0
- package/es/market-place/components/instant-search/hooks/use-constant.d.ts.map +1 -0
- package/es/market-place/components/instant-search/hooks/use-constant.js +8 -0
- package/es/market-place/components/instant-search/hooks/use-debounced-search.d.ts +7 -0
- package/es/market-place/components/instant-search/hooks/use-debounced-search.d.ts.map +1 -0
- package/es/market-place/components/instant-search/hooks/use-debounced-search.js +11 -0
- package/es/market-place/components/instant-search/hooks/use-google-search.d.ts +7 -0
- package/es/market-place/components/instant-search/hooks/use-google-search.d.ts.map +1 -0
- package/es/market-place/components/instant-search/hooks/use-google-search.js +7 -0
- package/es/market-place/components/instant-search/hooks/use-search.d.ts +17 -0
- package/es/market-place/components/instant-search/hooks/use-search.d.ts.map +1 -0
- package/es/market-place/components/instant-search/hooks/use-search.js +10 -0
- package/es/market-place/components/instant-search/i18n.json +67 -0
- package/es/market-place/components/instant-search/index.d.ts +3 -0
- package/es/market-place/components/instant-search/index.d.ts.map +1 -0
- package/es/market-place/components/instant-search/index.js +2 -0
- package/es/market-place/components/instant-search/instant-search.d.ts +14 -0
- package/es/market-place/components/instant-search/instant-search.d.ts.map +1 -0
- package/es/market-place/components/instant-search/instant-search.js +66 -0
- package/es/market-place/components/instant-search/instant-search.module.css +16 -0
- package/es/market-place/components/instant-search/links.d.ts +11 -0
- package/es/market-place/components/instant-search/links.d.ts.map +1 -0
- package/es/market-place/components/instant-search/links.js +31 -0
- package/es/market-place/components/instant-search/links.module.css +97 -0
- package/es/market-place/components/instant-search/no-product.d.ts +6 -0
- package/es/market-place/components/instant-search/no-product.d.ts.map +1 -0
- package/es/market-place/components/instant-search/no-product.js +4 -0
- package/es/market-place/components/instant-search/products.d.ts +13 -0
- package/es/market-place/components/instant-search/products.d.ts.map +1 -0
- package/es/market-place/components/instant-search/products.js +54 -0
- package/es/market-place/components/instant-search/products.module.css +169 -0
- package/es/market-place/components/instant-search/results.d.ts +20 -0
- package/es/market-place/components/instant-search/results.d.ts.map +1 -0
- package/es/market-place/components/instant-search/results.js +47 -0
- package/es/market-place/components/instant-search/results.module.css +95 -0
- package/es/market-place/components/instant-search/search-input.d.ts +15 -0
- package/es/market-place/components/instant-search/search-input.d.ts.map +1 -0
- package/es/market-place/components/instant-search/search-input.js +56 -0
- package/es/market-place/components/instant-search/search-input.module.css +87 -0
- package/es/market-place/components/instant-search/services/api.d.ts +17 -0
- package/es/market-place/components/instant-search/services/api.d.ts.map +1 -0
- package/es/market-place/components/instant-search/services/api.js +24 -0
- package/es/market-place/components/instant-search/services/messages.d.ts +2 -0
- package/es/market-place/components/instant-search/services/messages.d.ts.map +1 -0
- package/es/market-place/components/instant-search/services/messages.js +5 -0
- package/es/market-place/components/instant-search/services/utils.d.ts +4 -0
- package/es/market-place/components/instant-search/services/utils.d.ts.map +1 -0
- package/es/market-place/components/instant-search/services/utils.js +44 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
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 filterProducts(products, weekNumber) {
|
|
18
|
+
if (weekNumber !== null) {
|
|
19
|
+
return products.filter((product) => {
|
|
20
|
+
const { weeks = [] } = product.document;
|
|
21
|
+
return weeks.length === 0 || weeks.includes(weekNumber);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return products.reduce((acc, product) => {
|
|
25
|
+
const { image, pageTitle } = product.document;
|
|
26
|
+
const isAlreadyInAcc = acc.some((item) => {
|
|
27
|
+
return (normalizeImage(item.document.image) === normalizeImage(image) &&
|
|
28
|
+
item.document.pageTitle === pageTitle);
|
|
29
|
+
});
|
|
30
|
+
if (isAlreadyInAcc)
|
|
31
|
+
return acc;
|
|
32
|
+
return [...acc, product];
|
|
33
|
+
}, []);
|
|
34
|
+
}
|
|
35
|
+
export function sliceText(text) {
|
|
36
|
+
if (!text)
|
|
37
|
+
return;
|
|
38
|
+
return text?.slice(0, 30) + "...";
|
|
39
|
+
}
|
|
40
|
+
function normalizeImage(image) {
|
|
41
|
+
if (!image)
|
|
42
|
+
return "";
|
|
43
|
+
return image.replace(/(-[0-9]+)?.(jpg|jpeg|png|gif)/, "");
|
|
44
|
+
}
|