@eduzz/nps

Nps EDUZZ NPS

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@eduzz/nps
1.2.32 years ago3 years agoMinified + gzip package size for @eduzz/nps in KB

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: 'theflash@eduzz.com' }
    tag: { id: '123', email: 'theflash@eduzz.com', type: 'F' },
    endpoint: '<endpoint api>' //if ignored, set to production
  });

  // Or later
  var nps = window.Nps();
  nps.setConfig(
    { email: 'theflash@eduzz.com' }, 
    { id: '123', email: 'theflash@eduzz.com', 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);
}