IChatController interface
đ Descriptionâ
Interface for controlling the runner. This interface is used when using the controller prop of the ChatRunner component.
đ Type declarationâ
interface IChatController { definition: IDefinition; styles: IChatStyles; l10n: IL10n; view: "live" | "test" | "preview"; instance: Instance | undefined;Readonly fingerprint: string;Readonly snapshot: ISnapshot | undefined;Readonly isRunning: boolean;Readonly isFinishing: boolean;Readonly isPausing: boolean;Readonly allowStart: boolean;Readonly allowRestart: boolean;Readonly allowPause: boolean;Readonly allowStop: boolean;Readonly start: () => void;Function restart: () => void;Function pause: () => ISnapshot | Promise<ISnapshot> | undefined;Function stop: () => void;Function doPreview: (data: TRunnerPreviewData) => void;Function openChat: () => void;Function closeChat: () => void;Function }
đī¸ Propertiesâ
đˇī¸ allowPause
â
Retrieves if the runner allows pausing the form.
Typeâ
boolean
đˇī¸ allowRestart
â
Retrieves if the runner allows restarting the form.
Typeâ
boolean
đˇī¸ allowStart
â
Retrieves if the runner allows starting the form.
Typeâ
boolean
đˇī¸ allowStop
â
Retrieves if the runner allows stopping the form.
Typeâ
boolean
đˇī¸ definition
â
Sets or retrieves the current form definition of the runner.
Typeâ
đˇī¸ fingerprint
â
Retrieves the unique fingerprint of the current form definition. This is a SHA-256 hash of the form that is stable as long as the structure of the form is not changed. Textual changes in the content of the form definition will not alter the fingerprint hash. But adding, removing or reordering elements does.
Typeâ
string
Read the Form fingerprint guide for more information about the form fingerprint.
đˇī¸ instance
â
Reference to the active form instance.
Typeâ
Instance
| undefined
This property is undefined
when no form has started yet.
đˇī¸ isFinishing
â
Retrieves if an active form instance is currently finishing. This property is true
when a respondent completes the form and the runner is submitting the response data to an endpoint.
Typeâ
boolean
đˇī¸ isPausing
â
Retrieves if an active form instance is currently pausing. This property is true
when a respondent requests to pause the form and the runner is submitting the snapshot data to an endpoint.
Typeâ
boolean
đˇī¸ isRunning
â
Retrieves if an active form instance is running.
Typeâ
boolean
đˇī¸ l10n
â
Sets or retrieves the current locale and translation settings.
Typeâ
Read the Localization guide for more information about locales and translations.
đˇī¸ snapshot
â
Retrieves a snapshot of the active form instance. A snapshot can be used to restore/resume a form later on.
Typeâ
Read the Pause and resume guide for more information about pausing and resuming runners.
đˇī¸ styles
â
Sets or retrieves the current styles (colors, font, size, etc.) of the runner.
Typeâ
Read the Style forms guide for more information about the runner styles.
đˇī¸ view
â
Sets or retrieves the current view mode of the runner. It can be one of the following values:
live
: The form is running in normal (production) mode;test
: The form is running in test mode (no response data is submitted);preview
: The form is running in preview mode, which shows all blocks in a single view.
Typeâ
"live" | "test" | "preview"
âļī¸ Functionsâ
đ§ closeChat
â
Closes the chat window if its opened.
Signatureâ
() => void
This function is only available when the display
mode is set to button
đ§ doPreview
â
Request a preview of the specified element of the form. This function is used in a live preview setup to bring a certain element in the form into view.
Signatureâ
(data: TRunnerPreviewData) => void
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
data | TRunnerPreviewData | No | Specifies the preview data. |
Read the Live form preview guide for an example.
đ§ openChat
â
Opens the chat window. This simulates a click on the chat button in the bottom right corner of the screen and allows the chat window to open programmatically.
Signatureâ
() => void
This function is only available when the display
mode is set to button
đ§ pause
â
Pauses the active form instance.
Signatureâ
() => ISnapshot | Promise<ISnapshot> | undefined
Return valueâ
Returns the ISnapshot
object, a Promise
for that object or undefined
if the pause operation failed.
đ§ restart
â
Restart with a new empty form instance.
Signatureâ
() => void
đ§ start
â
Starts a new form instance.
Signatureâ
() => void
đ§ stop
â
Stops the active form instance.
Signatureâ
() => void