open-index/open-npm huggingface dataset:
npm package: @parachutehealth/chat
Description: JavaScript chat widget
Author: Parachute Health
Latest version: 0.10.1

# chat

[![Build status](https://badge.buildkite.com/0d54a7732f1f3e230421d77158216b83c7fc29bc3d0e71fd02.svg)](https://buildkite.com/parachute-health/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

```bash
npm install @parachutehealth/chat
```

Download chosen sdk from https://api.zopim.com/web-sdk/#downloads and put inside of your app.

## Usage

```js
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:

```bash
npm install
```

1. Download version 1.4.0 of the sdk from `https://dev.zopim.com/web-sdk/1.4.0/web-sdk.js` and save it at `test/assets/sdk.js`
    ```
    curl https://dev.zopim.com/web-sdk/1.4.0/web-sdk.js > test/assets/sdk.js
    ```

2. Set your `ZENDESK_ACCOUNT_KEY` in the `.env` file.

    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.

3. Run the following commands.

    ```bash
    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:

```javascript
{ 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 major
```

After that, log in as a parachute dev and publish the package.

```
npm login # ask for credentials in #dev-chatter
npm publish
```