Package Exports
- recommendation-library
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (recommendation-library) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
recommendation-library
To get product recommendations
Install
npm install --save recommendation-library
Usage
const recommendations = require('recommendation-library');
const queryBody = {
tenant: 'tenant',
lob: 'lob',
countries:'country_code',
channels:'channels',
components: 'components',
customer_id:'customer_id',
item_id:'item_id',
event_name:'event_name'
};
const tokenBody = {
tokenAvailable: 'TRUE/FALSE',
CLIENT_ID: 'CLIENT_ID',
CLIENT_SECRET: 'CLIENT_SECRET',
token: 'TOKEN_HERE_IF_AVAILABLE'
};
async function getRecommendations(){
let response = await recommendations.getRecommendations(queryBody, tokenBody);
console.log("recommendation response:: " + JSON.stringify(response));
}
const metricBody = {
token: 'YOUR_TOKEN_HERE',
tenant: 'TENANT_HERE',
recommendation_id: 'RECOMMENDATION_ID',
action: 'ACTION_HERE'
}
async function updateMetric(){
let response = await recommendations.updateMetric(metricBody);
console.log("updateMetric response:: " + JSON.stringify(response));
}
getRecommendations();
updateMetric();
The token generated and the tenant will be stored in sessionStorage after the first call with following keys: 'prToken': 'AUTHENTICATION_TOKEN' 'prTenant': 'TENANT'
License
MIT © ramiBoss #