Jump to: navigation, search
(Created target blank page For Version: PSAAS:Public)
 
(Update with the copy of version: draft)
Line 1: Line 1:
<!-- Creation of the target page -->
+
= 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.
 +
 
 +
{{NoteFormat|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 [[GWCBusExtensions|Widgets Extensions]] for more information about extending Genesys Widgets.|1}}
 +
 
 +
<source lang='javascript'>var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
 +
 
 +
oMyPlugin.command('Offers.open');</source>
 +
 
 +
== 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 ===
 +
<source lang='javascript'>
 +
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,
 +
});
 +
</source>
 +
 
 +
<br />
 +
 
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| mode
 +
| string
 +
| Widget display type
 +
|-
 +
| layout
 +
| string
 +
| Additional layout options for overlay
 +
|-
 +
| title
 +
| string
 +
| String for widget title
 +
|-
 +
| headline
 +
| string
 +
| String for Offer title header
 +
|-
 +
| body
 +
| string
 +
| String for offer body text
 +
|-
 +
| button
 +
| string
 +
| String for CTA button text
 +
|-
 +
| ctaURL
 +
| string - URL
 +
| URL for call to action
 +
|-
 +
| image
 +
| string - URL
 +
| Image URL string
 +
|-
 +
| video
 +
| string - URL
 +
| Video URL string, YouTube/Vimeo
 +
|-
 +
| timeout
 +
| number
 +
| Timeout integer in ms.
 +
|-
 +
| actionID
 +
| string
 +
| Web Engagement pass-through parameter
 +
|-
 +
| media
 +
| string
 +
| Web Engagement pass-through parameter
 +
|-
 +
|}
 +
 
 +
=== 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 ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('Offers.close');
 +
</source>
 +
 
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When the widget is closed
 +
| n/a
 +
|-
 +
| rejected
 +
| When the widget is already closed
 +
| 'CXBus warning.'
 +
|-
 +
|}
 +
 
 +
[[Category:V:PSAAS:Public]]

Revision as of 19:30, March 8, 2018

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 JSON 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
mode string Widget display type
layout string Additional layout options for overlay
title string String for widget title
headline string String for Offer title header
body string String for offer body text
button string String for CTA button text
ctaURL string - URL URL for call to action
image string - URL Image URL string
video string - URL Video URL string, YouTube/Vimeo
timeout number Timeout integer in ms.
actionID string Web Engagement pass-through parameter
media string Web Engagement pass-through parameter

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!