import type { SearchEngine } from '../../app/search-engine/search-engine.js'; import type { StandaloneSearchBoxAnalytics } from '../../features/standalone-search-box-set/standalone-search-box-set-state.js'; import { type SearchBox, type SearchBoxState } from '../search-box/headless-search-box.js'; import { type StandaloneSearchBoxOptions } from './headless-standalone-search-box-options.js'; export type { StandaloneSearchBoxAnalytics, StandaloneSearchBoxOptions }; export interface StandaloneSearchBoxProps { options: StandaloneSearchBoxOptions; } /** * The `StandaloneSearchBox` headless controller offers a high-level interface for designing a common search box UI controller. * Meant to be used for a search box that will redirect instead of executing a query. * * Example: [standalone-search-box.fn.tsx](https://github.com/coveo/ui-kit/blob/main/samples/headless/search-react/src/components/standalone-search-box/standalone-search-box.fn.tsx) * * @group Controllers * @category StandaloneSearchBox */ export interface StandaloneSearchBox extends SearchBox { /** * Triggers a redirection. */ submit(): void; /** * Updates the redirection url of the standalone search box. * @param url - The new URL to redirect to. */ updateRedirectUrl(url: string): void; /** * Resets the standalone search box state. To be dispatched on single page applications after the redirection has been triggered. */ afterRedirection(): void; /** * A scoped and simplified part of the headless state that is relevant to the `StandaloneSearchBox` controller. */ state: StandaloneSearchBoxState; } /** * A scoped and simplified part of the headless state that is relevant to the `StandaloneSearchBox` controller. * * @group Controllers * @category StandaloneSearchBox */ export interface StandaloneSearchBoxState extends SearchBoxState { /** * The analytics data to send when performing the first query on the search page the user is redirected to. */ analytics: StandaloneSearchBoxAnalytics; /** * The Url to redirect to. */ redirectTo: string; } /** * Creates a `StandaloneSearchBox` instance. * * @param engine - The headless engine. * @param props - The configurable `StandaloneSearchBox` properties. * @returns A `StandaloneSearchBox` instance. * * @group Controllers * @category StandaloneSearchBox */ export declare function buildStandaloneSearchBox(engine: SearchEngine, props: StandaloneSearchBoxProps): StandaloneSearchBox;