Rate this page:

AvatarFormState

Avatar form state object that describes a form state and implements the logic of transitions, reactions and form filling.

Props

attempts

Copy URL
attempts: 

number

|

undefined

Optional. Number of attempts to fill the form. The default values is 3

beforeExit

Copy URL
beforeExit: 

(event: AvatarStateChangeEvent) => void,Promise<void>

|

undefined

Callback function when the dialogue leaves the state

clearParameter

Copy URL
clearParameter: 

(name: string) => void

Clears a specific form state's parameter by name

clearParameters

Copy URL
clearParameters: 

() => void

Clears all the form state's parameters

exitIntents

Copy URL
exitIntents: 

string[]

Optional. List of utterances to exit the form state

getParameter

Copy URL
getParameter: 

(name: string) => AvatarFormStateParameter

Gets a specific parameter from the form state by name

getParameters

Copy URL
getParameters: 

() => AvatarFormStateParameter[]

Gets all the parameters from the form state

isFormComplete

Copy URL
isFormComplete: 

boolean

Whether the form state is complete

name

Copy URL
name: 

string

State name

onEnter

Copy URL
onEnter: 

(event: AvatarStateChangeEvent) => AvatarResponse,Promise<AvatarResponse>

|

undefined

Callback function when the dialogue enters the state

onExitIntent

Copy URL
onExitIntent: 

(utteranceResponse: AvatarUtteranceEvent) => AvatarResponse,Promise<AvatarResponse>

|

undefined

Triggered when an exit intent is occurred

onFormComplete

Copy URL
onFormComplete: 

(formData: AvatarFormState) => AvatarResponse,Promise<AvatarResponse>

|

undefined

Triggered when form filling is successfully completed

onFormFailed

Copy URL
onFormFailed: 

(formData: AvatarFormState) => AvatarResponse,Promise<AvatarResponse>

Triggered when form filling is failed.
NOTE: this is a required callback, if you do not specify it you get an error on a form filling is failed

onTimeout

Copy URL
onTimeout: 

(event: AvatarTimeoutEvent) => AvatarResponse,Promise<AvatarResponse>

parameters

Copy URL
parameters: 

AvatarFormStateParameter[]

The form state's parameters

utteranceCounter

Copy URL
utteranceCounter: 

number

Number of user phrases processed in this state. This counter resets when changing the state to any other (or the same) one

visitsCounter

Copy URL
visitsCounter: 

number

Number of the state visits