UNPKG

@botonic/react

Version:

Build Chatbots using React

27 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultichannelReply = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const core_1 = require("@botonic/core"); const react_1 = require("react"); const contexts_1 = require("../../contexts"); const constants_1 = require("../constants"); 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, { ...props, children: props.children }); } }; exports.MultichannelReply = MultichannelReply; exports.MultichannelReply.displayName = constants_1.COMPONENT_DISPLAY_NAMES.MultichannelReply; //# sourceMappingURL=multichannel-reply.js.map