# @leadent/intercom-vue-plugin

> intercom.com Vue.js plugin

Latest version **1.0.8** (published 2021-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @leadent/intercom-vue-plugin
pnpm add @leadent/intercom-vue-plugin
yarn add @leadent/intercom-vue-plugin
bun add @leadent/intercom-vue-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2021-08-20 |
| First published | 2021-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 923.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben Gooding |
| Maintainers | rcoundon, pauljnewell, ben-leadent |
| Keywords | intercom.com, intercom.io, Vue, Vue.js |

## Links

- npm: https://www.npmjs.com/package/@leadent/intercom-vue-plugin
- Repository: https://github.com/Leadent/intercom-vue-plugin
- Homepage: https://github.com/Leadent/intercom-vue-plugin#readme
- Issues: https://github.com/Leadent/intercom-vue-plugin/issues
- npm.io page: https://npm.io/package/@leadent/intercom-vue-plugin

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2021-08-20
- 1.0.7 — 2021-08-20
- 1.0.6 — 2021-08-19
- 1.0.5 — 2021-08-19
- 1.0.4 — 2021-06-08
- 1.0.3 — 2021-05-21
- 1.0.2 — 2021-05-19
- 1.0.1 — 2021-05-19
- 1.0.0 — 2021-05-10

## README

# intercom.com Vue.js Plugin

A reactive wrapper for [Intercom's](https://www.intercom.com/) [JavaScript API](https://developers.intercom.com/docs/intercom-javascript)

## Installation

```bash
npm install intercom-vue-plugin
```

In src/main.js 
```javascript
import Vue from 'vue';
import IntercomVuePlugin from '@leadent/intercom-vue-plugin';

Vue.use(IntercomVuePlugin, { app_id: 'your-app-id' });
```
Note: Option parameters can be set when initalising the plugin (as above) or when booting the plugin (as below) which will override any initial options settings.
## Usage

`intercom-vue-plugin` handles the injection of Intercom's script into your html and wraps calls to the Intercom API with methods and exposes them through the `$intercom` object in your components.

```javascript
new Vue({
  el: '#app',
  data() {
    return {
      userId: 1,
      name: 'Foo Bar',
      email: 'foo@bar.com',
    };
  },
  mounted() {
    this.$intercom.boot({
      user_id: this.userId,
      name: this.name,
      email: this.email,
    });
    this.$intercom.show();
  },
  watch: {
    email(email) {
      this.$intercom.update({ email });
    },
  }
});
```

## Example App

```
npm run build
cd example/
npm run serve
```

## API

### Values

#### `$intercom.ready`

Set to `true` once the Intercom script has been loaded. There is no need to wait for this property, the plugin watches this internally and will only pass user calls to methods and properties to Intercom once this is `true`. 

#### `$intercom.visible`

Set via the `onShow`/`onHide` events.

#### `$intercom.unreadCount`

Set via the `onUnreadCountChange` event.

### Methods

#### `$intercom.boot(/* optional */options)`

Calls `Intercom('boot')`. Automatically sets the `app_id` unless specified in the options object.

#### `$intercom.shutdown()`

Calls `Intercom('shutdown')`.

#### `$intercom.update(/* optional */options)`

Calls `Intercom('update')`. If the options object is set, calls `Intercom('update', options)`

#### `$intercom.show()`

Calls `Intercom('show')`.

#### `$intercom.hide()`

Calls `Intercom('hide')`.

#### `$intercom.showMessages()`

Calls `Intercom('showMessages')`.

#### `$intercom.showNewMessage(/* optional */content)`

Calls `Intercom('showNewMessage')` with pre-populated content if provided.

#### `$intercom.trackEvent(name, /* optional */metadata)`

Calls `Intercom('trackEvent')` with extra metadata if provided.

#### `$intercom.getVisitorId()`

Calls `Intercom('getVisitorId')`

#### `$intercom.getVisitorId()`

Calls `Intercom('getVisitorId')`

#### `$intercom.startTour()`

Calls `Intercom('startTour')`

## License

[MIT](http://opensource.org/licenses/MIT)

Copyright (c) 2021 Leadent Digital

---
_Source: https://npm.io/package/@leadent/intercom-vue-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
