mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
include intercom
This commit is contained in:
parent
5ae80efaa7
commit
d183b9ba1c
@ -40,6 +40,15 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
|
|
||||||
|
<!-- Intercom library -->
|
||||||
|
<script>
|
||||||
|
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
|
||||||
|
s.src='https://widget.intercom.io/widget/{app_id}';
|
||||||
|
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- actual app -->
|
||||||
<script src="<%= BASE_URL %>static/js/app.js"></script>
|
<script src="<%= BASE_URL %>static/js/app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -58,6 +58,8 @@ let Header = React.createClass({
|
|||||||
handleLogout(){
|
handleLogout(){
|
||||||
UserActions.logoutCurrentUser();
|
UserActions.logoutCurrentUser();
|
||||||
Alt.flush();
|
Alt.flush();
|
||||||
|
// kill intercom (with fire)
|
||||||
|
window.Intercom('shutdown');
|
||||||
this.transitionTo('login');
|
this.transitionTo('login');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -89,6 +91,17 @@ let Header = React.createClass({
|
|||||||
},
|
},
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
|
|
||||||
|
if(this.state.currentUser && this.state.currentUser.email) {
|
||||||
|
// bootup intercom if the user is logged in
|
||||||
|
window.Intercom('boot', {
|
||||||
|
app_id: 'oboxh5w1',
|
||||||
|
email: this.state.currentUser.email,
|
||||||
|
widget: {
|
||||||
|
activator: '#IntercomDefaultWidget'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user