UNPKG

@botonic/react

Version:

Build Chatbots using React

28 lines 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeApp = void 0; const tslib_1 = require("tslib"); const server_1 = require("react-dom/server"); const react_bot_1 = require("./react-bot"); class NodeApp { constructor(options) { this.bot = new react_bot_1.ReactBot(Object.assign({ renderer: args => this.renderNode(args) }, options)); } renderNode(args) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return (yield this.bot.renderReactActions(args)) .map(action => (0, server_1.renderToStaticMarkup)(action)) .join('\n'); }); } input(args) { return this.bot.input(args); } getConfig() { return Object.entries(this.bot.plugins).map(([_, plugin]) => { return { id: plugin.id, name: plugin.name, config: plugin.config }; }); } } exports.NodeApp = NodeApp; //# sourceMappingURL=node-app.js.map