Feature: Contact Panel with conversation details (#397)
* Add Contact panel changes * Fix parent iframe blocked * Add Conversation Panel, Contact messages * Update contact panel with conversation details * Update designs in sidebar * Fix specs * Specs: Add specs for conversationMetadata and contact modules * Fix currentUrl issues * Fix spelling * Set default to empty string
This commit is contained in:
@@ -126,14 +126,15 @@ const IFrameHelper = {
|
||||
}
|
||||
iframe.src = widgetUrl;
|
||||
|
||||
iframe.id = 'chatwoot_web_widget';
|
||||
iframe.id = 'chatwoot_live_chat_widget';
|
||||
iframe.style.visibility = 'hidden';
|
||||
holder.className = 'woot-widget-holder woot--hide';
|
||||
holder.appendChild(iframe);
|
||||
body.appendChild(holder);
|
||||
IFrameHelper.initPostMessageCommunication();
|
||||
IFrameHelper.initLocationListener();
|
||||
},
|
||||
getAppFrame: () => document.getElementById('chatwoot_web_widget'),
|
||||
getAppFrame: () => document.getElementById('chatwoot_live_chat_widget'),
|
||||
sendMessage: (key, value) => {
|
||||
const element = IFrameHelper.getAppFrame();
|
||||
element.contentWindow.postMessage(
|
||||
@@ -154,9 +155,15 @@ const IFrameHelper = {
|
||||
Cookies.set('cw_conversation', message.config.authToken);
|
||||
IFrameHelper.sendMessage('config-set', {});
|
||||
IFrameHelper.onLoad(message.config.channelConfig);
|
||||
IFrameHelper.setCurrentUrl();
|
||||
}
|
||||
};
|
||||
},
|
||||
initLocationListener: () => {
|
||||
window.onhashchange = () => {
|
||||
IFrameHelper.setCurrentUrl();
|
||||
};
|
||||
},
|
||||
onLoad: ({ widget_color: widgetColor }) => {
|
||||
const iframe = IFrameHelper.getAppFrame();
|
||||
iframe.style.visibility = '';
|
||||
@@ -187,6 +194,12 @@ const IFrameHelper = {
|
||||
bubbleHolder.appendChild(createNotificationBubble());
|
||||
onClickChatBubble();
|
||||
},
|
||||
setCurrentUrl: () => {
|
||||
console.log(IFrameHelper.getAppFrame(), document);
|
||||
IFrameHelper.sendMessage('set-current-url', {
|
||||
refererURL: window.location.href,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
function loadIframe({ baseUrl, websiteToken }) {
|
||||
|
||||
Reference in New Issue
Block a user