2017-10-17 10:27:40 +09:00
|
|
|
import { Components, replaceComponent, getSetting, withCurrentUser, Head } from 'meteor/vulcan:core';
|
|
|
|
import React from 'react';
|
|
|
|
import Intercom from 'react-intercom';
|
|
|
|
|
|
|
|
const IntercomWrapper = ({ currentUser }) => {
|
|
|
|
const appId = getSetting('intercom.appId');
|
|
|
|
|
|
|
|
if (!appId) {
|
|
|
|
console.warn('Please add intercom.appId to your public settings or disable the vulcan:intercom package.');
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-10-17 10:43:19 +09:00
|
|
|
return currentUser ? <Intercom
|
2017-10-17 10:27:40 +09:00
|
|
|
appID={appId}
|
|
|
|
email={currentUser.email}
|
|
|
|
name={currentUser.displayName}
|
|
|
|
_id={currentUser._id}
|
|
|
|
profileUrl={currentUser.pageUrl}
|
2017-10-17 10:43:19 +09:00
|
|
|
/> : null;
|
2017-10-17 10:27:40 +09:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Head.components.push([IntercomWrapper, withCurrentUser]);
|