@coveo/headless-react
    Preparing search index...

    Interface ProductTemplatesManager<Content, LinkContent>

    interface ProductTemplatesManager<Content = unknown, LinkContent = unknown> {
        registerTemplates: (
            ...templates: Template<Product, Content, unknown>[],
        ) => void;
        selectLinkTemplate: (product: Product) => null | LinkContent;
        selectTemplate: (product: Product) => null | Content;
    }

    Type Parameters

    • Content = unknown
    • LinkContent = unknown
    Index

    Properties

    registerTemplates: (...templates: Template<Product, Content, unknown>[]) => void

    Registers any number of product templates in the manager.

    Type declaration

    selectLinkTemplate: (product: Product) => null | LinkContent

    Selects the highest priority link template for which the given product satisfies all conditions. In the case where satisfied templates have equal priority, the template that was registered first is returned.

    Type declaration

      • (product: Product): null | LinkContent
      • Parameters

        • product: Product

          (Product) The product for which to select a template.

        Returns null | LinkContent

        (Content) The content of the selected template, or null if no template can be selected for the given product.

    selectTemplate: (product: Product) => null | Content

    Selects the highest priority template for which the given product satisfies all conditions. In the case where satisfied templates have equal priority, the template that was registered first is returned.

    Type declaration

      • (product: Product): null | Content
      • Parameters

        • product: Product

          (Product) The product for which to select a template.

        Returns null | Content

        (Content) The content of the selected template, or null if no template can be selected for the given product.