ublo-lib 1.36.20 → 1.36.22
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/lbm/components/instant-search/hooks/use-google-search.d.ts.map +1 -1
- package/es/lbm/components/instant-search/hooks/use-google-search.js +0 -1
- package/es/lbm/components/instant-search/results.d.ts.map +1 -1
- package/es/lbm/components/instant-search/results.js +0 -9
- package/es/lbm/components/instant-search/services/google-search-api.d.ts.map +1 -1
- package/es/lbm/components/instant-search/services/google-search-api.js +6 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-google-search.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/hooks/use-google-search.ts"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,eAAe;;;;;;
|
|
1
|
+
{"version":3,"file":"use-google-search.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/hooks/use-google-search.ts"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,eAAe;;;;;;EAItC"}
|
|
@@ -2,7 +2,6 @@ import useDebouncedSearch from "./use-debounced-search";
|
|
|
2
2
|
import * as GoogleAPI from "../services/google-search-api";
|
|
3
3
|
export default function useGoogleSearch() {
|
|
4
4
|
return useDebouncedSearch(async (query) => {
|
|
5
|
-
console.log("Fetching Google search results for query:", query);
|
|
6
5
|
return GoogleAPI.fetchOTResults(query);
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/results.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/results.tsx"],"names":[],"mappings":"AAaA,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBA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AE,KAAK,2CAiIP"}
|
|
@@ -30,17 +30,8 @@ export default function Results({ lang, text, facet, setFacet, results, loading,
|
|
|
30
30
|
document: [],
|
|
31
31
|
"msem-widget": [],
|
|
32
32
|
});
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
const runEffect = () => {
|
|
35
|
-
setGoogleText(text);
|
|
36
|
-
console.log("text", text);
|
|
37
|
-
console.log("sortedHits", sortedHits);
|
|
38
|
-
};
|
|
39
|
-
runEffect();
|
|
40
|
-
}, [text, sortedHits, setGoogleText]);
|
|
41
33
|
const { page: pages, product: products, information, faq: faqs, widget: widgets, document: documents, "msem-widget": msemWidgets, lodging: lodgings, } = sortedHits;
|
|
42
34
|
const isOtherResultsEmpty = !(pages.length || information.length);
|
|
43
35
|
const countLabel = message(lang, "results");
|
|
44
|
-
console.log("googleSearch", googleSearch);
|
|
45
36
|
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: [_jsxs("div", { className: css.facet, children: [countLabel, " ", _jsx(FacetSwitch, { lang: lang, facet: facet, setFacet: setFacet })] }), _jsx(Links, { linksTitle: message(lang, "pages"), icon: "File", links: pages, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "documents"), icon: "FileText", links: documents, loading: loading, sendPlausibleGoal: sendPlausibleGoal }), _jsx(Links, { linksTitle: message(lang, "information"), icon: "Info", links: information, loading: loading, sendPlausibleGoal: sendPlausibleGoal })] }), _jsxs("div", { className: css.right, children: [_jsx(Widgets, { lang: lang, widgets: [...widgets, ...msemWidgets, ...lodgings], loading: loading, sendPlausibleGoal: sendPlausibleGoal, faqsMaximized: faqsMaximized }), _jsx(Products, { lang: lang, products: products, loading: loading, sendPlausibleGoal: sendPlausibleGoal, otherResultsRef: ref, isOtherResultsEmpty: isOtherResultsEmpty, faqsMaximized: faqsMaximized }), _jsx(GoogleProducts, { products: googleSearch.result, loading: googleSearch.loading, sendPlausibleGoal: sendPlausibleGoal, faqsMaximized: faqsMaximized }), _jsx(Faqs, { lang: lang, faqs: faqs, loading: loading, sendPlausibleGoal: sendPlausibleGoal, maximized: faqsMaximized, setMaximized: setFaqsMaximized })] })] })) }));
|
|
46
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-search-api.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/google-search-api.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE;YACP,SAAS,EAAE;gBACT,GAAG,EAAE,MAAM,CAAC;aACb,EAAE,CAAC;YACJ,aAAa,EAAE;gBACb,GAAG,EAAE,MAAM,CAAC;aACb,EAAE,CAAC;SACL,CAAC;KACH,EAAE,CAAC;CACL,CAAC;AAEF,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"google-search-api.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/google-search-api.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE;YACP,SAAS,EAAE;gBACT,GAAG,EAAE,MAAM,CAAC;aACb,EAAE,CAAC;YACJ,aAAa,EAAE;gBACb,GAAG,EAAE,MAAM,CAAC;aACb,EAAE,CAAC;SACL,CAAC;KACH,EAAE,CAAC;CACL,CAAC;AAEF,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,wCAejD"}
|
|
@@ -4,15 +4,18 @@ const { serverRuntimeConfig, publicRuntimeConfig } = getConfig();
|
|
|
4
4
|
const { googleApiKey, googleApiCx } = serverRuntimeConfig;
|
|
5
5
|
const { googleApi, googleSites } = publicRuntimeConfig;
|
|
6
6
|
export async function fetchOTResults(query) {
|
|
7
|
-
if (googleSites.length === 0 || !googleApi || !googleApiCx || !googleApiKey)
|
|
7
|
+
if (googleSites.length === 0 || !googleApi || !googleApiCx || !googleApiKey) {
|
|
8
|
+
console.error("Google search correctly not configured");
|
|
8
9
|
return [];
|
|
10
|
+
}
|
|
9
11
|
const endpoint = `${googleApi}/customsearch/v1`;
|
|
10
|
-
|
|
12
|
+
const res = (await Fetcher.get(endpoint, {
|
|
11
13
|
q: query,
|
|
12
14
|
key: googleApiKey,
|
|
13
15
|
cx: googleApiCx,
|
|
14
16
|
siteSearch: googleSites[0],
|
|
15
17
|
siteSearchType: "i",
|
|
16
18
|
num: 3,
|
|
17
|
-
});
|
|
19
|
+
}));
|
|
20
|
+
return res;
|
|
18
21
|
}
|