Emits events to recommendation store.

Predefined recommendation request event

event.name required ('request'): Predefined recommendation request event name.
event.payload.slot required (string): Slot value.
event.payload.item_id optional (string)
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Newest recommendation request event

event.name required ('newest'): Newest recommendation request event name.
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Trending recommendation request event

event.name required ('trending'): Trending recommendation request event name.
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Latest recommendation request event

event.name required ('latest'): Latest recommendation request event name.
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Viewed recommendation request event

event.name required ('viewed'): Viewed recommendation request event name.
event.payload.item_id required (string)
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Bought recommendation request event

event.name required ('bought'): Bought recommendation request event name.
event.payload.item_id required (string)
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Frequently purchased recommendation request event

event.name required ('frequentlyPurchased'): Frequently purchased recommendation request event name.
event.payload.item_ids required ((string | number)[]): Array of items ids.
event.payload.offset optional (string): Offset of products in response.
event.payload.limit optional (string): Number of products in response.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Set request body event:

event.name required ('setRequestBody'): Set request body event name.
event.payload required (object): FindifySDK recommendation request data.

Featured recommendation request event

event.name required ('featured'): Featured recommendation request event name.
event.payload.user optional (object): User object. Could be provided either at initialization or at request.

Types:

user.uid required (string): Unique customer id.
user.sid required (string): Session id.
user.email optional (string): Customer email.
user.ip optional (number): Customer ip.
user.ua optional (string): Customer user agent.
user.lang optional (string[]): Languages.

Returns:

Recommendation store instance.

Examples of usage:

// Predefined recommendation
predefinedRecommendationStore
    .emit({
        name: 'request',
        payload: {
            slot: 'slotValue',
            item_id: '10'
        }
    });

// Newest recommendation
newestRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10
        }
    });

// Trending recommendation
trendingRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10
        }
    });

// Latest recommendation
latestRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10
        }
    });

// Viewed recommendation
viewedRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10,
            item_id: '10'
        }
    });

// Bought recommendation
boughtRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10,
            item_id: '10'
        }
    });

// Frequently purchased recommendation
frequentlyPurchasedRecommendationStore
    .emit({
        name: 'request',
        payload: {
            offset: 5,
            limit: 10,
            item_ids: ['10', '11']
        }
    });


// Featured recommendation
featuredRecommendationStore
    .emit({
        name: 'request'
    });

// `setRequestBody` event
viewedRecommendationStore
    .emit({
        name: 'setRequestBody',
        payload: {
            offset: 10
        }
    })
    .emit({
        name: 'request'
    });