Revision as of 17:12, July 27, 2018 by Djudge (talk | contribs) (Update with the copy of version: draft)
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('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

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!