ContextActions (Product Recommendation Engine)

This is for:

Developer

The context action creators.

Loader Function

loadContextActions

Loads the context reducer and returns possible action creators.

Parameters

  • engine: CoreEngine

    The headless engine.

Returns ContextActionCreators: The context action creators.

ContextActionCreators

addContext

Adds a new context value.

Parameters

Returns PayloadAction<AddContextActionCreatorPayload>: A dispatchable action.

removeContext

Removes a context key-value pair.

Parameters

  • key: string

    The key to remove from the context (e.g., "age").

Returns PayloadAction<string>: A dispatchable action.

setContext

Sets the query context.

Parameters

  • payload: Record<string, ContextValue>

    The action creator payload.

Returns PayloadAction<ContextPayload>: A dispatchable action.

AddContextActionCreatorPayload

Properties

  • contextKey: string

    The name of the key to store the context value in.

  • contextValue: string | string[]

    The context value.