Class Index | File Index

Classes


Class finesse.digital.ChannelService

Finesse digital channel state control (referred to as FNC elsewhere in this document) is a programmable desktop component that was introduced in Finesse 12.0. The ChannelService API provides hooks to FNC that can be leveraged by gadget hosting channels.

FNC API

The FNC API provides methods that can be leveraged by gadgets serving channels to register, update or modify channel specific display information and corresponding menu action behavior in Agent State Control Menu (referred to as FNC Menu component).
These APIs are available natively to the gadget through the finesse.js import. Examples of how to write a sample gadget can be found here.
The FNC API is encapsulated in a module named ChannelService within finesse.js and it can be accessed via the namespace finesse.digital.ChannelService.
Defined in: finesse.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
ENUM: Icon Badge Type.
 
ENUM: Channel Icon location type.
 
ENUM: State Status indicates the icon color in channel.
 
ENUM: Operation status.
Method Summary
Method Attributes Method Name and Description
 
addChannel(channelId, channelData, onMenuClick, onSuccess, onError)
This API starts the gadget interaction with FNC by adding the channel to the FNC Menu component.
 
init(ContainerServices)
Initialize ChannelService for use in gadget.
 
removeChannel(channelId, onSuccess, onError)
Removes a channel representation from the FNC Menu component.
 
updateChannel(channelId, channelData, onSuccess, onError)
Updates the channels representation in FNC Menu component.
 
updateChannelMenu(channelId, menuItems, onSuccess, onError)
Updates the menu displayed against a channel.
 
updateChannelState(channelId, channelState, onSuccess, onError)
Updates the channels current state.
Class Detail
finesse.digital.ChannelService()

Example demonstrating initialization

containerServices = finesse.containerservices.ContainerServices.init();
channelService    = finesse.digital.ChannelService.init(containerServices);
channelService.addChannel(channelId, channelData, onMenuClick, onSuccess, onError);
Field Detail
ICON_BADGE_TYPE
ENUM: Icon Badge Type. [NONE, INFO, WARNING, ERROR]

ICON_TYPE
ENUM: Channel Icon location type. [COLLAB_ICON, URL]

STATE_STATUS
ENUM: State Status indicates the icon color in channel. [AVAILABLE, UNAVAILABLE, BUSY]

STATUS
ENUM: Operation status. [SUCCESS, FAILURE]
Method Detail
addChannel(channelId, channelData, onMenuClick, onSuccess, onError)
This API starts the gadget interaction with FNC by adding the channel to the FNC Menu component. The complete channel state is required in the form of JSON payload as part of this API. It is advised developers pre-validate the JSON that is passed as parameter against its corresponding schema by testing it through finesse.utilities.JsonValidator.validateJson. The result of the add operation will be returned via the given success or error callback.
Parameters:
{String} channelId
Digital channel id, should be unique within the gadget. The API developer can supply any string that uniquely identifies the Digital Channel for registration with FNC. This id would be returned in callbacks by FNC when there is a user action on menus that belongs to a channel.
{Object} channelData
It is a composition of the following KEY-VALUE pair as JSON. The value part would be the object that conforms to 'key' specific schema.
keyValue
menuconfigRefer finesse.digital.ChannelSchema#getMenuConfigSchema for description about this JSON payload
channelConfigRefer finesse.digital.ChannelSchema#getChannelConfigSchema for description about this JSON payload
channelStateRefer finesse.digital.ChannelSchema#getChannelStateSchema for description about this JSON payload
onMenuClick
Handler that is provided by the Gadget to the API during channel addition. It is invoked whenever the user clicks a menu item on the FNC control.
ParameterDescription

selectedMenuItemId

The selectedMenuItemId will contain the menuId as defined in menuConfig finesse.digital.ChannelSchema#getMenuConfigSchema payload. The gadget has to invoke onSuccess callback, if the state change is success or onError callback if there is a failure performing state change operation (refer actionTimeoutInSec in JSON payload for timeout) on the underlying channel service.
onSuccess
The success payload would be of the following format:
     {
         "channelId" : "[ID of the Digital channel]",
         "status"    : "success"
     }
     
onError
The error payload would be of the following format:
      { 
      "channelId" : "[ID of the Digital channel]",
      "status"    : "failure",  
      "error"     : { 
                      "errorCode": "[Channel supplied error code that will be logged in Finesse client logs]",
                      "errorDesc": "An error occurred while processing request"  
                     }
      }
     
onSuccess
Callback function invoked upon add operation successful. Refer above for the returned JSON payload.
onError
Callback function invoked upon add operation is unsuccessful. Refer above for the returned JSON payload.
Throws:
Throws error when the passed in channelData is not as per schema.

{finesse.digital.ChannelService} init(ContainerServices)
Initialize ChannelService for use in gadget.
Parameters:
{finesse.containerservices.ContainerServices} ContainerServices
instance.
Returns:
{finesse.digital.ChannelService} instance.

removeChannel(channelId, onSuccess, onError)
Removes a channel representation from the FNC Menu component. The result of the remove operation will be intimated via the given success and error callbacks.
Parameters:
{String} channelId
Digtial channel id, should be unique within the gadget. This id would be returned in the callbacks.
{Function} onSuccess
onSuccess function that is invoked for successful operation.
{Function} onError
onError function that is invoked for failed operation.

updateChannel(channelId, channelData, onSuccess, onError)
Updates the channels representation in FNC Menu component. None of the data passed within the data payload channelData is mandatory. This API provides an easy way to update the complete channel configuration together in one go or partially if required. The result of the update operation will be intimated via the given success and error callbacks.
Parameters:
{String} channelId
Digtial channel id, should be unique within the gadget This id would be returned in the callbacks.
{Object} channelData
Channel data JSON object as per the spec. Refer #addChannel for this object description. Partial data sections allowed.
{Function} onSuccess
onSuccess function that is invoked for successful operation.
{Function} onError
onError function that is invoked for failed operation.

updateChannelMenu(channelId, menuItems, onSuccess, onError)
Updates the menu displayed against a channel. The result of the update operation will be intimated via the given success and error callbacks.
Parameters:
{String} channelId
Digtial channel id, should be unique within the gadget. This id would be returned in the callbacks.
{menuItem[]} menuItems
Refer finesse.digital.ChannelSchema#getMenuConfigSchema for menuItem definition.
{Function} onSuccess
onSuccess function that is invoked for successful operation.
{Function} onError
onError function that is invoked for failed operation.

updateChannelState(channelId, channelState, onSuccess, onError)
Updates the channels current state. The result of the update operation will be intimated via the given success and error callbacks.
Parameters:
{String} channelId
Digtial channel id, should be unique within the gadget. This id would be returned in the callbacks.
{Object} channelState
Refer finesse.digital.ChannelSchema#getChannelStateSchema for channel state definition.
{Function} onSuccess
onSuccess function that is invoked for successful operation.
{Function} onError
onError function that is invoked for failed operation.

Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jan 02 2020 09:55:47 GMT-0500 (EST)