@codecademy/brand 3.36.2-alpha.7b9e1afbb4.0 → 3.36.2-alpha.89d0f59c01.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/dist/AppHeader/Search/SearchButton.js +0 -29
- package/dist/AppHeader/Search/SearchPane.js +9 -42
- package/dist/AppHeader/Search/SearchWorker/index.js +7 -55
- package/dist/AppHeader/Search/SearchWorker/src.js +20 -64
- package/dist/AppHeader/Search/SearchWorker/worker.js +23 -70
- package/dist/AppHeader/Search/safelyRedirect.js +11 -50
- package/package.json +1 -1
|
@@ -6,27 +6,17 @@ import { useSearchTrackingContext } from './SearchTrackingProvider';
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
let autocompleteCacheWarmed = false;
|
|
8
8
|
function warmAutocompleteCache() {
|
|
9
|
-
// eslint-disable-next-line no-console
|
|
10
|
-
console.log('[warmAutocompleteCache] Called, autocompleteCacheWarmed:', autocompleteCacheWarmed);
|
|
11
9
|
if (typeof window !== 'undefined' && !autocompleteCacheWarmed) {
|
|
12
10
|
autocompleteCacheWarmed = true;
|
|
13
11
|
const {
|
|
14
12
|
search
|
|
15
13
|
} = window.location;
|
|
16
14
|
const apiUrl = `/api/portal/search/autocomplete-preload${search}`;
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.log('[warmAutocompleteCache] Warming cache with URL:', apiUrl);
|
|
19
15
|
const headers = {
|
|
20
16
|
'Warm-Only': 'true'
|
|
21
17
|
};
|
|
22
18
|
fetch(apiUrl, {
|
|
23
19
|
headers
|
|
24
|
-
}).then(() => {
|
|
25
|
-
// eslint-disable-next-line no-console
|
|
26
|
-
console.log('[warmAutocompleteCache] Cache warmed successfully');
|
|
27
|
-
}).catch(error => {
|
|
28
|
-
// eslint-disable-next-line no-console
|
|
29
|
-
console.error('[warmAutocompleteCache] Error warming cache:', error);
|
|
30
20
|
});
|
|
31
21
|
}
|
|
32
22
|
}
|
|
@@ -37,27 +27,17 @@ export const SearchButton = ({
|
|
|
37
27
|
toggleSearch,
|
|
38
28
|
onSearchAsYouType
|
|
39
29
|
}) => {
|
|
40
|
-
// eslint-disable-next-line no-console
|
|
41
|
-
console.log('[SearchButton] Rendering, isSearchVisible:', isSearchVisible);
|
|
42
30
|
const {
|
|
43
31
|
lastOpenedDropdown,
|
|
44
32
|
setLastOpenedDropdown
|
|
45
33
|
} = useAppHeaderContext();
|
|
46
|
-
// eslint-disable-next-line no-console
|
|
47
|
-
console.log('[SearchButton] lastOpenedDropdown:', lastOpenedDropdown);
|
|
48
34
|
const {
|
|
49
35
|
onSearchAsYouTypeParams
|
|
50
36
|
} = useSearchTrackingContext();
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
|
-
console.log('[SearchButton] onSearchAsYouTypeParams:', onSearchAsYouTypeParams);
|
|
53
37
|
const expandedToggleSearch = () => {
|
|
54
|
-
// eslint-disable-next-line no-console
|
|
55
|
-
console.log('[SearchButton.expandedToggleSearch] Called, isSearchVisible:', isSearchVisible);
|
|
56
38
|
// if the search pane is visible (about to be closed) and there are search params with a query,
|
|
57
39
|
// trigger the search event before toggling
|
|
58
40
|
if (isSearchVisible && onSearchAsYouType && onSearchAsYouTypeParams && onSearchAsYouTypeParams.query) {
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
|
-
console.log('[SearchButton.expandedToggleSearch] Triggering search event with params:', onSearchAsYouTypeParams);
|
|
61
41
|
const {
|
|
62
42
|
query,
|
|
63
43
|
searchId,
|
|
@@ -66,22 +46,13 @@ export const SearchButton = ({
|
|
|
66
46
|
} = onSearchAsYouTypeParams;
|
|
67
47
|
onSearchAsYouType(query, searchId, resultsCount, queryLoadTime);
|
|
68
48
|
}
|
|
69
|
-
|
|
70
|
-
// eslint-disable-next-line no-console
|
|
71
|
-
console.log('[SearchButton.expandedToggleSearch] Toggling search');
|
|
72
49
|
toggleSearch();
|
|
73
50
|
if (!isSearchVisible && setLastOpenedDropdown) {
|
|
74
|
-
// eslint-disable-next-line no-console
|
|
75
|
-
console.log('[SearchButton.expandedToggleSearch] Setting last opened dropdown to search');
|
|
76
51
|
setLastOpenedDropdown('search');
|
|
77
52
|
}
|
|
78
53
|
};
|
|
79
54
|
useEffect(() => {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
console.log('[SearchButton.useEffect] lastOpenedDropdown changed to:', lastOpenedDropdown, 'isSearchVisible:', isSearchVisible);
|
|
82
55
|
if (lastOpenedDropdown !== 'search' && isSearchVisible) {
|
|
83
|
-
// eslint-disable-next-line no-console
|
|
84
|
-
console.log('[SearchButton.useEffect] Closing search pane');
|
|
85
56
|
setIsSearchVisible(false);
|
|
86
57
|
}
|
|
87
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|