File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22import { getLangFromUrl } from " @/i18n/utils" ;
33import type { LanguageKey } from " @/i18n/types" ;
4- import type { SearchResult } from ' ../../features/search/EnterpriseSearchEngine.js' ;
4+ import EnterpriseSearchEngine , { type SearchResult } from ' ../../features/search/EnterpriseSearchEngine' ;
5+ import { searchIntegration } from ' ../../features/search/searchIntegration' ;
56---
67
78<section
@@ -67,7 +68,8 @@ import type { SearchResult } from '../../features/search/EnterpriseSearchEngine.
6768 }
6869
6970 const searchEngine = new EnterpriseSearchEngine();
70- const searchIntegration = new SearchIntegration(); // Although not directly used here, it's good to have it initialized if needed elsewhere.
71+ // Use the already exported instance of searchIntegration
72+ // const searchIntegration = new SearchIntegration();
7173
7274 let allDocuments = [];
7375
@@ -161,7 +163,7 @@ import type { SearchResult } from '../../features/search/EnterpriseSearchEngine.
161163 // Close overlay when clicking outside the content area
162164 searchOverlay.addEventListener("click", (event) => {
163165 const contentArea = searchOverlay.querySelector(".w-full.max-w-3xl");
164- if (contentArea && !contentArea.contains(event.target as Node )) {
166+ if (contentArea && !contentArea.contains(event.target)) {
165167 toggleSearchOverlay(false);
166168 }
167169 });
Original file line number Diff line number Diff line change @@ -100,7 +100,9 @@ class EnterpriseSearchEngine {
100100 ] ) ;
101101
102102 constructor ( ) {
103- this . loadAnalyticsFromStorage ( ) ;
103+ if ( typeof window !== 'undefined' ) {
104+ this . loadAnalyticsFromStorage ( ) ;
105+ }
104106 }
105107
106108 /**
@@ -634,6 +636,7 @@ class EnterpriseSearchEngine {
634636 }
635637
636638 private loadAnalyticsFromStorage ( ) : void {
639+ if ( typeof window === 'undefined' ) return ;
637640 try {
638641 const stored = localStorage . getItem ( "search-analytics" ) ;
639642 if ( stored ) {
@@ -650,6 +653,7 @@ class EnterpriseSearchEngine {
650653 }
651654
652655 private saveAnalyticsToStorage ( ) : void {
656+ if ( typeof window === 'undefined' ) return ;
653657 try {
654658 localStorage . setItem ( "search-analytics" , JSON . stringify ( this . analytics ) ) ;
655659 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments