new RevievePR(sdk)
RevievePR class.
Revieve Product Recommendations module
Parameters:
Name | Type | Description |
---|---|---|
sdk |
Object | instance of RevieveSDK |
Methods
addToCart(purchases, historyIdopt) → {Promise}
Method to save addToCart related data for reportin and analytics purposes.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
purchases |
Array.<Object> | a list of product info objects
Properties
|
|||||||||||||||||
historyId |
string |
<optional> |
historyId, if not provided value from SDK state will be used. |
Returns:
- Type
- Promise
getAlternativeProducts(productIdopt, maxopt, categories, excludeProductIds) → {Promise}
Method to get a list of alternative products and its score of a product based in the parameters setted in SDK state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
productId |
string |
<optional> |
Product from which we want to obtain alternative products. |
max |
number |
<optional> |
number of alternatives products we want to obtain. If not provided is '0' and gets all the possible alternatives. |
categories |
Array.<string> | List of routine categories associated with the product. | |
excludeProductIds |
Array.<string> | List of product ids to exclude from the alternatives. |
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, gtin) → {Promise}
Method to get individual product information
Parameters:
Name | Type | Description |
---|---|---|
id |
String | product identifier |
gtin |
String | product gtin identifier |
Returns:
- Type
- Promise
getProducts(productIdsopt) → {Promise}
Method to get list of products information
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
productIds |
Array.<string> |
<optional> |
List of product ids. |
Returns:
- Type
- Promise
getProductsWithScores(productIdsopt) → {Promise}
Method to get a list of products and its score based in the parameters setted in SDK state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
productIds |
Array.<string> |
<optional> |
List of product ids. |
Returns:
- Type
- Promise
getProductWithVariants(id, gtin) → {Promise}
Method to get individual product information with children
Parameters:
Name | Type | Description |
---|---|---|
id |
String | product identifier |
gtin |
String | product gtin identifier |
Returns:
- Type
- Promise
getRecommendedProducts(worstMetricsOptionsopt) → {Promise}
Method to get recommended products based in the parameters set in SDK state. If worstMetricsOptions
is provided, it will filter the worst metrics to get the recommended products.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
worstMetricsOptions |
Object |
<optional> |
Object with minThreshold and limit to filter the worst metrics
Properties
|
Returns:
- Type
- Promise
getRoutines() → {String}
Method to get routines of the last getRecommendedProducts call
Returns:
string with history id
- Type
- String
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 |
queryRecommendedProducts(queryopt) → {Promise}
Method to get recommended products based in the provided query parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Object |
<optional> |
Recommender query parameters. |
Returns:
- Type
- Promise