UNPKG

@botonic/react

Version:

Build Chatbots using React

24 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntroMessage = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const constants_1 = require("../../constants"); const styles_1 = require("../../shared/styles"); const environment_1 = require("../../util/environment"); const react_2 = require("../../util/react"); const context_1 = require("../../webchat/context"); const styles_2 = require("./styles"); const IntroMessage = () => { const { getThemeProperty } = (0, react_1.useContext)(context_1.WebchatContext); const animationsEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.enableAnimations); const CustomIntro = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customIntro); const introImage = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.introImage); const introStyle = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.introStyle); const DefaultIntro = introImage && ((0, jsx_runtime_1.jsx)(styles_2.DefaultIntroImage, { style: { ...introStyle, }, src: (0, environment_1.resolveImage)(introImage) })); return CustomIntro || DefaultIntro ? ((0, jsx_runtime_1.jsx)(react_2.ConditionalWrapper, { condition: animationsEnabled, wrapper: children => (0, jsx_runtime_1.jsx)(styles_1.Fade, { children: children }), children: CustomIntro ? (0, jsx_runtime_1.jsx)(CustomIntro, {}) : DefaultIntro })) : null; }; exports.IntroMessage = IntroMessage; //# sourceMappingURL=intro-message.js.map