Interface PublicConfig

This file contains the definition for the public application configuration operations that are provided by the host page.

interface PublicConfig {
    agentAppConfig?: AgentAppConfig;
    cspNonce?: string;
    debug?: boolean;
    disableCustomElementMobileEnhancements?: boolean;
    disablePDFViewer?: boolean;
    disableWindowTitleChanges?: boolean;
    disclaimer?: DisclaimerPublicConfig;
    element?: Element;
    enableFocusTrap?: boolean;
    headerConfig?: HeaderConfig;
    layout?: LayoutConfig;
    messaging?: PublicConfigMessaging;
    namespace?: string;
    onError?: (data: OnErrorData) => void;
    onLoad?: (instance: ChatInstance) => void;
    openChatByDefault?: boolean;
    pageLinkConfig?: PageLinkConfig;
    serviceDesk?: ServiceDeskPublicConfig;
    serviceDeskFactory?: (
        parameters: ServiceDeskFactoryParameters,
    ) => Promise<ServiceDesk>;
    shouldSanitizeHTML?: boolean;
    shouldTakeFocusIfOpensAutomatically?: boolean;
    showLauncher?: boolean;
    streaming?: { disabled?: boolean };
    themeConfig?: ThemeConfig;
    tourConfig?: { hideChatButton?: boolean; hideMinimizeButton?: boolean };
}

Properties

agentAppConfig?: AgentAppConfig

Agent app is a mode of web chat used in service desk UIs to show the chat history to the agent. Setting this flag will adjust the way web chat renders and behaves, e.g. with no input field, opens by default, etc

cspNonce?: string

A nonce value to set on restricted elements to allow them to satisfy a Content-Security-Policy. If a website is using a Content-Security-Policy along with a nonce to whitelist which style and script elements are allowed, the site can provide this nonce value here which will then be added to the dynamic script and style tags generated by the widget which will allow them to run.

debug?: boolean

Add a bunch of noisy console.log messages!

disableCustomElementMobileEnhancements?: boolean

This value is only used when a custom element is being used to render the widget. By default, a number of enhancements to the widget are activated on mobile devices which can interfere with a custom element. This value can be used to disable those enhancements while using a custom element.

disablePDFViewer?: boolean

Indicates if the internal web chat PDF viewer should be disabled. If true, web chat will present links to PDFs as actual links that will open in the user's web browser using the browser's native viewer instead of the web chat viewer.

disableWindowTitleChanges?: boolean

If true, disables functionality in web chat that changes the window title.

Beta version of disclaimer screen. No tooling for this.

element?: Element

An optional element the page can use as a custom in to which to render the widget.

enableFocusTrap?: boolean

Indicates if a focus trap should be enabled when the web chat is open.

headerConfig?: HeaderConfig

Extra config for controlling the behavior of the header.

layout?: LayoutConfig

The config object for changing web chat's layout.

Config options for controlling messaging.

namespace?: string

An optional namespace that can be added to the web chat that must be 30 characters or under. This value is intended to enable multiple instances of the web chat to be used on the same page. The namespace for this web chat. This value is used to generate a value to append to anything unique (id, session keys, etc) to allow multiple web chats on the same page.

Note: this value is used in the aria region label for the web chat. This means this value will be read out loud by users using a screen reader.

onError?: (data: OnErrorData) => void

This is a one-off listener for errors. This value may be provided in the initial page config as a hook for customers to listen for errors. We use this instead of a normal event bus handler because this function can be defined and called before the event bus has been created which allows it to be used in loadWatsonAssistantChat.

onLoad?: (instance: ChatInstance) => void

The callback function that is called by the loadWatsonAssistantChat script once it is loaded. This is optional; to use web chat without this requires using the "window.loadWatsonAssistantChat" function instead.

openChatByDefault?: boolean

By default, the chat window will be rendered in a "closed" state.

pageLinkConfig?: PageLinkConfig

The configuration that defines how web chat responds to link page requests (where there's a link reference in the URL).

Any public config to apply to service desks.

serviceDeskFactory?: (
    parameters: ServiceDeskFactoryParameters,
) => Promise<ServiceDesk>

This is a factory for producing custom implementations of service desks. If this value is set, then this will be used to create an instance of a ServiceDesk when the user attempts to connect to an agent.

shouldSanitizeHTML?: boolean

Indicates if web chat should sanitize HTML from a user or from the assistant.

shouldTakeFocusIfOpensAutomatically?: boolean

If the web chat should grab focus if the web chat is open on page load. This applies to session history open states as well as openByChatByDefault. This should be set to false if the web chat is embedded in the tooling, for instance.

showLauncher?: boolean

Render the chat launcher element used to open and close the chat window. If you elect to not show our built in chat launcher, you will be responsible for firing the launcher:toggle, launcher:open or launcher:close events from your own chat launcher. Or, you can use options.openChatByDefault to just have the chat interface be open at initialization.

streaming?: { disabled?: boolean }

Configuration to control how streaming works.

Type declaration

  • Optionaldisabled?: boolean

    Indicates if streaming is disabled or not. Streaming is disabled by default but can be enabled through this configuration or tooling. When streaming is enabled, the assistant may return a text/event-stream response for a message request.

themeConfig?: ThemeConfig
tourConfig?: { hideChatButton?: boolean; hideMinimizeButton?: boolean }

A config object to modify tours.

Type declaration

  • OptionalhideChatButton?: boolean

    Indicates if the chat button should be hidden.

  • OptionalhideMinimizeButton?: boolean

    Indicates if the minimize button should be hidden.

MMNEPVFCICPMFPCPTTAAATR