1.0.2 • Published 9 months ago

pmf-engine-sdk v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

PMF-engine JavaScript SDK

This library allows to integrate web app with PMF-engine. You can record events and get commands such if feedback form needs to be shown when time comes :)

Installation

npm install pmf-engine-sdk

Usage

Initiate

const Pmf = require('pmf-engine-sdk')

// Initiate the library
const pmf = new Pmf('account id')
pmf.identify('user id')

Record an event

Recorgind event has no response but returns a promise that resolves at the end of api call

await pmf.event('core event name')

Get command

const command = await pmf.getCommand()

Command can be null or

{
  type: 'form', 
  url: 'https://pmf-engine.web.app/form/test/demo/xyz/pmf-sdk-js'
}

At the time of writing this document, there is only one command type="form"

'Functional' use

Pmf object does not hold any particular informations and does not need to be stored through entire life of the application. It can be destroyed after use and initiated before use without time consuming calls.

Alternatively we can:

record event

await new PMF(accountId, { userId }).event('very important event')

get command:

const command = await new PMF(accountId, { userId }).getCommand()
1.0.2

9 months ago

1.0.1

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago

1.0.0

9 months ago