UNPKG

@botonic/react

Version:

Build Chatbots using React

43 lines (33 loc) 1.1 kB
import { useContext } from 'react' import { WEBCHAT } from '../../constants' import { WebchatContext } from '../../webchat/context' export function useNotifications() { const { getThemeProperty } = useContext(WebchatContext) const CustomUnreadMessagesBanner = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerCustom ) const notificationsBannerEnabled = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerEnabled ) const notificationsEnabled = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.notificationsEnabled, CustomUnreadMessagesBanner || notificationsBannerEnabled ) const bannerText = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerText ) const CustomScrollButton = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.scrollButtonCustom ) const scrollButtonEnabled = getThemeProperty( WEBCHAT.CUSTOM_PROPERTIES.scrollButtonEnabled, CustomScrollButton ) return { notificationsEnabled, bannerText, CustomUnreadMessagesBanner, CustomScrollButton, scrollButtonEnabled, } }