UNPKG

botbuilder-dialogs-adaptive

Version:

Rule system for the Microsoft BotBuilder dialog system.

151 lines 7 kB
/** * @module botbuilder-dialogs-adaptive */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Activity, TurnContext } from 'botbuilder'; import { BoolProperty, StringProperty, TemplateInterfaceProperty } from '../properties'; import { BoolExpression, StringExpression } from 'adaptive-expressions'; import { BeginSkillDialogOptions, Converter, ConverterFactory, DialogContext, DialogTurnResult, DialogInstance, DialogReason, DialogConfiguration, DialogEvent, DialogStateManager, SkillDialog, SkillDialogOptions, TemplateInterface } from 'botbuilder-dialogs'; export interface BeginSkillConfiguration extends DialogConfiguration { disabled?: BoolProperty; activityProcessed?: BoolProperty; resultProperty?: StringProperty; botId?: StringProperty; skillHostEndpoint?: StringProperty; skillAppId?: StringProperty; skillEndpoint?: StringProperty; activity?: TemplateInterfaceProperty<Partial<Activity>, DialogStateManager>; connectionName?: StringProperty; allowInterruptions?: BoolProperty; } /** * Begin a Skill. */ export declare class BeginSkill extends SkillDialog implements BeginSkillConfiguration { static $kind: string; /** * Optional expression which if is true will disable this action. */ disabled?: BoolExpression; /** * Value indicating whether the new dialog should process the activity. * * @remarks * The default for this will be true, which means the new dialog should not look at the activity. * You can set this to false to dispatch the activity to the new dialog. */ activityProcessed: BoolExpression; /** * Optional property path to store the dialog result in. */ resultProperty?: StringExpression; /** * The Microsoft App ID that will be calling the skill. * * @remarks * Defauls to a value of `=settings.MicrosoftAppId` which retrievs the bots ID from settings. */ botId: StringExpression; /** * The callback Url for the skill host. * * @remarks * Defauls to a value of `=settings.SkillHostEndpoint` which retrieves the endpoint from settings. */ skillHostEndpoint: StringExpression; /** * The Microsoft App ID for the skill. */ skillAppId: StringExpression; /** * The `/api/messages` endpoint for the skill. */ skillEndpoint: StringExpression; /** * Template for the activity. */ activity: TemplateInterface<Partial<Activity>, DialogStateManager>; /** * Optional. The OAuth Connection Name for the Parent Bot. */ connectionName: StringExpression; /** * The interruption policy. */ allowInterruptions: BoolExpression; /** * @param property The key of the conditional selector configuration. * @returns The converter for the selector configuration. */ getConverter(property: keyof BeginSkillConfiguration): Converter | ConverterFactory; private _dialogOptionsStateKey; /** * Creates a new `BeginSkillDialog instance. * * @param options Optional options used to configure the skill dialog. */ constructor(options?: SkillDialogOptions); /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) is started and pushed onto the dialog stack. * * @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 A `Promise` representing the asynchronous operation. */ beginDialog(dc: DialogContext, options?: BeginSkillDialogOptions): Promise<DialogTurnResult>; /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) is _continued_, where it is the active dialog and the * user replies 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. */ continueDialog(dc: DialogContext): Promise<DialogTurnResult>; /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) should re-prompt the user for input. * * @param turnContext [TurnContext](xref:botbuilder-core.TurnContext), the context object for this turn. * @param instance [DialogInstance](xref:botbuilder-dialogs.DialogInstance), state information for this dialog. * @returns A `Promise` representing the asynchronous operation. */ repromptDialog(turnContext: TurnContext, instance: DialogInstance): Promise<void>; /** * Called when a child [Dialog](xref:botbuilder-dialogs.Dialog) completed its turn, returning control to this dialog. * * @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation. * @param reason [DialogReason](xref:botbuilder-dialogs.DialogReason), reason 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<DialogTurnResult<any>>; /** * Called when the [Dialog](xref:botbuilder-dialogs.Dialog) is ending. * * @param turnContext [TurnContext](xref:botbuilder-core.TurnContext), the context object for this turn. * @param instance [DialogInstance](xref:botbuilder-dialogs.DialogInstance), state information associated with the instance of this dialog on the dialog stack. * @param reason [DialogReason](xref:botbuilder-dialogs.DialogReason), reason why the dialog ended. * @returns A `Promise` representing the asynchronous operation. */ endDialog(turnContext: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void>; /** * @protected * Builds the compute Id for the [Dialog](xref:botbuilder-dialogs.Dialog). * @returns A `string` representing the compute Id. */ protected onComputeId(): string; protected onPreBubbleEvent(dc: DialogContext, e: DialogEvent): Promise<boolean>; /** * @private * Regenerates the [SkillDialog.DialogOptions](xref:botbuilder-dialogs.SkillDialog.DialogOptions) based on the values used during the `BeginDialog` call. * @remarks The [Dialog](xref:botbuilder-dialogs.Dialog) can be resumed in another server or after redeploying the bot, this code ensure that the options used are the ones * used to call `BeginDialog`. * Also, if `ContinueConversation` or other methods are called on a server different than the one where `BeginDialog` was called, * `DialogOptions` will be empty and this code will make sure it has the right value. */ private loadDialogOptions; } //# sourceMappingURL=beginSkill.d.ts.map