我正在尝试将对讲机实现到一个ReactJS应用程序中。我已经遵循了他们的单一页面应用程序说明。我有个问题(也许是故意的?)如果不向用户发送消息,右下角的小对讲机按钮就不会显示出来。我希望按钮始终是用户可以看到的。当我第一次集成时,我能够让按钮显示出来,并且能够以用户的身份发送消息没有问题,但是在对代码进行了一些修改之后,我似乎已经把它弄坏了。到目前为止,我得到的是:
store.js
import createStore from 'redux';
export default createStore( ... );intercom.js
import store from './store';
const APP_ID = /* app id */;
/* the intercom JS library */
const updated = false;
window.onload = () => {
Intercom('boot', { app_id: APP_ID };
store.subscribe(() => {
if (typeof document === 'undefined') return;
const state = store.getState();
const currentUser = currentUserSelector(state);
if (currentUser && !updated) {
updated = true;
Intercom('update', {
email: currentUser.email,
user_id: currentUser.id,
name: `${ currentUser.firstName } ${ currentUser.lastName }`
});
}
});
}当应用程序加载时,我在其中一个文件中有require('intercom.js')。
控制台中没有错误,内部通讯套接字显示在Chrome的dev中。控制台,当收到消息时,客户端会打开,但是当页面加载时,我无法让它显示出来。
提前谢谢。
(我将其标记为React,因为它是一个React应用程序-我不认为这与React有任何关系,但可能有一些副作用我不知道)。
发布于 2017-03-27 17:52:58
啊,好吧-简单的错误。原来我订阅的计划不支持非访客聊天。我必须“升级”到“解决Lite”计划-此时,我可以更改信使行为,在信使设置视图中将按钮/信使显示为“用户”。
https://stackoverflow.com/questions/43007451
复制相似问题