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('Callback.open');

open

Opens the Callback UI.

Example

oMyPlugin.command('Callback.open', {

	form: {

		autoSubmit: false,
		firstname: 'John',
		lastname: 'Smith',
		subject: 'Customer Satisfaction',
		desiredTime: 'now',
		phonenumber: '8881110000'
	},
	formJSON: {...}

}).done(function(e){

	// Callback opened successfully

}).fail(function(e){

	// Callback failed to open
});


Options

Option Type Description
form object Object containing form data to prefill in the callback form and optionally auto-submit the form.
form.autoSubmit boolean Automatically submit the callback form.
form.firstname string Value for the first name entry field.
form.lastname string Value for the last name entry field.
form.subject string Value for the notes entry field.
form.desiredTime string This value is shared by the immediate or scheduled callback drop down option in the form (in other words, As Soon As Possible or Pick date & time). A string value 'now' pre-selects the 'As Soon As Possible' option. A string value with Date Time or Date Object, is passed into this drop down option and pre-selected. During form submission, it is converted into UTC string format and sent to the server as the desired callback time.
form.phonenumber string Value for the phone entry field. Should be a valid telephone number, when used with a prefix '+' auto selects the country flag near the phone input field.
formJSON object An object containing a custom registration form definition. See Customizable Callback Registration Form
userData object Arbitrary data that is to be attached with callback schedule. Properties defined here will be merged with default userData set in the configuration object.


Resolutions

Status When Returns
resolved When callback form is successfully opened. n/a
rejected When callback form is already open. 'already opened'

close

Closes the Callback UI.

Example

oMyPlugin.command('Callback.close');


Resolutions

Status When Returns
resolved When Callback form is successfully closed. n/a
rejected When Callback form is already closed. 'already closed'
rejected When user has entered some details on the form and trying to close it without confirming cancellation. 'User must confirm close'

minimize

Minimize or unminimize Callback UI.

Example

oMyPlugin.command('Callback.minimize');


Options

Option Type Description
minimized boolean Rather than toggling the current minimized state you can specify the minimized state directly: true = minimized, false = unminimized.


Resolutions

Status When Returns
resolved Always n/a
rejected Never n/a

showOverlay

A slide-down overlay opens over the Callback's content. You can fill this overlay with content such as disclaimers, articles, and other information.

Example

oMyPlugin.command('Callback.showOverlay', {

	html: '<div>Example text</div>'

});


Options

Option Type Description
html string or HTML reference The HTML content you want to display in the overlay.
hideFooter boolean Normally the overlay appears between the titlebar and footer bar. Set this to true to have the overlay overlap the footer to gain a bit more vertical space. This should only be used in special cases. For general use, don't set this value.


Resolutions

Status When Returns
resolved When Callback is open and the overlay opens. n/a
rejected When Callback is not currently open. Callback is not currently open. Ignoring command.

hideOverlay

Hides the slide-down overlay.

Example

oMyPlugin.command('Callback.hideOverlay');


Resolutions

Status When Returns
resolved When Callback is open and the overlay closes. n/a
rejected When Callback is not currently open. Callback is not currently open. Ignoring command.

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.

This page was last edited on December 21, 2018, at 12:15.
Comments or questions about this documentation? Contact us for support!