UNPKG

botbuilder-dialogs

Version:

A dialog stack based conversation manager for Microsoft BotBuilder.

102 lines 5.33 kB
/** * @module botbuilder-dialogs */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Activity, TurnContext } from 'botbuilder-core'; import { Dialog, DialogInstance, DialogReason, DialogTurnResult } from '../dialog'; import { DialogContext } from '../dialogContext'; import { PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt'; /** * Waits for an activity to be received. * * @remarks * This prompt requires a validator be passed in and is useful when waiting for non-message * activities like an event to be received. The validator can ignore received events until the * expected activity is received. */ export declare class ActivityPrompt extends Dialog { private validator; /** * Creates a new ActivityPrompt instance. * * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`. * @param validator Validator that will be called each time a new activity is received. */ constructor(dialogId: string, validator: PromptValidator<Activity>); /** * Called when a prompt dialog is pushed onto the dialog stack and is being activated. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current * turn of the conversation. * @param options [PromptOptions](xref:botbuilder-dialogs.PromptOptions), additional * information to pass to the prompt being started. * @returns A `Promise` representing the asynchronous operation. * @remarks * If the promise is successful, the result indicates whether the prompt is still * active after the turn has been processed by the prompt. */ beginDialog(dc: DialogContext, options: PromptOptions): Promise<DialogTurnResult>; /** * Called when a prompt dialog is the active dialog and the user replied with a new activity. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current * turn of conversation. * @returns A `Promise` representing the asynchronous operation. * @remarks * If the promise is successful, the result indicates whether the dialog is still * active after the turn has been processed by the dialog. * The prompt generally continues to receive the user's replies until it accepts the * user's reply as valid input for the prompt. */ continueDialog(dc: DialogContext): Promise<DialogTurnResult>; /** * Called when a prompt dialog resumes being the active dialog on the dialog stack, such as * when the previous active dialog on the stack completes. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn * of the conversation. * @param _reason [DialogReason](xref:botbuilder-dialogs.DialogReason), an enum indicating why * the dialog resumed. * @param _result Optional. Value returned from the previous dialog on the stack. * The type of the value returned is dependent on the previous dialog. * @returns A `Promise` representing the asynchronous operation. */ resumeDialog(dc: DialogContext, _reason: DialogReason, _result?: any): Promise<DialogTurnResult>; /** * Called when a prompt dialog has been requested to re-prompt the user for input. * * @param context [TurnContext](xref:botbuilder-core.TurnContext), context for the current * turn of conversation with the user. * @param instance [DialogInstance](xref:botbuilder-dialogs.DialogInstance), the instance * of the dialog on the stack. * @returns A `Promise` representing the asynchronous operation. */ repromptDialog(context: TurnContext, instance: DialogInstance): Promise<void>; /** * When overridden in a derived class, prompts the user for input. * * @param context [TurnContext](xref:botbuilder-core.TurnContext), context for the current * turn of conversation with the user. * @param state Contains state for the current instance of the prompt on the dialog stack. * @param options A [PromptOptions](xref:botbuilder-dialogs.PromptOptions) object constructed * from the options initially provided in the call to Prompt. * @param isRetry A boolean representing if the prompt is a retry. * @returns A `Promise` representing the asynchronous operation. */ protected onPrompt(context: TurnContext, state: object, options: PromptOptions, isRetry: boolean): Promise<void>; /** * When overridden in a derived class, attempts to recognize the incoming [Activity](xref:botframework-schema.Activity). * * @param context [TurnContext](xref:botbuilder-core.TurnContext), context for the current * turn of conversation with the user. * @param _state Contains state for the current instance of the prompt on the dialog stack. * @param _options A [PromptOptions](xref:botbuilder-dialogs.PromptOptions) object constructed * from the options initially provided in the call to Prompt. * @returns A `Promise` representing the asynchronous operation. */ protected onRecognize(context: TurnContext, _state: object, _options: PromptOptions): Promise<PromptRecognizerResult<Activity>>; } //# sourceMappingURL=activityPrompt.d.ts.map