Skip to main content

IChatRunner interface

📖 Description​

Interface for controlling the runner. This interface describes the controller reference returned by the run function.

📃 Type declaration​

interface IChatRunner {
  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
  destroy: () => void;Function
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🗃ī¸ 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​

IDefinition


🏷ī¸ 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

tip

Read the Form fingerprint guide for more information about the form fingerprint.


🏷ī¸ instance​

Reference to the active form instance.

Type​

Instance | undefined

warning

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​

IL10n

tip

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​

ISnapshot

tip

Read the Pause and resume guide for more information about pausing and resuming runners.


🏷ī¸ styles​

Sets or retrieves the current style (colors, font, size, etc.) of the runner.

Type​

IChatStyles

tip

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
warning

This function is only available when the display mode is set to button


🔧 destroy​

Destroys the runner and removes it from the DOM.

Signature​

() => void

🔧 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​

NameTypeOptionalDescription
dataTRunnerPreviewDataNoSpecifies the preview data.
tip

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
warning

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