1- import ChatBot , { Flow , Params } from "react-chatbotify" ;
2-
3- import RcbPlugin from "./factory/RcbPluginFactory" ;
4- import { HtmlRendererBlock } from "./types/HtmlRendererBlock" ;
5- import HtmlWrapper from "./components/HtmlWrapper" ;
6-
7- const App = ( ) => {
8- // initialize the plugin
9- const plugins = [ RcbPlugin ( { htmlComponent : HtmlWrapper } ) ] ;
10-
11- // example flow for testing
12- const flow : Flow = {
13- start : {
14- message : "<h4>Hello! I'm rendering messages in html, you can type to me in html too!</h4>" ,
15- path : "loop" ,
16- renderHtml : [ "BOT" , "USER" ] ,
17- } as HtmlRendererBlock ,
18- loop : {
19- message : async ( params : Params ) => {
20- await params . injectMessage ( `This is pretty cool <b>isn't it?</b>!` ) ;
21- } ,
22- chatDisabled : false ,
23- path : "loop" ,
24- renderHtml : [ "BOT" , "USER" ] ,
25- } as HtmlRendererBlock ,
26- }
27-
28- return (
29- < ChatBot
30- id = "chatbot-id"
31- plugins = { plugins }
32- flow = { flow }
33- > </ ChatBot >
34- ) ;
35- }
36-
37- export default App ;
1+ import ChatBot , { Flow , Params } from 'react-chatbotify' ;
2+
3+ import RcbPlugin from './factory/RcbPluginFactory' ;
4+ import { HtmlRendererBlock } from './types/HtmlRendererBlock' ;
5+ import HtmlWrapper from './components/HtmlWrapper' ;
6+
7+ const App = ( ) => {
8+ // initialize the plugin
9+ const plugins = [ RcbPlugin ( { htmlComponent : HtmlWrapper } ) ] ;
10+
11+ // example flow for testing
12+ const flow : Flow = {
13+ start : {
14+ message : "<h4>Hello! I'm rendering messages in html, you can type to me in html too!</h4>" ,
15+ path : 'loop' ,
16+ renderHtml : [ 'BOT' , 'USER' ] ,
17+ } as HtmlRendererBlock ,
18+ loop : {
19+ message : async ( params : Params ) => {
20+ await params . injectMessage ( `This is pretty cool <b>isn't it?</b>!` ) ;
21+ } ,
22+ chatDisabled : false ,
23+ path : 'loop' ,
24+ renderHtml : [ 'BOT' , 'USER' ] ,
25+ } as HtmlRendererBlock ,
26+ } ;
27+
28+ return < ChatBot id = "chatbot-id" plugins = { plugins } flow = { flow } > </ ChatBot > ;
29+ } ;
30+
31+ export default App ;
0 commit comments