@eduzz/nps
v1.2.3
Published
Nps EDUZZ NPS
Downloads
240
Keywords
Readme
Eduzz NPS
Nps EDUZZ NPS
How to use
In Browser
(function (d, l, c) {
var s = d.createElement('script');
s.async = true;
s.src = l;
s.onload = c;
d.body.append(s);
})(document, 'https://unpkg.com/@eduzz/nps@^<version>/build/widget.js', function () {
var nps = window.Nps({
//you can set the config initial
key_fields: { email: '[email protected]' }
tag: { id: '123', email: '[email protected]', type: 'F' },
endpoint: '<endpoint api>' //if ignored, set to production
});
// Or later
var nps = window.Nps();
nps.setConfig(
{ email: '[email protected]' },
{ id: '123', email: '[email protected]', type: 'F' },
'modal',
'<endpoint api>' // if ignored, set to production
);
Via npm
// Nps.ts <~ create in your application
import Nps from '@eduzz/nps';
export async function setConfig(yourConfig: IYourInterface) {
const promiseNps = Nps();
const nps = await promiseNps;
if (!nps) return;
nps.setConfig(yourConfig);
}