0.1.4 • Published 7 years ago
@pga/react-intercom-client v0.1.4
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 --saveUsage
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');.
0.1.4
7 years ago