chore: Move referrerHost to appConfig store (#3433)
This commit is contained in:
parent
1be7c2d72c
commit
1a8b8f0900
11 changed files with 138 additions and 81 deletions
27
app/javascript/widget/helpers/IframeEventHelper.js
Normal file
27
app/javascript/widget/helpers/IframeEventHelper.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
export const loadedEventConfig = () => {
|
||||
return {
|
||||
event: 'loaded',
|
||||
config: {
|
||||
authToken: window.authToken,
|
||||
channelConfig: window.chatwootWebChannel,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const getExtraSpaceToScroll = () => {
|
||||
// This function calculates the extra space needed for the view to
|
||||
// accomodate the height of close button + height of
|
||||
// read messages button. So that scrollbar won't appear
|
||||
const unreadMessageWrap = document.querySelector('.unread-messages');
|
||||
const unreadCloseWrap = document.querySelector('.close-unread-wrap');
|
||||
const readViewWrap = document.querySelector('.open-read-view-wrap');
|
||||
|
||||
if (!unreadMessageWrap) return 0;
|
||||
|
||||
// 24px to compensate the paddings
|
||||
let extraHeight = 24 + unreadMessageWrap.scrollHeight;
|
||||
if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
|
||||
if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
||||
|
||||
return extraHeight;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue