(Update with the copy of version: Public) |
(Automated save: adding PEC_Migrated template.) |
||
Line 1: | Line 1: | ||
= API Commands = | = API Commands = | ||
+ | |||
+ | {{Template:PEC_Migrated}} | ||
+ | |||
+ | |||
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. | 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. |
Latest revision as of 23:03, June 21, 2020
Contents
[hide]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.
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 JSON options provided. If no options are provided, it renders the default offer defined in the configuration.
Example
oMyPlugin.command('Offers.open', {
mode:'overlay',
modal:true,
layout:'leftText',
title:'Offer Title',
headline:'This is the headline',
body:'This is the body',
button:'Accept Offer',
cta:{
command: 'WebChat.open',
commandOptions: {'proactive': true,'userData': {'category': 'shoes'}},
url: 'http://www.google.com',
target: '_blank'
},
video:'https://www.youtube.com/watch?v=########',
timeout: 11000,
autoplay: true,
videoOptions:{
autoplay: false,
loop: true
},
styles:{
'.cx-body': {
'background-color': '#FFFFFF',
'color': '#008000'
}
}
});
Options
Option | Type | Description | Accepted Values |
---|---|---|---|
mode | string | Widget display type | overlay, toaster |
modal | boolean | Smokescreen support option for overlay | n/a |
layout | string | Additional layout options for overlay | leftText, rightText, minimal, stacked |
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 |
cta | object | An object containing the URL and/or CXBus command for call to action | n/a |
cta.command | string | A CXBus command to execute | n/a |
cta.commandOptions | object | Options related to CXBUs command | n/a |
cta.url | string - URL | URL string for call to action.
Note: The URL must be properly defined with the complete Protocol URL Address. For example, https://www.genesys.com |
n/a |
cta.target | string | String to specify where to open the cta URL | _blank, _parent, _self, _top, framename |
image | string - URL | Image URL string | n/a |
video | string - URL | Video URL string, YouTube/Vimeo | n/a |
autoplay | boolean | Autoplay option for Video | true, false |
videoOptions | object | An object containing player-specific configuration options | n/a |
timeout | number | Timeout integer in ms | n/a |
countdownText | string | String for offer countdown text | n/a |
position | object | An object containing the properties for positioning the offers window | left, right, top, bottom |
styles | object | An object containing a custom CSS declarations | 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.' |