Class: RevievePR

RevievePR(sdk)

new RevievePR(sdk)

RevievePR class. Revieve Product Recommendations module
Parameters:
Name Type Description
sdk Object instance of RevieveSDK

Methods

addToCart(purchases) → {Promise}

Method to save addToCart related data for reportin and analytics purposes.
Parameters:
Name Type Description
purchases Array.<Object> a list of product info objects
Properties
Name Type Attributes Description
id string product identifier
price number <optional>
product price
extra * <optional>
product extra info
Returns:
Type
Promise

getHistoryId() → {String}

Method to get history Id of the last getRecommendedProducts call
Returns:
string with history id
Type
String

getLastRecommendedProducts() → {Object}

Method to get last recommended products based in the parameters setted in SDK state. Please note, this method doesn't request any information to server.
Returns:
JSON set of recommended products
Type
Object

getProduct(id) → {Promise}

Method to get individual product information
Parameters:
Name Type Description
id String product identifier
Returns:
Type
Promise

getRecommendedProducts() → {Promise}

Method to get recommended products based in the parameters setted in SDK state.
Returns:
Type
Promise

getSeralizableState() → {Object}

Returns a copy of the state configuration object in SDK
Returns:
JSON with all configuration values
Type
Object

hydrateState(state)

Hydrate the state with the provided one
Parameters:
Name Type Description
state Object JSON with all configuration values