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',
		email: 'John@mail.com',
		subject: 'Customer Satisfaction',
		desiredTime: 'now',
		phonenumber: '8881110000'
	}

}).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.email string Value for the email entry field.
form.subject string Value for the notes entry field.
form.desiredTime string This Value is shared by the Date & Time section in the callback form. A string value 'now' pre-selects 'As soon As Possible' section and sets current local time as the desired time. When a string Date Time value/date object is passed, the desired time is set to this value in the Custom Date & Time input field. During form submission to the server desired time time is converted into UTC string format.
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.
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').done(function(e){

	// Callback closed successfully

}).fail(function(e){

	// Callback failed to close
});


Resolutions

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

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

	formValidation: true,
	countryCodes: true

}).done(function(e){

	// Callback configured successfully

}).fail(function(e){

	// Callback wasn't configured properly
});


Options

Option Type Description
formValidation boolean Enable/disable browser form validations.
countryCodes boolean Enable/disable country flags display for phone numbers.


Resolutions

Status When Returns
resolved When configuration options are provided and set n/a
rejected When no configuration options are provided 'No configuration provided'
This page was last edited on December 11, 2017, at 16:59.
Comments or questions about this documentation? Contact us for support!