ui.virtualAgent.Config Class
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"
}
};
Item Index
Methods
Properties
Methods
renderComponent
(
Promise
private
-
component
-
config
-
componentType
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
TComponentGeneric type that extends the UIComponent class -
config
TConfigGeneric type that extends the UIConfig class -
componentType
StringA string defined by each UI component to represent its type. e.g. "Chat", "Callback", "VirtualAgent", etc ...
Returns:
Properties
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)
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
onError
Fired when an error occurs
onInitialized
Fired when VA is initialized
onInputBoxUpdated
Fired when input box is updated
onSignInRedirect
Fired when popu window redirects to login page
onSignInRequest
Fires when user sign-in is requested
Event Payload:
-
data
ArrayAn 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