import type { SearchEngine } from '../../app/search-engine/search-engine.js'; import type { StateWithHistory } from '../../app/undoable.js'; import type { HistoryState } from '../../features/history/history-state.js'; import { type Controller } from '../controller/headless-controller.js'; /** * The `HistoryManager` controller is in charge of allowing navigating back and forward in the search interface history. * * Example: [history-manager.fn.tsx](https://github.com/coveo/ui-kit/blob/main/samples/headless/search-react/src/components/history-manager/history-manager.fn.tsx) * * @group Controllers * @category HistoryManager */ export interface HistoryManager extends Controller { /** * Move backward in the interface history. * * @returns A promise that resolves when the previous state has been restored. */ back(): Promise; /** * Move forward in the interface history. * * @returns A promise that resolves when the next state has been restored. */ forward(): Promise; /** * Move backward in the interface history when there are no results. * * @returns A promise that resolves when the previous state has been restored. */ backOnNoResults(): Promise; /** * The state relevant to the `HistoryManager` controller. * */ state: HistoryManagerState; } /** * A scoped and simplified part of the headless state that is relevant to the `HistoryManager` controller. * * @group Controllers * @category HistoryManager */ export type HistoryManagerState = StateWithHistory; /** * Creates a `HistoryManager` controller instance. * * @param engine - The headless engine. * @returns A `HistoryManager` controller instance. * * @group Controllers * @category HistoryManager */ export declare function buildHistoryManager(engine: SearchEngine): HistoryManager;