import type { CommerceEngine } from '../../../../app/commerce-engine/commerce-engine.js'; import { stateKey } from '../../../../app/state-key.js'; import type { FacetType } from '../../../../features/commerce/facets/facet-set/interfaces/common.js'; import type { AnyFacetRequest, CategoryFacetValueRequest, LocationFacetValueRequest } from '../../../../features/commerce/facets/facet-set/interfaces/request.js'; import type { AnyFacetResponse, AnyFacetValueResponse, BaseFacetValue, CategoryFacetValue, DateFacetValue, LocationFacetValue, NumericFacetValue, RegularFacetValue } from '../../../../features/commerce/facets/facet-set/interfaces/response.js'; import type { FacetValueRequest } from '../../../../features/facets/facet-set/interfaces/request.js'; import type { AnyFacetValueRequest } from '../../../../features/facets/generic/interfaces/generic-facet-request.js'; import type { CoreFacetState, CoreFacet as HeadlessCoreFacet } from '../../../core/facets/facet/headless-core-facet.js'; import type { DateRangeRequest } from '../../../core/facets/range-facet/date-facet/headless-core-date-facet.js'; import type { NumericRangeRequest } from '../../../core/facets/range-facet/numeric-facet/headless-core-numeric-facet.js'; import type { FetchProductsActionCreator, ToggleActionCreator } from '../common.js'; export type { BaseFacetValue, CategoryFacetValue, CategoryFacetValueRequest, DateFacetValue, DateRangeRequest, FacetType, FacetValueRequest, LocationFacetValue, LocationFacetValueRequest, NumericFacetValue, NumericRangeRequest, RegularFacetValue, }; export interface FacetControllerType { type: T; } /** * @internal * * The configurable `CoreCommerceFacet` properties used internally. */ interface CoreCommerceFacetProps { options: CoreCommerceFacetOptions; } export interface CoreCommerceFacetOptions { facetId: string; toggleSelectActionCreator: ToggleActionCreator; toggleExcludeActionCreator?: ToggleActionCreator; fetchProductsActionCreator: FetchProductsActionCreator; facetResponseSelector: (state: CommerceEngine[typeof stateKey], facetId: string) => AnyFacetResponse | undefined; isFacetLoadingResponseSelector: (state: CommerceEngine[typeof stateKey]) => boolean; } export type CommerceFacetOptions = Omit; export type CoreCommerceFacet = Pick & { /** * Toggles selection of the specified facet value. * * @param selection - The facet value to select. */ toggleSelect(selection: ValueRequest): void; /** * Toggles exclusion of the specified facet value. * * @param selection - The facet value to exclude. */ toggleExclude(selection: ValueRequest): void; /** * Toggles selection of the specified facet value, deselecting all others. * * @param selection - The facet value to single select. */ toggleSingleSelect(selection: ValueRequest): void; /** * Toggles exclusion of the specified facet value, deselecting all others. * * @param selection - The facet value to single exclude. */ toggleSingleExclude(selection: ValueRequest): void; /** * Whether the specified facet value is selected. * * @param value - The facet value to evaluate. */ isValueSelected(value: ValueResponse): boolean; /** * Whether the specified facet value is excluded. * * @param value - The facet value to evaluate. */ isValueExcluded(value: ValueResponse): boolean; }; /** * A scoped and simplified part of the headless state that is relevant to the `CoreCommerceFacet` controller. */ export type CoreCommerceFacetState = Omit & { /** * The type of facet. */ type: FacetType; /** * The facet field. */ field: string; /** * The facet display name. */ displayName?: string; /** * The facet values */ values: ValueResponse[]; }; export declare function buildCoreCommerceFacet(engine: CommerceEngine, props: CoreCommerceFacetProps): { toggleSelect: (selection: ValueRequest) => void; toggleExclude: (selection: ValueRequest) => void; toggleSingleSelect: (selection: ValueRequest) => void; toggleSingleExclude: (selection: ValueRequest) => void; isValueSelected: (value: ValueResponse) => boolean; isValueExcluded: (value: ValueResponse) => boolean; deselectAll(): void; showMoreValues(): void; showLessValues(): void; state: CoreCommerceFacetState; subscribe(listener: () => void): import("@reduxjs/toolkit").Unsubscribe; }; export declare const getCoreFacetState: (facetId: string, request: AnyFacetRequest | undefined, response: AnyFacetResponse | undefined, isLoading: boolean) => CoreCommerceFacetState;