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('ClickToCall.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.
open
Opens the ClickToCall UI.
Example
oMyPlugin.command('ClickToCall.open', {
userData: {},
form: {
autoSubmit: false,
firstname: 'John',
lastname: 'Smith',
phonenumber: 9256349345
},
formJSON: {...}
}).done(function(e){
// ClickToCall opened successfully
}).fail(function(e){
// ClickToCall failed to open
});
Options
Option | Type | Description |
---|---|---|
form | string | Object containing form data to prefill the ClickToCall form and optionally auto-submit the form. |
form.autoSubmit | boolean | Automatically submit the ClickToCall form. |
form.firstname | string | Value for the first name input entry field. |
form.lastname | string | Value for the last input name entry field. |
form.phonenumber | number | Value for the phone number input entry field. |
formJSON | object | A JSON object containing a custom registration form definition. See Customizable ClickToCall Registration Form |
userData | object | Arbitrary data that is attached with ClickToCall form submit request. Properties defined here are merged with default userData set in the configuration object. |
Resolutions
Status | When | Returns |
---|---|---|
resolved | When ClickToCall is successfully opened | n/a |
rejected | When ClickToCall is already open | 'already opened' |
close
Closes the ClickToCall UI.
Example
oMyPlugin.command('ClickToCall.close').done(function(e){
// ClickToCall closed successfully
}).fail(function(e){
// ClickToCall is already closed
});
Resolutions
Status | When | Returns |
---|---|---|
resolved | When ClickToCall is successfully closed | n/a |
rejected | When ClickToCall is already closed | 'already closed' |
minimize
Minimize or unminimize ClickToCall UI.
Example
oMyPlugin.command('ClickToCall.minimize').done(function(e){
// ClickToCall minimized successfully
}).fail(function(e){
// ClickToCall ignores command
});
Resolutions
Status | When | Returns |
---|---|---|
resolved | Always | n/a |
rejected | Never | n/a |
This page was last edited on May 11, 2018, at 12:35.
Comments or questions about this documentation? Contact us for support!