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('Search.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('Search.configure', {

	enabled: false,
	hideDuringInvite: false,
	template: '<span>Template</span>',
	effect: 'fade',
	effectDuration: 1000,
	openDelay: 1000

}).done(function(e){

	// Search configured successfully

}).fail(function(e){

	// Invalid configuration
});


Options

Option Type Description
enabled boolean Enable/disable Search button on screen.
hideDuringInvite boolean When auto-invite feature is activated, hide the Search button. When invite is dismissed, reveal the Search button again.
template string Custom HTML string template for Search button.
effect string Type of animation effect.
effectDuration string Type of animation effect when revealing Search button ('slide' or 'fade').
openDelay number Number of milliseconds before displaying Search button on screen.


Resolutions

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

open

Opens the Search Widget

Example

oMyPlugin.command('Search.open').done(function(e){

	// Search opened successfully

}).fail(function(e){

	// Search failed to open
});


Options

Option Type Description
query string Initial question searched when window is opened.
knowledgebases object Array of knowledge base IDs for all further requests. Overwrites knowledgeCenterServer widget settings.
lang string Default language for all further requests. Overwrites knowledgeCenterServer widget settings.
media string Allows you to search content for media. Overwrites knowledgeCenterServer widget settings.
categories object Array of Category IDs for additional filter.
maxSearchResults number Maximum number of most relevant search results shown.
windowTitle string Overwrites default window title Ask a question.
hideSearchBar boolean Allows you to hide search input with the search button.


Resolutions

Status When Returns
resolved When Search is successfully opened n/a
rejected When Search is already open 'already opened'

openDocument

Opens the Search Widget with the specified document shown.

Example

oMyPlugin.command('Search.openDocument').done(function(e){

	// Document opened successfully

}).fail(function(e){

	// Failed to open document
});


Options

Option Type Description
documentId string Document ID.
knowledgeBaseId string Knowledge base ID of the document.
langId string Language ID of the document.
windowTitle string Overwrites default window title Ask a question


Resolutions

Status When Returns
resolved When document is successfully opened n/a
rejected When missing mandatory arguments 'All mandatory arguments must be provided'

close

Closes the Search Widget

Example

oMyPlugin.command('Search.close').done(function(e){

	// Search closed successfully

}).fail(function(e){

	// Search failed to close
});


Resolutions

Status When Returns
resolved When Search is successfully closed n/a
rejected When Search is already closed 'already closed'

showSearchButton

Makes the standalone search button visible on the screen using either the default template and CSS or customer-defined ones.

Example

oMyPlugin.command('Search.showSearchButton', {

	openDelay: 1000,
	duration: 1500

}).done(function(e){

	// Search shows search button successfully

}).fail(function(e){

	// Search button is already visisible, side bar is active and overrides the search button, or search button is disabled in configuration
});


Options

Option Type Description
openDelay number Duration in milliseconds to delay showing the search buton on the page.
duration number Duration in milliseconds for the show and hide animation.


Resolutions

Status When Returns
resolved When the search button is enabled in the configuration, is currently not visible, and the SideBar plugin is not initialized n/a
rejected When the search button is not enabled in the configuration, or it's already visible, or the SideBar plugin is initialized 'Search button is already visible. Ignoring command.'
rejected When the sidebar plugin is active the standalone search button will be disabled automatically 'SideBar is active and overrides the default search button'

hideSearchButton

Hides the standalone search button.

Example

oMyPlugin.command('Search.hideSearchButton', {duration: 1500}).done(function(e){

	// Search hid search button successfully

}).fail(function(e){

	// Search button is already hidden
});


Options

Option Type Description
duration number Duration in milliseconds for the show and hide animation.


Resolutions

Status When Returns
resolved When the search button is currently visible n/a
rejected When the search button is already hidden 'Search button is already hidden. Ignoring command.'
This page was last edited on December 22, 2017, at 18:42.
Comments or questions about this documentation? Contact us for support!