Jump to: navigation, search
(Update with the copy of version: draft)
(Update with the copy of version: draft)
Line 1: Line 1:
 
= API Commands =
 
= 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|Documentation for this software has moved to a new home. Please update links and bookmarks to content hosted at https://all.docs.genesys.com/WID/Current/SDK/Offers-combined#API_Commands.}}
 
 
{{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.
 
<br /><br />
 
== 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.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
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'
 
}
 
}
 
});
 
</source>
 
 
 
<br />
 
 
 
=== 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
 
|-
 
|}
 
<br />
 
 
 
=== 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.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('Offers.close');
 
</source>
 
 
 
<br />
 
=== 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]]
 
[[Category:V:PSAAS:Public]]

Revision as of 21:52, October 17, 2019

API Commands

Important
Documentation for this software has moved to a new home. Please update links and bookmarks to content hosted at https://all.docs.genesys.com/WID/Current/SDK/Offers-combined#API_Commands.
Comments or questions about this documentation? Contact us for support!