Search Selectors

getSuggestions

Retrieves the search suggestions for a passed search phrase.

Usage

import { getSuggestions } from '@shopgate/engage/search'

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getSuggestions } from '@shopgate/pwa-common-commerce/search'

Parameters

  • state (Object) required: The application state.
  • props (Object) required: An object containing props.
    • searchPhrase (string) required: The search phrase to use.

Returns

(Array|null): The found suggestions. If no phrase is passed or no suggestions are found, it returns null.


getSuggestionsFetchingState

Retrieves whether suggestions for a passed search phrase are currently fetching.

Usage

import { getSuggestionsFetchingState } from '@shopgate/engage/search'

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getSuggestionsFetchingState } from '@shopgate/pwa-common-commerce/search'

Parameters

  • state (Object) required: The application state.
  • props (Object) required: An object containing props.
    • searchPhrase (string) required: The search phrase to use.

Returns

(boolean): Whether the suggestions are currently fetching.