UNPKG

@botonic/react

Version:

Build Chatbots using React

25 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultichannelReply = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const core_1 = require("@botonic/core"); const react_1 = tslib_1.__importStar(require("react")); const contexts_1 = require("../../contexts"); const reply_1 = require("../reply"); const MultichannelReply = props => { const requestContext = (0, react_1.useContext)(contexts_1.RequestContext); const hasPath = () => Boolean(props.path); const hasPayload = () => Boolean(props.payload); const getText = () => `${props.children}`; if ((0, core_1.isWhatsapp)(requestContext.session)) { if (hasPath() || hasPayload()) return `${getText()}`; return null; } else { return (0, jsx_runtime_1.jsx)(reply_1.Reply, Object.assign({}, props, { children: props.children })); } }; exports.MultichannelReply = MultichannelReply; //# sourceMappingURL=multichannel-reply.js.map