diff --git a/packages/botonic-core/index.d.ts b/packages/botonic-core/index.d.ts index 09900c9ff6..13658602ae 100644 --- a/packages/botonic-core/index.d.ts +++ b/packages/botonic-core/index.d.ts @@ -55,19 +55,30 @@ export declare function storeCaseRating( rating: number ): Promise +interface BotOptions { + routes: Routes + locales: Locales + integrations?: { [id: string]: any } + theme?: string + /** The plugin configurations */ + plugins?: { [id: string]: any } + appId?: string + defaultTyping?: number + defaultDelay?: number +} type Routes = Route[] | ((_: { input: Input; session: Session }) => Route[]) export class CoreBot { - constructor(_: { - routes: Routes - locales: Locales - integrations?: { [id: string]: any } - theme?: string - plugins?: { [id: string]: any } - appId?: string - defaultTyping?: number - defaultDelay?: number - }) + routes: Routes + locales: Locales; + integrations?: {[id: string]: any}; + theme?: string; + /** The instantiated plugin instances */ + plugins: { [id: string]: any}; + defaultTyping : number; + defaultDelay : number; + + constructor(options: BotOptions) getString(stringID: string, session: Session): string diff --git a/packages/botonic-react/index.d.ts b/packages/botonic-react/index.d.ts index a41679e34a..3d363ef475 100644 --- a/packages/botonic-react/index.d.ts +++ b/packages/botonic-react/index.d.ts @@ -1,3 +1,4 @@ +import { Input, Locales, Routes, Session } from '@botonic/core'; import * as React from 'react' import * as core from '@botonic/core' @@ -47,6 +48,23 @@ export class Title extends React.Component {} export class Subtitle extends React.Component {} export class Element extends React.Component {} +export class NodeApp { + constructor(options: core.BotOptions); + + renderNode(args): string; + + input(_: { + input: Input + session?: Session + lastRoutePath: string + }): { + input: Input + response: React.ReactNode + session: Session + lastRoutePath: string + } +} + // Parameters of the actions' botonicInit method export interface ActionInitInput { input: core.Input @@ -57,7 +75,7 @@ export interface ActionInitInput { } export class BotonicInputTester { - constructor(app: core.CoreBot) + constructor(app: NodeApp) text( inp: string, @@ -73,7 +91,7 @@ export class BotonicInputTester { } export class BotonicOutputTester { - constructor(app: core.CoreBot) + constructor(app: NodeApp) text(out: string, replies?: any): Promise }