UNPKG

@botonic/react

Version:

Build Chatbots using React

25 lines 857 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeApp = void 0; 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)); } async renderNode(args) { return (await 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