@fluid-topics/ft-search-context 1.1.37 → 1.1.39
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/build/ft-search-context.d.ts +2 -0
- package/build/ft-search-context.js +5 -1
- package/build/ft-search-context.light.js +4 -4
- package/build/ft-search-context.min.js +17 -17
- package/build/store/FtSearchStateManager.d.ts +4 -6
- package/build/store/FtSearchStateManager.js +8 -14
- package/build/store/utils/FtSearchService.d.ts +4 -6
- package/build/store/utils/FtSearchService.js +4 -9
- package/package.json +5 -5
|
@@ -10,15 +10,13 @@ export declare class ClearAllFiltersEvent extends Event {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class FtSearchStateManager {
|
|
12
12
|
store: FtReduxStore<FtSearchPageState, FtSearchPageStateReducers>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
service?: FtSearchService;
|
|
13
|
+
static build(id: string, service?: FtSearchService): FtSearchStateManager;
|
|
14
|
+
service: FtSearchService;
|
|
16
15
|
errorHandler?: (e: Error) => void;
|
|
17
16
|
ignoreEmptyQuery: boolean;
|
|
18
17
|
openExternalDocumentInNewTab: boolean;
|
|
19
|
-
constructor(store: FtReduxStore<FtSearchPageState, FtSearchPageStateReducers>,
|
|
18
|
+
constructor(store: FtReduxStore<FtSearchPageState, FtSearchPageStateReducers>, service?: FtSearchService);
|
|
20
19
|
initService(): Promise<boolean>;
|
|
21
|
-
awaitService(): Promise<FtSearchService>;
|
|
22
20
|
setQuery(query: string): void;
|
|
23
21
|
setContentLocale(contentLocale?: string): string | undefined;
|
|
24
22
|
setPageSize(pageSize: number): void;
|
|
@@ -41,7 +39,7 @@ export declare class FtSearchStateManager {
|
|
|
41
39
|
private searchDebouncer;
|
|
42
40
|
launchSearch(): Promise<boolean>;
|
|
43
41
|
private suggestDebouncer;
|
|
44
|
-
launchSuggest(): Promise<
|
|
42
|
+
launchSuggest(): Promise<boolean>;
|
|
45
43
|
private cancelableSearch;
|
|
46
44
|
private fetchSearchData;
|
|
47
45
|
private cancelableSuggest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cancelable, CanceledPromiseError, Debouncer
|
|
1
|
+
import { cancelable, CanceledPromiseError, Debouncer } from "@fluid-topics/ft-wc-utils";
|
|
2
2
|
import { createSearchPageStore } from "./redux";
|
|
3
3
|
import { FtSearchScope, FtVirtualField } from "@fluid-topics/public-api";
|
|
4
4
|
import { FtSearchService } from "./utils/FtSearchService";
|
|
@@ -12,25 +12,21 @@ class ClearAllFiltersEvent extends Event {
|
|
|
12
12
|
ClearAllFiltersEvent.eventName = "search-context-clear-all-filters";
|
|
13
13
|
export { ClearAllFiltersEvent };
|
|
14
14
|
export class FtSearchStateManager {
|
|
15
|
-
static build(id) {
|
|
16
|
-
return new FtSearchStateManager(createSearchPageStore(id.trim() || "context"),
|
|
15
|
+
static build(id, service) {
|
|
16
|
+
return new FtSearchStateManager(createSearchPageStore(id.trim() || "context"), service);
|
|
17
17
|
}
|
|
18
|
-
constructor(store,
|
|
18
|
+
constructor(store, service) {
|
|
19
19
|
this.store = store;
|
|
20
|
-
this.serviceProvider = serviceProvider;
|
|
21
20
|
this.ignoreEmptyQuery = false;
|
|
22
21
|
this.openExternalDocumentInNewTab = false;
|
|
23
22
|
this.searchDebouncer = new Debouncer(100);
|
|
24
23
|
this.suggestDebouncer = new Debouncer(300);
|
|
24
|
+
this.service = service !== null && service !== void 0 ? service : new FtSearchService();
|
|
25
25
|
}
|
|
26
26
|
async initService() {
|
|
27
|
-
this.service = await this.serviceProvider();
|
|
28
27
|
this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales);
|
|
29
28
|
return this.launchSearch();
|
|
30
29
|
}
|
|
31
|
-
async awaitService() {
|
|
32
|
-
return waitFor(() => this.service);
|
|
33
|
-
}
|
|
34
30
|
setQuery(query) {
|
|
35
31
|
this.store.actions.setRequestQuery(query);
|
|
36
32
|
this.store.actions.setLiveQuery(query);
|
|
@@ -144,13 +140,11 @@ export class FtSearchStateManager {
|
|
|
144
140
|
setOpenExternalDocumentInNewTab(openExternalDocumentInNewTab) {
|
|
145
141
|
this.openExternalDocumentInNewTab = openExternalDocumentInNewTab;
|
|
146
142
|
}
|
|
147
|
-
|
|
148
|
-
await this.awaitService();
|
|
143
|
+
launchSearch() {
|
|
149
144
|
return this.searchDebouncer.run(() => this.fetchSearchData());
|
|
150
145
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.suggestDebouncer.run(() => this.fetchSuggestData());
|
|
146
|
+
launchSuggest() {
|
|
147
|
+
return this.suggestDebouncer.run(() => this.fetchSuggestData());
|
|
154
148
|
}
|
|
155
149
|
async fetchSearchData() {
|
|
156
150
|
var _a, _b;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
private cache;
|
|
6
|
-
constructor(api: FluidTopicsApi);
|
|
1
|
+
import type { FtSearchLocales, FtSearchRequest, FtSearchResults, FtSuggestRequest, FtSuggestResults } from "@fluid-topics/public-api";
|
|
2
|
+
import { FtServiceWithCache } from "@fluid-topics/ft-app-context";
|
|
3
|
+
export declare class FtSearchService extends FtServiceWithCache {
|
|
4
|
+
constructor();
|
|
7
5
|
launchSearch(request: FtSearchRequest): Promise<FtSearchResults>;
|
|
8
6
|
launchSuggest(request: FtSuggestRequest): Promise<FtSuggestResults>;
|
|
9
7
|
getAvailableSearchLocales(): Promise<FtSearchLocales>;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return new FtSearchService(await FluidTopicsApiProvider.await());
|
|
6
|
-
}
|
|
7
|
-
constructor(api) {
|
|
8
|
-
this.api = api;
|
|
9
|
-
this.cache = new CacheRegistry();
|
|
1
|
+
import { FtServiceWithCache } from "@fluid-topics/ft-app-context";
|
|
2
|
+
export class FtSearchService extends FtServiceWithCache {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
10
5
|
this.cache.registerFinal("available-locales", () => this.api.getAvailableSearchLocales());
|
|
11
6
|
}
|
|
12
7
|
async launchSearch(request) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-context",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39",
|
|
4
4
|
"description": "Context block for integrated search components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.39",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.1.39",
|
|
24
24
|
"lit": "3.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@fluid-topics/public-api": "1.0.
|
|
27
|
+
"@fluid-topics/public-api": "1.0.60"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a9b7f979a6e94b58571a61de90a4b2655800690d"
|
|
30
30
|
}
|