Cora Widget (Web SDK)
Browsers support
Browser | Support |
---|---|
IE < 11 | Not supported |
IE 11 | Supported |
Edge | Supported |
Firefox | last version - 1 |
Chrome | last version - 1 |
Safari | Partial Supported |
Build project
$ npm run build
Publish to NPM
Increase a version in the package
$ npm publish --access=public
Start Local (without watch files)
$ npm run start
Start Development (with watch files)
$ npm run start:dev
Start Production
$ npm run start:prod
Start Server Linux
$ npm run server
To run on Windows with python, is necessary add task in script start or execute command below:
$ python http.server -m 8000
How to install Web SDK in your application
CDN
<link href="https://widget.corahq.com/zupcora-sdk.min.css" rel="stylesheet" />
<script src="https://widget.corahq.com/zupcora-sdk.min.js"></script>
NPM
$ npm i @corahq/sdk-web
Start WebSDK
Important, to execute Cora inside your application do you need configure your whitelist on Backoffice Cora.
<script>
const identifier = "reaba46y-ntssn4-11e9-jyf-5453rbaebllar"
const options = {
refreshSession: true,
customFields: {
customerName: 'Jonas',
securityToken: "kjraekreaJj43a4araetrj450"
}
}
const events = {
onStart: function() { console.log('Hello World')},
onToggle: function() { console.log('Do something')}
}
zupcora.sdk.init(identifier, options, events)
</script>
SDK
Param | Type | Description | Required |
---|---|---|---|
zupcora | object | SDK object | yes |
identifier | string | Unique identifier from Cora project. Creating on channels, inside backoffice. | yes |
options | object | Custom options | no |
events | object | Callback events | no |
Controllers from SDK
- zupcora.sdk - Contains all public controllers from Cora SDK. Parameters:
Param | Type | Description | Required |
---|---|---|---|
init | function | Start SDK | yes |
toggle | function | Controll open and close SDK | no |
- options - Options of the SDK. Parameters:
Param | Type | Description | Required |
---|---|---|---|
refreshSession | bool | true - create a new session on refresh page false - create a fingerprint session | no - default false |
customFields | object | custom fields to take on runtime, support anything parameters | no |
- callback events - Callback support to dispatch actions on trigger event inside Cora
Param | Type | Description | Required |
---|---|---|---|
onStart | function | Execute function on start chat conversation | no |
onToggle | function | Execute function on close and open chat | no |
onResizeDecrease | function | Execute callback function on decrease chat window | no |
onResizeIncrease | function | Execute callback function on increase chat window | no |