API Docs for: 2.0.20133.2
Show:

ui.virtualAgent.Config Class

Extends ui.UIConfig
Module: UI VirtualAgent
Parent Module: UI

Configuration for virtual agent component Example:

var config = {
    environment: appConfig.env,
    locale: "en-us",
    onInitialized: function () {
       console.log("init");
    },
    onControlUpdated: function (e) {
        console.log("control updated");
        if (e.data.type === "startover") {
            updateHeaderControlButtonDisplay("#startoverbutton", e.data.enabled);
        } else if (e.data.type === "endchat") {
            updateHeaderControlButtonDisplay("#endchatbutton", e.data.enabled);
        }
    },
    content: {
        name: "Virtual Agent SDK",
        userInput: " hello please assist me in restarting my pc ",
        flowExtensionOption: {
            type: "default",
            phoneNumber: "1234567890",
            onChatQueued: function (e) {
                console.log("chat queued" + e.type);
            },
            onChatQueueUpdated: function (e) {
                console.log("ChatQueueUpdated, position: " + JSON.stringify(e.data.position));
            },
            onChatAgentDataReady: function () {
                console.log("ChatAgentDataReady");
            },
            onChatEstablished: function () {
                console.log("ChatEstablished");
            },
            onChatMessage: function (e) {
                console.log("ChatMessage, sender: " + JSON.stringify(e.data.sender));
            },
            onChatClosed: function () {
                console.log("ChatClosed");
            },
            onChatRejoinUrl: function (e) {
                console.log("ChatRejoinUrl, url: " + JSON.stringify(e.data));
            },
            onCallbackAccepted: function () {
                console.log("Callback accepted");
            },
            onCallbackRejected: function () {
                console.log("Callback rejected");
            }
        }
    },
    context: {
        name: "John",
        account: "john@example.com",
        occupation: "developer"
    },
    theme: {
        type: "light"
        default: {
         background: "#ff00ff00",
         foreground: "#e3e3e3ff",
         accent: "#00ff00ff"
    }
};

Methods

renderComponent

(
  • component
  • config
  • componentType
)
Promise private
Refer to https://www.typescriptlang.org/docs/handbook/generics.html for usage of Generics in TypeScript Render a UI component with Qos event enabled

Parameters:

  • component TComponent
    Generic type that extends the UIComponent class
  • config TConfig
    Generic type that extends the UIConfig class
  • componentType String
    A string defined by each UI component to represent its type. e.g. "Chat", "Callback", "VirtualAgent", etc ...

Returns:

Properties

areaId

String

Area ID is a specific Toronto ID to determine where to fetch content from

authInfo

ui.AuthInfo
A {{#crossLink "ui.AuthInfo"}}{{/crossLink}} object that specifies the authentication information.

context

Object

context that will be passed to the virtual agent that will be passed to the agent and torronto. context is a JS object, the value of any property can only be a string.

environment

String

A value from ui.virtualAgent.Environment (default is ui.virtualAgent.Environment.PRODUCTION)

flowId

String

ID of the flow definition to use.

locale

String

locale supported by Virtual Agent (en-us)

preview

Boolean

Enable preview content

shouldSuppressOutageChecks

Boolean

Should the Virtual Agent suppress service outage checks (for example: Outage checks for Xbox live services)

uiInfo

UIInfo
A {{#crossLink "ui.UIInfo"}}{{/crossLink}} object that describes how the UI component will be rendered.

Events

onControlUpdated

Fired when control are updated

Event Payload:

  • data Object

    A data object that is passed through the event

    • type Object

      a string indicating what control is being updated ( "startover","endchat")

    • visible Object

      a boolean indicating if the startover button is displayed

onError

Fired when an error occurs

Event Payload:

  • data Object
    An object that contains error information
    • message String

      Error message

onInitialized

Fired when VA is initialized

onInputBoxUpdated

Fired when input box is updated

Event Payload:

  • data Object

    A data object that is passed through the event

    • enabled Object

      a boolean indicating if the inputbox is disabled or not

    • placeholder Object

      specifies a short hint that describes the expected value of input

onSignInRedirect

Fired when popu window redirects to login page

onSignInRequest

Fires when user sign-in is requested

Event Payload:

  • data Array
    An array that contains information for supported sign-in types. i.e. [{ type: "MSA", policy: "MBI_SSL" }, { type: "ADD" }]

onUnloaded

Fired when the ui component is closed