import { Dialog } from './dialog'; import { DialogContext } from './dialogContext'; import { WaterfallStepContext } from './waterfallStepContext'; import { DialogTurnResult } from './dialogTurnResult'; import { DialogReason } from './dialogReason'; /** * Function signature of an individual waterfall step. * * @param O (Optional) type of dialog options passed into the step. * @param step Contextual information for the current step being executed. */ export type WaterfallStep = (step: WaterfallStepContext) => Promise; /** * A waterfall is a dialog that's optimized for prompting a user with a series of questions. * */ export declare class WaterfallDialog extends Dialog { private readonly steps; /** * Creates a new waterfall dialog containing the given array of steps. * * @param dialogId Unique ID of the dialog within the component or set its being added to. * @param steps (Optional) array of asynchronous waterfall step functions. * * @remarks * See the {@link WaterfallDialog.addStep | addStep function} for details on creating a valid step function. */ constructor(dialogId: string, steps?: WaterfallStep[]); /** * Gets the dialog version, composed of the ID and number of steps. * * @returns Dialog version, composed of the ID and number of steps. */ getVersion(): string; /** * Adds a new step to the waterfall. * * @param step Asynchronous step function to call. * @returns Waterfall dialog for fluent calls to `addStep()`. */ addStep(step: WaterfallStep): this; /** * Called when the WaterfallDialog is started and pushed onto the dialog stack. * * @param dialogContext The {@link DialogContext} for the current turn of conversation. * @param options Optional, initial information to pass to the Dialog. * @returns A Promise representing the asynchronous operation. * * @remarks * If the task is successful, the result indicates whether the Dialog is still * active after the turn has been processed by the dialog. * */ beginDialog(dialogContext: DialogContext, options?: O): Promise; /** * Called when the WaterfallDialog is _continued_, where it is the active dialog and the * user replies with a new Activity. * * @param dialogContext The {@link DialogContext} for the current turn of conversation. * @returns A Promise representing the asynchronous operation. * * @remarks * If the task is successful, the result indicates whether the dialog is still * active after the turn has been processed by the dialog. The result may also contain a * return value. * */ continueDialog(dialogContext: DialogContext): Promise; /** * Called when a child WaterfallDialog completed its turn, returning control to this dialog. * * @param dc The {@link DialogContext} for the current turn of the conversation. * @param reason DialogReason why the dialog resumed. * @param result Optional, value returned from the dialog that was called. The type * of the value returned is dependent on the child dialog. * @returns A Promise representing the asynchronous operation. */ resumeDialog(dc: DialogContext, reason: DialogReason, result?: any): Promise; /** * Called when an individual waterfall step is being executed. * * @param step Context object for the waterfall step to execute. * @returns A promise with the DialogTurnResult. * * @remarks * SHOULD be overridden by derived class that want to add custom logging semantics. * */ protected onStep(step: WaterfallStepContext): Promise; /** * Executes a step of the WaterfallDialog. * * @param dc The {@link DialogContext} for the current turn of conversation. * @param index The index of the current waterfall step to execute. * @param reason The DialogReason the waterfall step is being executed. * @param result Optional, result returned by a dialog called in the previous waterfall step. * @returns A Promise that represents the work queued to execute. */ protected runStep(dc: DialogContext, index: number, reason: DialogReason, result?: any): Promise; /** * Identifies the step name by its position index. * * @param index Step position * @returns A string that identifies the step name. */ private waterfallStepName; }