Skip to content

Releases: mathieustan/vue-intercom

@vue-intercom v1.0.0-alpha.2

10 Jan 07:54
Compare
Choose a tag to compare

πŸ”§ Bug Fixes

  • chore: fix composable path (6bf26b6), closes #5
  • chore: fixed exported files (cbad4d2)

@vue-intercom v1.0.0-alpha.1

10 Jan 07:52
Compare
Choose a tag to compare

Do not use this version.

@vue-intercom v1.0.0-alpha.0

14 Aug 09:17
Compare
Choose a tag to compare

This version is only working with Vue3.
If you want to use vue-intercom for Vue2, you'll need to install v0.0.9.

Install

npm install --save @mathieustan/vue-intercom
yarn add @mathieustan/vue-intercom

CreateApp

import { createApp } from 'vue';
import { createIntercom } from '@mathieustan/vue-intercom';

const app = createApp(/**/);
const intercom = createIntercom({ appId: 'your-app-id' });
app.use(intercom);

Usage inside setup

Inside a setup, you can easily use useIntercom to manage intercom.

<script setup lang="ts">
import { shallowRef, onBeforeMount, watch } from 'vue';
import { useIntercom } from '@mathieustan/vue-intercom';

const userId = shallowRef('id');
const name = shallowRef('name');
const email = shallowRef('email');

const intercom = useIntercom();

onBeforeMount(() => {
  intercom.shutdown();
  intercom.once('ready', bootIntercom);
});

watch(email, (newEmail) => {
  intercom.update({ email: newEmail });
});

function bootIntercom() {
  intercom.boot({
    user_id: userId.value,
    name: name.value,
    email: email.value,
  });
  intercom.show();
}
</script>

Usage optionS API

vue-intercom 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.

new Vue({
  el: '#app',
  data: () => ({
    userId: 1,
    name: 'Foo Bar',
    email: 'foo@bar.com',
  }),
  created() {
    this.$intercom.shutdown();
    this.$intercom.once('ready', this.bootIntercom);
  },
  watch: {
    email(email) {
      this.$intercom.update({ email });
    },
  },
  methods: {
    bootIntercom() {
      this.$intercom.boot({
        user_id: this.userId,
        name: this.name,
        email: this.email,
      });
      this.$intercom.show();
    },
  },
});

@intercom v1.0.0-alpha-0

14 Aug 09:13
Compare
Choose a tag to compare

@intercom v1.0.0-alpha-0

You can install intercom only as a service. If you don't want to use Intercom inside vue components.

Install

npm install --save @mathieustan/intercom
yarn add @mathieustan/intercom

Usage

import Intercom from '@mathieustan/intercom';

const appId = 'fakeAppId';

const intercom = new Intercom({ appId });

function startIntercomMessenger (user) {
  if (!intercom.ready) {
    intercom.once('ready', () => rebootIntercom(user));
  } else {
    rebootIntercom(user);
  }
}

function rebootIntercom () {
  intercom.shutdown();

  if (intercom.isBooted) return;
  intercom.boot(user);
}

v0.0.9

18 Jul 09:06
Compare
Choose a tag to compare

What's new in v0.0.9

Minor updates

  • Updated core-js dependency to 3.14.0
  • Removed unnecessary dependencies
  • Cleaned husky

v0.0.7

19 Nov 11:13
Compare
Choose a tag to compare

What's new in v0.0.7

πŸ’₯ Breaking Change

  • Migration from v0.0.6 to v0.0.7:

Only if you were using import { Intercom } from '@mathieustan/vue-intercom'
It will no longer wait script to be loaded before init

import { Intercom } from '@mathieustan/vue-intercom';
const appId = 'faleAppId';

// -- Before 
async function initIntercomService() {
  const service = new Intercom({ appId });
  await service.load();
  service.init();

  return service;
}

async function startIntercomMessenger(user) {
 try {
   const intercom = await initIntercomService();
   intercom.boot(user);
 } catch (err) => ...
}


// -- After
function startIntercomMessenger(user) {
 try {
   const intercom = new Intercom({ appId });
   intercom.once('ready', () => intercom.boot(user));
 } catch (err) => ...
}

πŸ› Fixes

If you are using 'vue-intercom' as vue plugin.
Intercom script may not yet be ready when trying to boot intercom with a user.

To solve this problem, just do:

created() {
  this.$intercom.once('ready', () => this.$intercom.boot(this.user));
}

v0.0.6

18 Nov 09:53
Compare
Choose a tag to compare

What's new in v0.0.6

πŸ› Fixes

  • appId was undefined when loading intercom script

🎨 Clean

  • Added more tests
  • Renamed some functions _load => load | _init => init | _call => callIntercom

v0.0.5

18 Nov 09:51
Compare
Choose a tag to compare

What's new in v0.0.5

πŸ› Fixes

  • Now we wait for the intercom script to be loaded before starting

🎨 Redesigned intercom

  • Now Intercom can be used with Vue (with $intercom)
  • or you can also import { Intercom } to be used as a service. Check README.

v0.0.4

08 Sep 14:56
Compare
Choose a tag to compare

Release v0.0.4

✨ Props

  • isBooted is now set to false on shutting down

v0.0.3

08 Sep 09:36
Compare
Choose a tag to compare

Release v0.0.3

πŸŽ‰ News

  • Added value isBooted when $intercom.boot() has been called.
    You can access to this value with: this.$intercom.isBooted

πŸ“¦ Install

  • Block install if appId isn't defined.