import { Schema } from '@coveo/bueno'; import type { SearchEngine } from '../../app/search-engine/search-engine.js'; import { type Controller } from '../controller/headless-controller.js'; export interface UrlManagerProps { /** * The initial state that should be applied to the `UrlManager` controller. */ initialState: UrlManagerInitialState; } export interface UrlManagerInitialState { /** * The part of the url that contains search parameters. * For example: `q=windmill&f[author]=Cervantes`. */ fragment: string; } export declare const initialStateSchema: Schema>; /** * The `UrlManager` controller can parse an url fragment to extract search parameters which affect the search response. * * Example: [url-manager.ts](https://github.com/coveo/ui-kit/blob/main/samples/headless/search-react/src/components/url-manager/url-manager.ts) * * @group Controllers * @category UrlManager * */ export interface UrlManager extends Controller { /** * The state relevant to the `UrlManager` controller. * */ state: UrlManagerState; /** * Updates the search parameters in state with those from the url and launches a search. * @param fragment The part of the url that contains search parameters. For example: `q=windmill&f[author]=Cervantes`. */ synchronize(fragment: string): void; } /** * A scoped and simplified part of the Headless state that is relevant to the `UrlManager` controller. * * @group Controllers * @category UrlManager */ export interface UrlManagerState { /** * The part of the url that contains search parameters. * For example: `q=windmill&f[author]=Cervantes`. */ fragment: string; } /** * Creates a `UrlManager` controller instance. * * @param engine - The headless engine. * @param props - The configurable `UrlManager` properties. * @returns A `UrlManager` controller instance. * * @group Controllers * @category UrlManager */ export declare function buildUrlManager(engine: SearchEngine, props: UrlManagerProps): UrlManager;