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

Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.

Example

oMyPlugin.command('ChannelSelector.configure', {

	channels: [
		{
			enabled: true,
			clickCommand: 'CallUs.open',
			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) is defined.
channels array Array containing each channel configuration object. The order of channels is 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[].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. Overrides above displayName.
channels[].icon string Select from one of the Genesys Widgets icons by specifying icon css class name.
channels[].html string Overrides and replaces the icon section of a channel with the html (image tag) defined here.
channels[].ewt.display boolean To display EWT details.
channels[].ewt.queue string EWT service channel virtual queue name.
channels[].ewt.availabilityThresholdMin number (seconds) If the EWT is greater than 0 minutes and less than the minimum threshold value (in minutes), then the EWT is shown with a yellow warning icon.


Note: Comparison is made after converting the threshold value in seconds to minutes.
channels[].ewt.availabilityThresholdMax number (seconds) If the EWT is greater than the minimum threshold value (in minutes) and less than the maximum threshold value (in minutes), then the EWT is shown with a red alert icon.


Note: Comparison is made after converting the threshold value in seconds to minutes.
channels[].ewt.hideChannelWhenThresholdMax boolean Hides this channel when the EWT is greater than the 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 Wait Time (EWT) 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 EWT 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 EWT. 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 EWT 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 EWT details are already displayed 'Stats already enabled'
rejected When ChannelSelector Widget is not opened 'ChannelSelector not opened to enable stats details'
This page was last edited on February 21, 2020, at 16:47.
Comments or questions about this documentation? Contact us for support!