JSPM

recommendation-library

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q27737F
  • License MIT

This will provide the recommendation when provided with tenant and country with other info

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

NPM JavaScript Style Guide

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 #