The SSR commerce engine.

interface CommerceEngine {
    "[stateKey]": { configuration: ConfigurationState; version: string } & Partial<
        SearchParametersState,
    > & {
        cart: CartState;
        categoryFacetSearchSet: CategoryFacetSearchSetState;
        commerceContext: CommerceContextState;
        commerceFacetSet: CommerceFacetSetState;
        commercePagination: CommercePaginationState;
        commerceQuery: CommerceQueryState;
        commerceSearch: CommerceSearchState;
        commerceSort: CommerceSortState;
        didYouMean: DidYouMeanState;
        facetOrder: FacetOrderState;
        facetSearchSet: SpecificFacetSearchSetState;
        fieldSuggestionsOrder: FieldSuggestionsOrderState;
        manualNumericFacetSet: ManualNumericFacetSetState;
        productListing: ProductListingState;
        recommendations: RecommendationsState;
        triggers: TriggerState;
    } & Partial<CommerceAppState>;
    configuration: ConfigurationState;
    dispatch: EngineDispatch<
        { configuration: ConfigurationState; version: string } & Partial<
            SearchParametersState,
        > & {
            cart: CartState;
            categoryFacetSearchSet: CategoryFacetSearchSetState;
            commerceContext: CommerceContextState;
            commerceFacetSet: CommerceFacetSetState;
            commercePagination: CommercePaginationState;
            commerceQuery: CommerceQueryState;
            commerceSearch: CommerceSearchState;
            commerceSort: CommerceSortState;
            didYouMean: DidYouMeanState;
            facetOrder: FacetOrderState;
            facetSearchSet: SpecificFacetSearchSetState;
            fieldSuggestionsOrder: FieldSuggestionsOrderState;
            manualNumericFacetSet: ManualNumericFacetSetState;
            productListing: ProductListingState;
            recommendations: RecommendationsState;
            triggers: TriggerState;
        } & Partial<CommerceAppState> & {
            configuration: CoreConfigurationState;
            version: string;
        },
        CommerceThunkExtraArguments,
    >;
    logger: Logger;
    navigatorContext: NavigatorContext;
    relay: Relay;
    addReducers(
        reducers: { [key: string]: Reducer<any, UnknownAction, any> },
    ): void;
    disableAnalytics(): void;
    enableAnalytics(): void;
    subscribe(listener: () => void): Unsubscribe;
    waitForRequestCompletedAction(): Promise<Action>[];
}

Hierarchy

  • CommerceEngine
    • CommerceEngine

Methods

  • Adds the specified reducers to the store.

    Parameters

    • reducers: { [key: string]: Reducer<any, UnknownAction, any> }

      An object containing the reducers to attach to the engine.

    Returns void

  • Disable analytics tracking

    Returns void

  • Enable analytics tracking

    Returns void

  • Adds a change listener. It will be called any time an action is dispatched, and some part of the state tree may potentially have changed. You may then access the new state.

    Parameters

    • listener: () => void

      A callback to be invoked on every dispatch.

    Returns Unsubscribe

    A function to remove this change listener.

  • Waits for the request to be completed and returns a promise that resolves to an Action.

    Returns Promise<Action>[]

Properties

"[stateKey]": { configuration: ConfigurationState; version: string } & Partial<
    SearchParametersState,
> & {
    cart: CartState;
    categoryFacetSearchSet: CategoryFacetSearchSetState;
    commerceContext: CommerceContextState;
    commerceFacetSet: CommerceFacetSetState;
    commercePagination: CommercePaginationState;
    commerceQuery: CommerceQueryState;
    commerceSearch: CommerceSearchState;
    commerceSort: CommerceSortState;
    didYouMean: DidYouMeanState;
    facetOrder: FacetOrderState;
    facetSearchSet: SpecificFacetSearchSetState;
    fieldSuggestionsOrder: FieldSuggestionsOrderState;
    manualNumericFacetSet: ManualNumericFacetSetState;
    productListing: ProductListingState;
    recommendations: RecommendationsState;
    triggers: TriggerState;
} & Partial<CommerceAppState>

The readonly internal state of the headless engine.

configuration: ConfigurationState

The readonly global headless engine configuration

dispatch: EngineDispatch<
    { configuration: ConfigurationState; version: string } & Partial<
        SearchParametersState,
    > & {
        cart: CartState;
        categoryFacetSearchSet: CategoryFacetSearchSetState;
        commerceContext: CommerceContextState;
        commerceFacetSet: CommerceFacetSetState;
        commercePagination: CommercePaginationState;
        commerceQuery: CommerceQueryState;
        commerceSearch: CommerceSearchState;
        commerceSort: CommerceSortState;
        didYouMean: DidYouMeanState;
        facetOrder: FacetOrderState;
        facetSearchSet: SpecificFacetSearchSetState;
        fieldSuggestionsOrder: FieldSuggestionsOrderState;
        manualNumericFacetSet: ManualNumericFacetSetState;
        productListing: ProductListingState;
        recommendations: RecommendationsState;
        triggers: TriggerState;
    } & Partial<CommerceAppState> & {
        configuration: CoreConfigurationState;
        version: string;
    },
    CommerceThunkExtraArguments,
>

Dispatches an action directly. This is the only way to trigger a state change. Each headless controller dispatches its own actions.

An action supported by the headless engine.

For convenience, the action object that was just dispatched.

logger: Logger

The logger instance used by headless.

navigatorContext: NavigatorContext

The navigator context (referer, location, UserAgent)

relay: Relay

The Relay instance used by Headless.