Revision as of 19:47, March 28, 2017 by Byee (talk | contribs) (API Commands)
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'

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'
Comments or questions about this documentation? Contact us for support!