History Selectors
- getQueryParam
- getSortOrder
- getSearchPhrase
- getHistoryPathname
- getHistoryLength
- getQueryParamsAsString
- getHistoryLocation
- getRedirectLocation
getQueryParam
Retrieves a single URL parameter from the query parameters object.
Usage
import { getQueryParam } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getQueryParam } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.param
(String) required: The dedicated URL parameter.
Returns
(Array|null): The URL parameter value. If no parameter value is found, it returns null
.
getSortOrder
Retrieves the sort order from the URL query parameters.
Usage
import { getSortOrder } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getSortOrder } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string|null): The current sort order. If no sort order is found, it returns null
.
getSearchPhrase
Retrieves the search phrase from the URL query parameters.
Usage
import { getSearchPhrase } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getSearchPhrase } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string|null): The current search phrase. If no search phrase is found, it returns null
.
getHistoryPathname
Retrieves the current history path name.
Usage
import { getHistoryPathname } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getHistoryPathname } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string |null): The history path name. If no value is returned, the selector returns null
.
getHistoryLength
Retrieves the length of the current history stack.
Usage
import { getHistoryLength } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getHistoryLength } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(number|null): The current length of the history stack.
getQueryParamsAsString
Retrieves the query parameters from the history state as a pre-formatted string.
Usage
import { getQueryParamsAsString } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getQueryParamsAsString } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string|null): The current query parameters.
getHistoryLocation
Retrieves the history location from the history state.
Usage
import { getHistoryLocation } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getHistoryLocation } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string|null): The current history location. If no value is found, it returns null
.
getRedirectLocation
Retrieves the current redirect location from the history state.
Usage
import { getRedirectLocation } from '@shopgate/engage/core';
Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7:
import { getRedirectLocation } from '@shopgate/pwa-common/selectors/history'
Parameters
state
(Object) required: The application state.
Returns
(string|null): The current redirect location. If no value is found, it returns null
.