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

danger

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
danger

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
danger

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