Jump to: navigation, search
(Update with the copy of version: draft)
(Automated save: adding PEC_Migrated template.)
 
(One intermediate revision by one other user not shown)
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.
+
{{Template:PEC_Migrated}}
  
{{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');
+
{{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/SideBar-combined#API_Commands.}}
 
 
oMyPlugin.command('SideBar.open');</source>
 
 
 
== configure ==
 
Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. Sidebar widget has to be configured at least with one channel. The configure command can also be called at runtime with new configuration, this will override the existing configuration showing new channels on the screens.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('SideBar.configure', {
 
 
 
showOnStartup: false,
 
position: 'left',
 
expandOnHover: false,
 
channels: [
 
{
 
name: 'ChannelSelector',
 
clickCommand: 'ChannelSelector.open',
 
clickOptions: {},
 
 
 
//use your own static string or i18n query string for the below two display properties. Example for i18n query string: '@i18n:sidebar.ChannelSelectorName' where 'sidebar' refers to plugin namespace and 'ChannelSelectorName' name refers to the property key containing the actual text.
 
 
 
displayName: '@i18n:sidebar.ChannelSelectorName',
 
displayTitle: 'Get assistance from one of our agents right away', // Your own static string
 
readyEvent: 'ChannelSelector.ready',
 
icon: 'agent',
 
onClick: function($, CXBus, Common) {
 
_genesys.widgets.bus.command('MyPlugin.open');
 
}
 
}
 
...
 
]
 
 
 
}).done(function(e){
 
 
 
// Sidebar configured successfully
 
 
 
}).fail(function(e){
 
 
 
// Sidebar failed to configure properly
 
});
 
</source>
 
 
 
<br />
 
=== Options ===
 
{|
 
|-
 
! Option
 
! Type
 
! Description
 
|-
 
| showOnStartup
 
| boolean
 
| Shows the sidebar on the screen when Widgets is launched.
 
|-
 
| position
 
| string
 
| Defines the position of sidebar on the screen.
 
|-
 
| expandOnHover
 
| boolean
 
| Enables the expand or contract behavior of sidebar.
 
|-
 
| channels
 
| array
 
| Array containing each channel configuration object. The order of channels are displayed based on the order defined here.
 
|-
 
| channels[index].name
 
| string
 
| Name of the channel. It can be found in the namespace section documentation of each Widget. Used to identify official channels vs custom channels. If a reserved name is used here, Sidebar will apply default values for that channel. To override the default values or when defining a new custom channel, use the below following properties.
 
|-
 
| channels[index].clickCommand
 
| string
 
| Change the default command that is triggered when clicked.
 
|-
 
| channels[index].clickOptions
 
| object
 
| Pass valid command options that are used in above click command execution.
 
|-
 
| channels[index].displayName
 
| string or i18n query string
 
| Change the default display name for this channel with your own static string or to achieve localization, use i18n query string. Syntax: @i18n:<plugin namespace>.<display key>.
 
|-
 
| channels[index].displayTitle
 
| string or i18n query string
 
| Change the default tooltip content for this channel with your own static string or to achieve localization, use i18n query string. Syntax: @i18n:<plugin namespace>.<display key>.
 
|-
 
| channels[index].readyEvent
 
| string
 
| Subscribes to this ready event published by a plugin.
 
|-
 
| channels[index].icon
 
| string
 
| Change the default Icon for this channel. For the list of Icon names see [[Documentation:PSAAS:Administrator:GWCIcons|Included Icons]].
 
|-
 
| channels[index].onClick
 
| function
 
| Define a custom onclick function, this overrides clickCommand and clickOptions.
 
|-
 
|}
 
<br />
 
=== Resolutions ===
 
{|
 
|-
 
! Status
 
! When
 
! Returns
 
|-
 
| resolved
 
| When configuration options are provided and set
 
| n/a
 
|-
 
| rejected
 
| When no configuration options are provided
 
| 'Invalid configuration. Please ensure at least one channel is configured.'
 
|-
 
|}
 
== open ==
 
Opens the Sidebar UI. In Desktop, it opens as an actual SideBar and shows the configured channels where as in mobile it opens as a button at the bottom to start.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('SideBar.open');
 
</source>
 
 
 
<br />
 
=== Resolutions ===
 
{|
 
|-
 
! Status
 
! When
 
! Returns
 
|-
 
| resolved
 
| When sidebar is successfully opened
 
| n/a
 
|-
 
| rejected
 
| When sidebar is already opened
 
| 'Already opened'
 
|-
 
|}
 
== close ==
 
Closes the Sidebar UI.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('SideBar.close');
 
</source>
 
 
 
<br />
 
=== Resolutions ===
 
{|
 
|-
 
! Status
 
! When
 
! Returns
 
|-
 
| resolved
 
| When sidebar is successfully closed
 
| n/a
 
|-
 
| rejected
 
| When sidebar is already closed
 
| 'already closed'
 
|-
 
|}
 
== expand ==
 
To show more details about the channels, it slides out from the sides of the screen in desktop but expands to full screen in mobiles.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('SideBar.expand');
 
</source>
 
 
 
<br />
 
=== Resolutions ===
 
{|
 
|-
 
! Status
 
! When
 
! Returns
 
|-
 
| resolved
 
| When sidebar is successfully expanded
 
| n/a
 
|-
 
| rejected
 
| When sidebar is already expanded
 
| 'sidebar already expanded'
 
|-
 
|}
 
== contract ==
 
Slides back showing only the channel buttons in desktop and sidebar launcher button in mobile.
 
<br /><br />
 
=== Example ===
 
<source lang='javascript'>
 
oMyPlugin.command('SideBar.contract');
 
</source>
 
 
 
<br />
 
=== Resolutions ===
 
{|
 
|-
 
! Status
 
! When
 
! Returns
 
|-
 
| resolved
 
| When sidebar is successfully contracted
 
| n/a
 
|-
 
| rejected
 
| When sidebar is already contracted
 
| sidebar already contracted
 
|-
 
|}
 
  
 
[[Category:V:PSAAS:Public]]
 
[[Category:V:PSAAS:Public]]

Latest revision as of 23:17, June 21, 2020

API Commands

Important
This content may not be the latest Genesys Engage cloud content. To find the latest content, go to Genesys Engage cloud for Administrators.



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/SideBar-combined#API_Commands.
This page was last edited on June 21, 2020, at 23:17.
Comments or questions about this documentation? Contact us for support!