nhagen / react-intercom

A component to configure and enable Intercom in your react application
MIT License
237 stars 72 forks source link

user signout on unmount #87

Open clairefro opened 4 years ago

clairefro commented 4 years ago

[Question] I see in the code that window.Intercom('shutdown') is called in componentWillReceiveProps() and componentWillUnmount(), however the session seems to persist when leaving the website and coming back. I also tried deleting cookies.

How can we ensure a session gets closed when user leaves the webpage?

(thanks for this package by the way, it's awesome!)

wasims1 commented 4 years ago

any updates on this issue?

hatched-esther commented 4 years ago

I second this, how can we do a complete shutdown. Its not currently doing it on log out.

timrodz commented 4 years ago

Bump - Dealing with this issue as well.

devrnt commented 4 years ago

@hatched-esther The shutdown is nothing more than removing the window.Intercom and window.intercomSettings object. Also make sure your Intercom related cookies are removed (this should have happened automatically when calling IntercomAPI('shutdown').

In case you're interested I've made an abstraction to make this more dev-friendly in React: https://github.com/devrnt/react-use-intercom

timrodz commented 4 years ago

Thanks @devrnt - Trying it out now :)