StandaloneSearchBox (Commerce Engine)

This is for:

Developer

Methods

afterRedirection

Resets the standalone search box state. To be dispatched on single page applications after the redirection has been triggered.

submit

Triggers a redirection.

updateRedirectUrl

Updates the redirection url of the standalone search box.

Parameters

  • url: string

    The new URL to redirect to.

Attributes

state

A scoped and simplified part of the headless state that is relevant to the StandaloneSearchBox controller.

Properties

  • redirectTo: string

    The URL to redirect to.

  • isLoading: boolean

    Determines if a search is in progress.

  • isLoadingSuggestions: boolean

    Determines if a query suggest request is in progress.

  • suggestions: Suggestion[]

    The query suggestions for the search box query.

  • value: string

    The current query in the search box.

Initialize

buildStandaloneSearchBox

Creates a StandaloneSearchBox controller instance.

Parameters

  • engine: CommerceEngine

    The headless commerce engine.

  • props: StandaloneSearchBoxProps

    The configurable StandaloneSearchBox properties.

Returns StandaloneSearchBox

StandaloneSearchBoxProps

The configurable StandaloneSearchBox properties.

Properties

StandaloneSearchBoxOptions

Properties

  • redirectionUrl: string

    The default Url the user should be redirected to, when a query is submitted. If a query pipeline redirect is triggered, it will redirect to that Url instead.

  • overwrite?: boolean

    Whether to overwrite the existing standalone search box with the same id.

Suggestion

Properties

  • highlightedValue: string

    The suggestion after applying any highlightOptions.

  • rawValue: string

    The suggestion text.