mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			916 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			916 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
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 = 48 + unreadMessageWrap.scrollHeight;
 | 
						|
  if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
 | 
						|
  if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
 | 
						|
 | 
						|
  return extraHeight;
 | 
						|
};
 |