// Copyright © 2022-2026 Partium, Inc. DBA Partium import { Observable } from 'rxjs'; import { ServiceProvider } from '../../../core/services/service-provider'; import { PartiumConfig } from '../../../core/models/partium-config'; import { BaseLoginInitService } from '../../../core/services/base-login-init.service'; import { Organization } from '../../../core'; /** * Service that provides functions for maintaining the recent text searches. * Recent search queries can be managed in a stack and will be stored * in local storage for later sessions. */ export interface RecentTextSearchQueriesService { /** * Add new query to the recent queries * @param query the query to add */ addQuery(query: string): void; /** * Add new query to the recent queries * The query will be added as semantic query * @param query the query to add * @deprecated use addQuery instead */ addSemanticTextQuery(query: string): void; /** * Add new query to the recent queries * The query will be added as exact query * @param query the query to add * @deprecated use addQuery instead */ addExactTextQuery(query: string): void; /** * Get the recent text search queries as observable, but only after init is finished. * @returns Observable that emits every time the recent search query changes */ getQueries(): Observable; /** * Get the recent semantic text search queries as observable, but only after init is finished. * @returns Observable that emits every time the recent search query changes * @deprecated use getQueries instead */ getSemanticTextQueries$(): Observable; /** * Get the recent exact text search queries as observable, but only after init is finished. * @returns Observable that emits every time the recent search query changes * @deprecated use getQueries instead */ getExactTextQueries$(): Observable; /** * Reset the service * Called on logout */ reset(): void; } export declare class RecentTextSearchQueriesServiceImpl extends BaseLoginInitService implements RecentTextSearchQueriesService { private RECENT_QUERIES_STORE_COUNT; private localStorageService; private readonly recentSearchQueries$; private readonly recentSemanticTextQueries$; private readonly recentExactTextQueries$; private initFinished$; private initFinishedResolve; constructor(serviceProvider: ServiceProvider); onCreate(): void; /** * Called on login */ init(config: PartiumConfig, userEmail: string, currentOrganization$: Observable): Observable; addQuery(query: string): Promise; addSemanticTextQuery(query: string): Promise; addExactTextQuery(query: string): Promise; getQueries(): Observable; getSemanticTextQueries$(): Observable; getExactTextQueries$(): Observable; reset(): void; private addQueryToLocalStorage; /** * Loads the recent parts from local storage and returns them. * * @return array that contains the ids of the recent parts loaded from the localstorage */ private loadRecentQueries; /** * Loads the recent queries from local storage and returns them. * * @return array that contains the loaded recent text-search queries */ private getQueriesFromLocalStorage; }