import type { QueryCorrection, WordCorrection } from '../../../../api/search/search/query-corrections.js'; import type { CommerceEngine } from '../../../../app/commerce-engine/commerce-engine.js'; import { type Controller } from '../../../controller/headless-controller.js'; import type { DidYouMeanState } from '../../../did-you-mean/headless-did-you-mean.js'; export type { DidYouMeanState, QueryCorrection, WordCorrection }; /** * The `DidYouMean` controller is responsible for handling query corrections. * * @group Sub-controllers * @category DidYouMean */ export interface DidYouMean extends Controller { /** * Executes a search using the suggested query correction. * * Typically, you only call this method when `state.hasQueryCorrection` is `true` and `state.wasAutomaticallyCorrected` is `false`. * When this is the case, you could call this method when the user clicks a link to search with the suggested query correction rather than * with the query they originally submitted. */ applyCorrection(): void; /** * A scoped and simplified part of the headless state that is relevant to the `DidYouMean` controller. */ state: DidYouMeanState; } export interface DidYouMeanOptions { /** * When set to true, fills the `results` field rather than the `products` field * in the response. It may also include Spotlight Content in the results. * @default false */ enableResults?: boolean; } /** * The `DidYouMean` controller is responsible for handling query corrections. * * @param engine - The commerce engine. * @param options - The configurable `DidYouMean` options. * @returns A `DidYouMean` controller. * * @group Sub-controllers * @category DidYouMean */ export declare function buildDidYouMean(engine: CommerceEngine, options?: DidYouMeanOptions): DidYouMean;