1.0.1 • Published 2 years ago
pubble-wapo-deployer v1.0.1
Installation
The Pubble WaPo deployer is used to simplify the generation and management of the deploy codes for the Pubble live chat widget (main widget body, featured stream and promoted stream) required for the WaPo Live Chat pages.
Using npm:
$ npm i pubble-wapo-deployer
If reference local tgz package in dependencies entry in package.json
"dependencies": {
"pubble-wapo-deployer": "file:./pubble-pipes-x.x.x.tgz"
},
Note: add --save
if you are using npm < 5.0.0
In Node.js:
// Load the full build.
const wapoDeployer = require("pubble-wapo-deployer");
const appId = "007", locale = "cs-CZ", noiframe = false, auth = "", customCss = "wapo_css_demo";
/** 1. The method generates the main app deploy code snippet with different options.
With different options passed to the method, we generate deploy code with related div attributes in the main deploy div.
**/
const deployDiv = wapoDeployer.getDeployDiv({
appId: appId, // your appId, required
locale: locale, // (optional) zh_CN, ro, pt_PT, nl_NL, ko_KR, it_IT,hu_HU, es_ES, cs_CZ,ru...
noiframe: false, // render widget without iframe(optional)
auth: auth, // your sso auth payload(optional)
});
// 2. Method generates the promoted stream container div code snippet
const deployDiv = wapoDeployer.getPromotedDiv(customClass);
// 3. Method generates the featured stream container div code snippet
const featuredDiv = wapoDeployer.getFeaturedDiv(customClass);
// 4. Method generates the url of app loader js
const loaderJs = wapoDeployer.getAppLoaderJs();
// 5. Method generates the tag of app loader js
const appLoaderTag = wapoDeployer.getAppLoaderTag();
Instruction:
Call method 1, 2, 3 (2 and 3 are optional) and insert generated divs to specific sections on your page. Get loader js url from method 4 and create js object OR call method 5 to get loader tag and insert to dom.
Note: Please follow the steps and divs have to be injected to the page before loader js. Method2 and method3 are only used for generating div containers required in wapo new chat UI.