1.0.0 • Published 5 years ago

react-startdeliver v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

react-startdeliver

This is a JavaScript module that can be used to include startdeliver-usage-js code in a website or app that uses its React codebase.

NPM JavaScript Style Guide

Install

npm install --save react-startdeliver

Usage

import React, { Component } from 'react';
import Startdeliver from 'react-startdeliver';

export default class App extends Component {
  componentDidMount() {
    // To get the script to accept usage events, initiate it with your usage id...
    Startdeliver.init('USAGE_ID', {
      debug: true, // optional. Default to false
      skipLoader: false // optional. Default to false
    });

    // Call the function with sendEvent as first param and an object containing userId (the users email) and usageType
    // startdeliverUserFieldToMatchOn and timestamp are optional
    Startdeliver.send({
      userId: '3', // value of the field from 'startdeliverUserFieldToMatchOn' or userEmail
      usageType: 'viewInvoice',
      startdeliverUserFieldToMatchOn: 'id', // optional. Default to 'email'
      timestamp: 1560166342000 // optional. Detault to current time
    });

    // Call the function with sendEvent with default startdeliverUserFieldToMatchOn ( 'email' )
    Startdeliver.send({
      userId: 'user@test.com',
      usageType: 'viewInvoice',
    });
  }

  render() {
    return <div>Example of usage Startdeliver App</div>;
  }
}

License

MIT © Startdeliver

1.0.0

5 years ago

0.0.0

5 years ago