botbuilder-dialogs
Version:
A dialog stack based conversation manager for Microsoft BotBuilder.
87 lines • 4 kB
TypeScript
/**
* @module botbuilder-dialogs
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { TurnContext } from 'botbuilder-core';
import { ChoiceFactoryOptions, FindChoicesOptions, FoundChoice } from '../choices';
import { ListStyle, Prompt, PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt';
interface ChoiceDefaultsChoicePrompt {
[locale: string]: ChoiceFactoryOptions;
}
/**
* Prompts a user to select from a list of choices.
*
* @remarks
* By default the prompt will return to the calling dialog a `FoundChoice` object containing the
* choice that was selected.
*/
export declare class ChoicePrompt extends Prompt<FoundChoice> {
/**
* A dictionary of Default Choices based on [[PromptCultureModels.getSupportedCultures()]].
* Can be replaced by user using the constructor that contains choiceDefaults.
*/
private choiceDefaults;
/**
* The prompts default locale that should be recognized.
*/
defaultLocale: string | undefined;
/**
* Style of the "yes" and "no" choices rendered to the user when prompting.
*
* @remarks
* Defaults to `ListStyle.auto`.
*/
style: ListStyle;
/**
* Additional options passed to the `ChoiceFactory` and used to tweak the style of choices
* rendered to the user.
*/
choiceOptions: ChoiceFactoryOptions | undefined;
/**
* Additional options passed to the underlying `recognizeChoices()` function.
*/
recognizerOptions: FindChoicesOptions | undefined;
/**
* Creates a new `ChoicePrompt` instance.
*
* @param dialogId Unique ID of the dialog within its parent `DialogSet`.
* @param validator (Optional) validator that will be called each time the user responds to the prompt. If the validator replies with a message no additional retry prompt will be sent.
* @param defaultLocale (Optional) locale to use if `dc.context.activity.locale` not specified. Defaults to a value of `en-us`.
* @param choiceDefaults (Optional) Overrides the dictionary of Bot Framework SDK-supported _choiceDefaults (for prompt localization).
* Must be passed in to each ConfirmPrompt that needs the custom choice defaults.
*/
constructor(dialogId: string, validator?: PromptValidator<FoundChoice>, defaultLocale?: string, choiceDefaults?: ChoiceDefaultsChoicePrompt);
/**
* 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 `true` if this is the first time this prompt dialog instance
* on the stack is prompting the user for input; otherwise, false.
* @returns A `Promise` representing the asynchronous operation.
*/
protected onPrompt(context: TurnContext, state: any, options: PromptOptions, isRetry: boolean): Promise<void>;
/**
* Attempts to recognize the user's 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.
* @returns A `Promise` representing the asynchronous operation.
*/
protected onRecognize(context: TurnContext, state: any, options: PromptOptions): Promise<PromptRecognizerResult<FoundChoice>>;
/**
* @private
*/
private determineCulture;
}
export {};
//# sourceMappingURL=choicePrompt.d.ts.map