botbuilder-dialogs
Version:
A dialog stack based conversation manager for Microsoft BotBuilder.
83 lines • 3.77 kB
TypeScript
import { TurnContext } from 'botbuilder-core';
import { Choice, ChoiceFactoryOptions } from '../choices';
import { ListStyle, Prompt, PromptOptions, PromptRecognizerResult, PromptValidator } from './prompt';
interface ChoiceDefaultsConfirmPrompt {
[locale: string]: {
choices: (string | Choice)[];
options: ChoiceFactoryOptions;
};
}
/**
* Prompts a user to confirm something with a "yes" or "no" response.
*
* @remarks
* By default the prompt will return to the calling dialog a `boolean` representing the users
* selection.
*/
export declare class ConfirmPrompt extends Prompt<boolean> {
/**
* A dictionary of Default Choices based on [[PromptCultureModels.getSupportedCultures()]].
* Can be replaced by user using the constructor that contains choiceDefaults.
* This is initially set in the constructor.
*/
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;
/**
* Custom list of choices to send for the prompt.
*/
confirmChoices: (string | Choice)[] | undefined;
/**
* Creates a new ConfirmPrompt instance.
*
* @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.
* @param validator (Optional) validator that will be called each time the user responds to the prompt.
* @param defaultLocale (Optional) locale to use if `TurnContext.activity.locale` is not specified. Defaults to a value of `en-us`.
* @param choiceDefaults (Optional) Overrides the dictionary of Default Choices on [[PromptCultureModels.getSupportedCultures()]].
*/
constructor(dialogId: string, validator?: PromptValidator<boolean>, defaultLocale?: string, choiceDefaults?: ChoiceDefaultsConfirmPrompt);
/**
* 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<boolean>>;
/**
* @private
*/
private determineCulture;
}
export {};
//# sourceMappingURL=confirmPrompt.d.ts.map