Jump to: navigation, search

API Commands

Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.

Important
The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see Widgets Extensions for more information about extending Genesys Widgets.


var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
 
oMyPlugin.command('ChannelSelector.open');

close

Closes the ChannelSelector UI.

Example

oMyPlugin.command('ChannelSelector.close').done(function(e){
 
	// ChannelSelector closed successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to close
});


Resolutions

Status When Returns
resolved When ChannelSelector is successfully closed n/a
rejected When ChannelSelector is already closed Already closed

open

Opens the ChannelSelector UI.

Example

oMyPlugin.command('ChannelSelector.open').done(function(e){
 
	// ChannelSelector opened successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to open
});


Resolutions

Status When Returns
resolved When ChannelSelector widget is successfully opened n/a
rejected When ChannelSelector widget is already open 'Already open'

configure

Modify the configuration for ChannelSelector.

Example

oMyPlugin.command('ChannelSelector.conifugre', {
 
	channels: [
		{
			enabled: true,
			clickCommand: 'CallUs.open',
			readyEvent: 'CallUs.ready',
			displayName: 'Call Us',
			i18n: 'CallusTitle',
			icon: 'call-outgoing',
			html:  '',
			ewt:{
 
				display: true,
				queue:'chat_ewt_test_eservices',
				availabilityThresholdMin:60,
				availabilityThresholdMax:600
			}
		}
	]
 
}).done(function(e){
 
	// ChannelSelector configured successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to configure
});


Options

Option Type Description
ewtRefreshInterval number EWT is updated for every time interval (seconds) defined.
channels array Array containing each channel configuration object. The order of channels are displayed based on the order defined here.
channels[].enable boolean Enable/Disable chat channel.
channels[].clickCommand string The CXBus command name for opening a particular widget when clicked on this channel.
channels[].readyEvent string Subscribes to this ready event published by a plugin and enables the channel when that plugin is ready.
channels[].displayName string A channel name to display in ChannelSelector widget.
channels[].i18n string To support localization of channel display name, this takes a key parameter of channelselector section in language pack file. Overides above displayName.
channels[].icon string Select from one of the Genesys Widgets icons by specifying icon css class name.
channels[].html string Overides and replaces the icon section of a channel with the html (image tag) defined here.
channels[].ewt.display boolean To display estimated waiting time details.
channels[].ewt.queue string EWT service channel virtual queue name.
channels[].ewt.availabilityThresholdMin number If EWT is greater than 0 and less this minimum threshold value (seconds), estimated waiting time is shown with yellow warning icon.
channels[].ewt.availabilityThresholdMax number If EWT is greater than minimum threshold value and less maximum threshold value (seconds), estimated waiting time is shown with red alert icon.
channels[].ewt.hideChannelWhenThresholdMax boolean Hides this channel when estimated waiting time is greater than maximum threshold value.


Resolutions

Status When Returns
resolved When configuration options are provided and set n/a
rejected When no configuration options are provided 'Invalid configuration'

displayStats

Estimated Waiting Time and availability details are displayed for each channel.

Example

oMyPlugin.command('ChannelSelector.displayStats').done(function(e){
 
	// ChannelSelector displayed stats successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to display stats
});


Resolutions

Status When Returns
resolved When Estimated Waiting Time is displayed successfully. n/a
rejected When StatsService fails to retrieve EWT data. 'Unable to display EWT Stats in ChannelSelector'
rejected When enableEwt config is disabled or when required channel plugins are not ready. 'Either EWT config is disabled or plugins not yet ready'

disableStats

UI is cleared of any Estimated Waiting time. Fetching it for the defined time interval is also disabled.

Example

oMyPlugin.command('ChannelSelector.disableStats').done(function(e){
 
	// ChannelSelector disabled stats successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to disable stats
});


Resolutions

Status When Returns
resolved When ChannelSelector widget is successfully opened n/a
rejected When ChannelSelector widget is not opened 'ChannelSelector not opened to disable stats details'
rejected When EWT is disabled for all channels 'Stats already disabled'

enableStats

UI is shown back with estimated Waiting time and availability details. Fetching it for the defined time interval is also enabled.

Example

oMyPlugin.command('ChannelSelector.enableStats').done(function(e){
 
	// ChannelSelector enabled stats successfully
 
}).fail(function(e){
 
	// ChannelSelector failed to enable stats
});


Resolutions

Status When Returns
resolved When ChannelSelector widget is successfully opened. n/a
rejected When Estimated Waiting time details are already displayed. 'Stats already enabled'
rejected When ChannelSelector widget is not opened. 'ChannelSelector not opened to enable stats details'

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on 10 August 2017, at 06:39.