AvatarFormState
Avatar form state object that describes a form state and implements the logic of transitions, reactions and form filling.
Props
attempts
attempts: number
| undefined
Optional. Number of attempts to fill the form. The default values is 3
beforeExit
beforeExit: (event: AvatarStateChangeEvent) => void,Promise<void>
| undefined
Callback function when the dialogue leaves the state
clearParameter
clearParameter: (name: string) => void
Clears a specific form state's parameter by name
clearParameters
clearParameters: () => void
Clears all the form state's parameters
exitIntents
exitIntents: string[]
Optional. List of utterances to exit the form state
getParameter
getParameter: (name: string) => AvatarFormStateParameter
Gets a specific parameter from the form state by name
getParameters
getParameters: () => AvatarFormStateParameter[]
Gets all the parameters from the form state
isFormComplete
isFormComplete: boolean
Whether the form state is complete
name
name: string
State name
onEnter
onEnter: (event: AvatarStateChangeEvent) => AvatarResponse,Promise<AvatarResponse>
| undefined
Callback function when the dialogue enters the state
onExitIntent
onExitIntent: (utteranceResponse: AvatarUtteranceEvent) => AvatarResponse,Promise<AvatarResponse>
| undefined
Triggered when an exit intent is occurred
onFormComplete
onFormComplete: (formData: AvatarFormState) => AvatarResponse,Promise<AvatarResponse>
| undefined
Triggered when form filling is successfully completed
onFormFailed
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
onTimeout: (event: AvatarTimeoutEvent) => AvatarResponse,Promise<AvatarResponse>
utteranceCounter
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
visitsCounter: number
Number of the state visits