DialogContainer class
A container for a set of Dialogs.
- Extends
-
Dialog<O>
Constructors
Dialog |
Creates a new instance of the Dialog class. |
Inherited Properties
End |
Gets a default end-of-turn result. |
Methods
create |
Creates an inner dialog context for the containers active child. |
find |
Finds a child dialog that was previously added to the container. |
on |
Called when an event has been raised, using |
Inherited Methods
begin |
When overridden in a derived class, starts the dialog. |
configure(Record<string, unknown>) | Fluent method for configuring the object. |
continue |
When overridden in a derived class, continues the dialog. |
end |
When overridden in a derived class, performs clean up for the dialog before it ends. |
get |
Gets the converter for the selector configuration. * |
get |
An encoded string used to aid in the detection of agent changes on re-deployment. |
reprompt |
When overridden in a derived class, prompts the user again for input. |
resume |
When overridden in a derived class, resumes the dialog after the dialog above it on the stack completes. |
Constructor Details
DialogContainer<O>(string)
Creates a new instance of the Dialog class.
new DialogContainer(dialogId?: string)
Parameters
- dialogId
-
string
Optional. unique ID of the dialog.
Property Details
dialogs
id
Unique ID of the dialog.
string id
Property Value
string
The Id for the dialog.
Inherited Property Details
EndOfTurn
Gets a default end-of-turn result.
static EndOfTurn: DialogTurnResult<any>
Property Value
DialogTurnResult<any>
Remarks
This result indicates that a dialog (or a logical step within a dialog) has completed processing for the current turn, is still active, and is waiting for more input.
Inherited From Dialog.EndOfTurn
Method Details
createChildContext(DialogContext)
Creates an inner dialog context for the containers active child.
function createChildContext(dialogContext: DialogContext): undefined | DialogContext
Parameters
- dialogContext
- DialogContext
Parents dialog context.
Returns
undefined | DialogContext
A new dialog context for the active child or undefined
if there is no active child.
findDialog(string)
Finds a child dialog that was previously added to the container.
function findDialog(dialogId: string): undefined | Dialog<{}>
Parameters
- dialogId
-
string
ID of the dialog to lookup.
Returns
undefined | Dialog<{}>
The Dialog if found; otherwise null.
onDialogEvent(DialogContext, DialogEvent)
Called when an event has been raised, using DialogContext.emitEvent()
,
by either the current dialog or a dialog that the current dialog started.
function onDialogEvent(dialogContext: DialogContext, event: DialogEvent): Promise<boolean>
Parameters
- dialogContext
- DialogContext
The dialog context for the current turn of conversation.
- event
- DialogEvent
The event being raised.
Returns
Promise<boolean>
True if the event is handled by the current dialog and bubbling should stop.
Inherited Method Details
beginDialog(DialogContext, O)
When overridden in a derived class, starts the dialog.
function beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult<any>>
Parameters
The context for the current dialog turn.
- options
-
O
Optional. Arguments to use when the dialog starts.
Returns
Promise<DialogTurnResult<any>>
Remarks
Derived dialogs must override this method.
The DialogContext calls this method when it creates a new DialogInstance for this dialog, pushes it onto the dialog stack, and starts the dialog.
A dialog that represents a single-turn conversation should await endDialog before exiting this method.
Inherited From Dialog.beginDialog
configure(Record<string, unknown>)
Fluent method for configuring the object.
function configure(config: Record<string, unknown>): DialogContainer<O>
Parameters
- config
-
Record<string, unknown>
Configuration settings to apply.
Returns
The Configurable after the operation is complete.
Inherited From Dialog.configure
continueDialog(DialogContext)
When overridden in a derived class, continues the dialog.
function continueDialog(dc: DialogContext): Promise<DialogTurnResult<any>>
Parameters
The context for the current dialog turn.
Returns
Promise<DialogTurnResult<any>>
A promise resolving to the dialog turn result.
Remarks
Derived dialogs that support multiple-turn conversations should override this method. By default, this method signals that the dialog is complete and returns.
The DialogContext calls this method when it continues the dialog.
To signal to the dialog context that this dialog has completed, await endDialog before exiting this method.
Inherited From Dialog.continueDialog
endDialog(TurnContext, DialogInstance<any>, DialogReason)
When overridden in a derived class, performs clean up for the dialog before it ends.
function endDialog(_context: TurnContext, _instance: DialogInstance<any>, _reason: DialogReason): Promise<void>
Parameters
- _context
- TurnContext
The context object for the turn.
- _instance
-
DialogInstance<any>
Current state information for this dialog.
- _reason
- DialogReason
The reason the dialog is ending.
Returns
Promise<void>
Remarks
Derived dialogs that need to perform logging or cleanup before ending should override this method. By default, this method has no effect.
The DialogContext calls this method when the current dialog is ending.
Inherited From Dialog.endDialog
getConverter(string)
Gets the converter for the selector configuration. *
function getConverter(_property: string): Converter<unknown, unknown> | ConverterFactory<unknown, unknown>
Parameters
- _property
-
string
The key of the conditional selector configuration. *
Returns
Converter<unknown, unknown> | ConverterFactory<unknown, unknown>
The converter for the selector configuration.
Inherited From Dialog.getConverter
getVersion()
An encoded string used to aid in the detection of agent changes on re-deployment.
function getVersion(): string
Returns
string
Unique string which should only change when dialog has changed in a way that should restart the dialog.
Remarks
This defaults to returning the dialog's id
but can be overridden to provide more
precise change detection logic. Any dialog on the stack that has its version change will
result in a versionChanged
event will be raised. If this event is not handled by the agent,
an error will be thrown resulting in the agent error handler logic being run.
Returning an empty string will disable version tracking for the component all together.
Inherited From Dialog.getVersion
repromptDialog(TurnContext, DialogInstance<any>)
When overridden in a derived class, prompts the user again for input.
function repromptDialog(_context: TurnContext, _instance: DialogInstance<any>): Promise<void>
Parameters
- _context
- TurnContext
The context object for the turn.
- _instance
-
DialogInstance<any>
Current state information for this dialog.
Returns
Promise<void>
Remarks
Derived dialogs that support validation and re-prompt logic should override this method. By default, this method has no effect.
The DialogContext calls this method when the current dialog should re-request input from the user. This method is implemented for prompt dialogs.
Inherited From Dialog.repromptDialog
resumeDialog(DialogContext, DialogReason, any)
When overridden in a derived class, resumes the dialog after the dialog above it on the stack completes.
function resumeDialog(dc: DialogContext, reason: DialogReason, result?: any): Promise<DialogTurnResult<any>>
Parameters
The context for the current dialog turn.
- reason
- DialogReason
The reason the dialog is resuming. This will typically be DialogReason.endCalled
- result
-
any
Optional. The return value, if any, from the dialog that ended.
Returns
Promise<DialogTurnResult<any>>
A promise resolving to the dialog turn result.
Remarks
Derived dialogs that support multiple-turn conversations should override this method. By default, this method signals that the dialog is complete and returns.
The DialogContext calls this method when it resumes
the dialog. If the previous dialog on the stack returned a value, that value is in the result
parameter.
To start a child dialog, use beginDialog or prompt; however, this dialog will not necessarily be the one that started the child dialog. To signal to the dialog context that this dialog has completed, await endDialog before exiting this method.
Inherited From Dialog.resumeDialog