@botonic/react
Version:
Build Chatbots using React
24 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useNotifications = void 0;
const react_1 = require("react");
const constants_1 = require("../../constants");
const contexts_1 = require("../../contexts");
function useNotifications() {
const { getThemeProperty } = (0, react_1.useContext)(contexts_1.WebchatContext);
const CustomUnreadMessagesBanner = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerCustom, undefined);
const notificationsBannerEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerEnabled, undefined);
const notificationsEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.notificationsEnabled, CustomUnreadMessagesBanner || notificationsBannerEnabled);
const bannerText = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.notificationsBannerText, 'unread messages');
const CustomScrollButton = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.scrollButtonCustom, undefined);
const scrollButtonEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.scrollButtonEnabled, CustomScrollButton);
return {
notificationsEnabled,
bannerText,
CustomUnreadMessagesBanner,
CustomScrollButton,
scrollButtonEnabled,
};
}
exports.useNotifications = useNotifications;
//# sourceMappingURL=use-notifications.js.map