Interface FacetGenerator (Open Beta)

The FacetGenerator headless sub-controller creates commerce facet sub-controllers from the Commerce API search or product listing response.

Commerce facets are not requested by the implementer, but rather pre-configured through the Coveo Merchandising Hub (CMH). The implementer is only responsible for leveraging the facet controllers created by this sub-controller to properly render facets in their application.

See Implement server-side rendering.

interface FacetGenerator {
    getFacetController: <T extends FacetType>(
        facetId: string,
        facetType: T,
    ) => undefined | MappedGeneratedFacetController[T];
    state: MappedFacetStates;
    deselectAll(): void;
    subscribe(listener: () => void): Unsubscribe;
}

Hierarchy

Methods

Properties

getFacetController: <T extends FacetType>(
    facetId: string,
    facetType: T,
) => undefined | MappedGeneratedFacetController[T]

Builds a facet controller for the specified facet ID.

See Implement server-side rendering.

Type declaration

The state of each every facet returned by the Commerce API.

In a server-side rendering (SSR) scenario, you must use this state to render the facet UI components before the facet controller is hydrated on the client side.

Once the facet generator controller has been hydrated, you must use the getFacetController method to retrieve the individual facet controllers and subscribe to their respective states.

See Implement server-side rendering.

MMNEPVFCICPMFPCPTTAAATR