Package Exports
- @homebaseai/vue3-intercom
- @homebaseai/vue3-intercom/build/plugin.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@homebaseai/vue3-intercom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
⚠️ NOTICE: No Longer Maintained.
vue-intercom
A reactive wrapper for Intercom's JavaScript API
Installation
npm install --save vue-intercom
import Vue from 'vue';
import VueIntercom from 'vue-intercom';
Vue.use(VueIntercom, { appId: 'your-app-id' });
Usage
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() {
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
cd example
yarn
yarn dev
API
Values
$intercom.ready
Set to true
once the Intercom script has been loaded.
$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')
.
License
Copyright (c) 2017 Continuon