johnnynotsolucky / vue-intercom

An Intercom Javascript API plugin for Vue.js
MIT License
66 stars 20 forks source link

Method for Visibility (not Shutdown) #10

Closed markojak closed 6 years ago

markojak commented 6 years ago

Using this Wrapper for our Intercom on our VueJS App as it makes life much easier. Thank you for all your work on this.

What I'm trying to do: Make the intercom messenger invisible (hidden) on a specific page where I need the real estate and the messenger location gets in the way

What I've tried Tried to use the this.$intercom.shutdown() in one of my init() methods when the page loads and this works but then the intercom messenger is no longer booted. I still need it active in the event of messages being pushed through or support required.

this.$intercom.hide() does not affect the visibility of the messenger

Would you be able to help ?

johnnynotsolucky commented 6 years ago

@marchofreason I'm glad its helping you out :-)

You should be able to make use of the hide_default_launcher Intercom property.

For example, in App.vue, you can mount it and set it to be displayed:

  mounted() {
    this.$intercom.boot({
      user_id: 123456,
      name: '...',
      email: '...',
      hide_default_launcher: false,
    });
  },

and on specific routes, update to hide the widget:

  mounted() {
    this.$intercom.update({
      hide_default_launcher: true,
    });
  },
  beforeDestroy() {
    // Show the launcher again
    this.$intercom.update({
      hide_default_launcher: false,
    });
  }
johnnynotsolucky commented 6 years ago

Closing this as resolved. Please reopen if the solution isn’t working for you.