Contents
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('Offers.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 Offers Widget and renders an offer based on the options provided. If no options are provided, it renders the default offer defined in the configuration.
Example
oMyPlugin.command('Offers.open', {
mode:'overlay',
layout:'leftText',
title:'Offer Title',
headline:'This is the headline',
body:'This is the body',
button:'Accept Offer',
ctaURL:'http://www.genesys.com',
video:'https://www.youtube.com/watch?v=########',
timeout: 11000,
});
Options
Option | Type | Description | Accepted Values |
---|---|---|---|
mode | string | Widget display type | overlay, toaster |
layout | string | Additional layout options for overlay | leftText, rightText |
title | string | String for widget title | n/a |
headline | string | String for Offer title header | n/a |
body | string | String for offer body text | n/a |
button | string | String for CTA button text | n/a |
ctaURL | string - URL | URL for call to action | n/a |
image | string - URL | Image URL string | n/a |
video | string - URL | Video URL string, YouTube/Vimeo | n/a |
timeout | number | Timeout integer in ms | n/a |
Resolutions
Status | When | Returns |
---|---|---|
resolved | When configuration options are provided, valid and set | n/a |
rejected | When no valid configuration options are provided | 'Invalid configuration; detailed CXBus warning' |
close
Closes an open offers widget.
Example
oMyPlugin.command('Offers.close');
Resolutions
Status | When | Returns |
---|---|---|
resolved | When the widget is closed | n/a |
rejected | When the widget is already closed | 'CXBus warning.' |
Comments or questions about this documentation? Contact us for support!