@parachutehealth/chat
v0.10.1
Published
JavaScript chat widget
Readme
chat
Goals
- standalone (no external dependencies),
- fast (close to vanilla js),
- well tested (unit / integration / feature specs included)
How does it work?
The library uses rollup to bundle the dependencies into a single umd script. Internally it uses svelte to manage the interactions. The chat is highly interactive so it should be data driven.
Suggested reading:
- https://rollupjs.org/
- https://svelte.technology/guide
- https://github.com/GoogleChrome/puppeteer
Installation
npm install @parachutehealth/chatDownload chosen sdk from https://api.zopim.com/web-sdk/#downloads and put inside of your app.
Usage
import Chat from @parachutehealth/chat
import Service from @parachutehealth/chat/build/service
import sdk from 'your-sdk-location'
const service = new Service({
key: 'ZENDESK_ACCOUNT_KEY',
storage: sessionStorage, // any storage with setItem/getItem/removeItem API
sdk
})
const chat = new Chat({
data: {
brand: 'Your brand',
logo: 'your-logo-path.ext', // 48x48px
messages_limit: 200, // max number of displayed messages
sounds: {
message: ['your-sound-path.ext']
},
...service.data()
},
service
})Development
If you're starting from scratch, install the dependencies first:
npm installDownload version 1.4.0 of the sdk from
https://dev.zopim.com/web-sdk/1.4.0/web-sdk.jsand save it attest/assets/sdk.jscurl https://dev.zopim.com/web-sdk/1.4.0/web-sdk.js > test/assets/sdk.jsSet your
ZENDESK_ACCOUNT_KEYin the.envfile.This can be found by creating a free trial account on zendesk.com. Click on the profile icon in the upper right and choose "Check connection". The account key will be the second item in the modal.
Run the following commands.
npm run watch --silent npm run test:watch --silent npm start --silent
It'll start a test server available on port 8000.
By default the specs are ran in a headless mode, to disable it pass:
{ browser: { headless: false } }To Page in feature specs.
Publish
You need to update the version of the lib first, consider using one of the following:
npm version patch
npm version minor
npm version majorAfter that, log in as a parachute dev and publish the package.
npm login # ask for credentials in #dev-chatter
npm publish