@pga/react-intercom-client

0.1.4 • Public • Published

pga/react-intercom-client

A React compoennt and API wrapper for Intercom, already aware of PGA authentication through @pga/auth-provider dependency.

Installation

npm i -S @pga/react-intercom-client --save

Usage

Insert Intercom Inside of your application and make shure is under AuthProvider since it this component is connected to authentication through withAuthProvider from @pga/auth-provider relays on isLoggedIn :

import React from 'react';
import Intercom from 'react-intercom';
import myDataLoader from './myDateLoader'

export const App = () => <div className="app">
    <Intercom appID={appId} dataLoader={myDataLoader}/>
  </div>

This loads Intercom widget, and will update data when login/logout status change. react-intercom-client also exports window.Intercom as IntercomAPI for consuming API. For example, where you'd like to intentionally update user data:

import { IntercomAPI } from 'react-intercom';
IntercomAPI('update', userData);

This is, of course, equivalent to just calling window.Intercom('trackEvent', 'invited-friend'); or even Intercom('trackEvent', 'invited-friend');.

Readme

Keywords

Package Sidebar

Install

npm i @pga/react-intercom-client

Weekly Downloads

5

Version

0.1.4

License

ISC

Unpacked Size

11.8 kB

Total Files

7

Last publish

Collaborators

  • silvait
  • bsubedi26
  • jasonwalkow
  • kevinjscott
  • pgamachineuser