react-freshchat
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -245,3 +245,3 @@ (function (global, factory) { | ||
value: function lazyInit(settings) { | ||
window.fcSettings = settings; | ||
widget().init(settings); | ||
@@ -248,0 +248,0 @@ loadScript(); |
{ | ||
"name": "react-freshchat", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "FreshChat React implementation", | ||
@@ -5,0 +5,0 @@ "main": "build/react-freshchat.js", |
@@ -1,7 +0,51 @@ | ||
# react-freshchat | ||
# React Freshchat | ||
React Freshchat is a wrapper on top of Freshchat (see oficial doc here https://developers.freshchat.com/). | ||
Note: the lib required ES6+ with esm (import/export) | ||
## How to use | ||
**DO NOT INCLUDE Freshchat script in `head`, React Freshchat will automatically add it with lazy load technique** | ||
* Install `react-freshchat` (see Installation). | ||
* Import the lib where you initialize your React App. | ||
* Include the component with the `token`. | ||
### Example | ||
``` | ||
import React from 'react' | ||
import FreshChat from 'react-freshchat' | ||
class App extends React.Component { | ||
// ... | ||
render() { | ||
return <div> | ||
<FreshChat | ||
token={config.freshchat.token} | ||
email: 'user@email.com', | ||
first_name: '...', | ||
onInit={widget => { | ||
/* Use `widget` instead of `window.fcWidget` | ||
widget.user.setProperties({ | ||
email: user.email, | ||
first_name: user.firstName, | ||
last_name: user.lastName, | ||
phone: user.phoneNumber, | ||
}) | ||
*/ | ||
}} | ||
/> | ||
</div> | ||
} | ||
} | ||
``` | ||
For more details: https://developers.freshchat.com/ | ||
## Installation | ||
Only NPM is supported for now: `npm i -s react-freshchat` | ||
## UMD Support | ||
UMD is supported out of the box. | ||
## TODO | ||
* Unit Testing | ||
* Integrate Webpack |
@@ -114,3 +114,3 @@ import _ from 'lodash/fp' | ||
lazyInit(settings) { | ||
window.fcSettings = settings | ||
widget().init(settings) | ||
@@ -117,0 +117,0 @@ loadScript() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16975
52