UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

112 lines (111 loc) 4.95 kB
/** * @module botbuilder-dialogs-adaptive */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Activity } from 'botbuilder'; import { ChoiceSet } from './choiceSet'; import { EnumProperty, ObjectProperty, StringProperty } from '../properties'; import { InputDialog, InputDialogConfiguration, InputState } from './inputDialog'; import { EnumExpression, ObjectExpression, StringExpression } from 'adaptive-expressions'; import { Choice, ChoiceFactoryOptions, Converter, ConverterFactory, DialogContext, DialogStateManager, FindChoicesOptions, ListStyle, TemplateInterface } from 'botbuilder-dialogs'; export declare enum ChoiceOutputFormat { value = "value", index = "index" } export interface ChoiceInputOptions { choices: Choice[]; } export interface ChoiceInputConfiguration extends InputDialogConfiguration { choices?: ObjectProperty<ChoiceSet>; style?: EnumProperty<ListStyle>; defaultLocale?: StringProperty; outputFormat?: EnumProperty<ChoiceOutputFormat>; choiceOptions?: ObjectProperty<ChoiceFactoryOptions>; recognizerOptions?: ObjectProperty<FindChoicesOptions>; } /** * ChoiceInput - Declarative input to gather choices from user. */ export declare class ChoiceInput extends InputDialog implements ChoiceInputConfiguration { static $kind: string; /** * Default options for rendering the choices to the user based on locale. */ private static defaultChoiceOptions; /** * List of choices to present to user. */ choices: ObjectExpression<ChoiceSet>; /** * Style of the "yes" and "no" choices rendered to the user when prompting. * * @remarks * Defaults to `ListStyle.auto`. */ style: EnumExpression<ListStyle>; /** * The prompts default locale that should be recognized. */ defaultLocale?: StringExpression; /** * Control the format of the response (value or index of the choice). */ outputFormat: EnumExpression<ChoiceOutputFormat>; /** * Additional options passed to the `ChoiceFactory` and used to tweak the style of choices * rendered to the user. */ choiceOptions?: ObjectExpression<ChoiceFactoryOptions>; /** * Additional options passed to the underlying `recognizeChoices()` function. */ recognizerOptions?: ObjectExpression<FindChoicesOptions>; /** * @param property The key of the conditional selector configuration. * @returns The converter for the selector configuration. */ getConverter(property: keyof ChoiceInputConfiguration): Converter | ConverterFactory; /** * {@inheritDoc InputDialog.trackGeneratorResultEvent} * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param activityTemplate Used to create the Activity. * @param msg The Partial [Activity](xref:botframework-schema.Activity) which will be sent. */ protected trackGeneratorResultEvent(dc: DialogContext, activityTemplate: TemplateInterface<Partial<Activity>, DialogStateManager>, msg: Partial<Activity>): void; /** * @protected * Method which processes options. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param options Optional, initial information to pass to the dialog. * @returns The modified [ChoiceInputOptions](xref:botbuilder-dialogs-adaptive.ChoiceInputOptions) options. */ protected onInitializeOptions(dc: DialogContext, options: ChoiceInputOptions): Promise<ChoiceInputOptions>; /** * @protected * Called when input has been received. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @returns [InputState](xref:botbuilder-dialogs-adaptive.InputState) which reflects whether input was recognized as valid or not. */ protected onRecognizeInput(dc: DialogContext): Promise<InputState>; /** * @protected * Method which renders the prompt to the user given the current input state. * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param state Dialog [InputState](xref:botbuilder-dialogs-adaptive.InputState). * @returns An [Activity](xref:botframework-schema.Activity) `Promise` representing the asynchronous operation. */ protected onRenderPrompt(dc: DialogContext, state: InputState): Promise<Partial<Activity>>; /** * @protected * @returns A `string` representing the compute Id. */ protected onComputeId(): string; private getChoiceOptions; private getChoiceSet; private determineCulture; } //# sourceMappingURL=choiceInput.d.ts.map