import type { SerializedError } from '@reduxjs/toolkit';
import type { CommerceAPIErrorResponse } from '../../../api/commerce/commerce-api-error-response.js';
import type { ChildProduct, Product } from '../../../api/commerce/common/product.js';
import type { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
import { type Controller } from '../../controller/headless-controller.js';
import { type InteractiveProduct, type InteractiveProductProps } from '../core/interactive-product/headless-core-interactive-product.js';
export interface InstantProductsOptions {
    /**
     * A unique identifier for the search box.
     */
    searchBoxId?: string;
    /**
     * Number in milliseconds that cached products will be valid for. Defaults to 1 minute. Set to 0 so that products never expire.
     */
    cacheTimeout?: number;
}
export interface InstantProductsProps {
    options: InstantProductsOptions;
}
/**
 * The `InstantProducts` controller allows the end user to manage instant products queries.
 *
 * @group Buildable controllers
 * @category InstantProducts
 */
export interface InstantProducts extends Controller {
    /**
     * Updates the specified query and shows instant products for it.
     *
     * @param query - The query to get instant products for. For more precise instant products, query suggestions are recommended.
     */
    updateQuery(query: string): void;
    /**
     * Clears all expired instant products queries.
     */
    clearExpired(): void;
    /**
     * Finds the specified parent product and the specified child product of that parent, and makes that child the new
     * parent. The `children` and `totalNumberOfChildren` properties of the original parent are preserved in the new
     * parent.
     *
     * This method is useful when leveraging the product grouping feature to allow users to select nested products.
     *
     * E.g., if a product has children (such as color variations), you can call this method when the user selects a child
     * to make that child the new parent product, and re-render the product as such in the storefront.
     *
     * **Note:** In the controller state, a product that has children will always include itself as its own child so that
     * it can be rendered as a nested product, and restored as the parent product through this method as needed.
     *
     * @param child The child product that will become the new parent.
     */
    promoteChildToParent(child: ChildProduct): void;
    /**
     * Creates an `InteractiveProduct` sub-controller.
     * @param props - The properties for the `InteractiveProduct` sub-controller.
     * @returns An `InteractiveProduct` sub-controller.
     */
    interactiveProduct(props: InteractiveProductProps): InteractiveProduct;
    /**
     * The state of the `InstantProducts` controller.
     */
    state: InstantProductsState;
}
/**
 * The state of the `InstantProducts` controller.
 *
 * @group Buildable controllers
 * @category InstantProducts
 */
export interface InstantProductsState {
    /**
     * The current query for instant products.
     */
    query: string;
    /**
     * The instant products for the current query.
     */
    products: Product[];
    /**
     * Determines if a search is in progress for the current query.
     */
    isLoading: boolean;
    /**
     * An error returned when executing an instant products request, if any. This is `null` otherwise.
     */
    error: CommerceAPIErrorResponse | SerializedError | null;
    /**
     * The total number of products that match the current query.
     */
    totalCount: number;
}
/**
 * Creates an `InstantProducts` controller instance.
 *
 * @param engine - The headless commerce engine.
 * @param props - The configurable `InstantProducts` properties.
 * @returns An `InstantProducts` controller instance.
 *
 * @group Buildable controllers
 * @category InstantProducts
 */
export declare function buildInstantProducts(engine: CommerceEngine, props: InstantProductsProps): InstantProducts;
