Jump to: navigation, search
(Update with the copy of version: draft)
(Update with the copy of version: draft)
Line 22: Line 22:
 
firstname: 'John',
 
firstname: 'John',
 
lastname: 'Smith',
 
lastname: 'Smith',
email: 'John@mail.com',
 
 
subject: 'Customer Satisfaction',
 
subject: 'Customer Satisfaction',
 
desiredTime: 'now',
 
desiredTime: 'now',
phonenumer: '8881110000'
+
phonenumber: '8881110000'
}
+
},
 +
formJSON: {...}
  
 
}).done(function(e){
 
}).done(function(e){
Line 61: Line 61:
 
| string
 
| string
 
| Value for the last name entry field.
 
| Value for the last name entry field.
|-
 
| form.email
 
| string
 
| Value for the email entry field.
 
 
|-
 
|-
 
| form.subject
 
| form.subject
Line 72: Line 68:
 
| form.desiredTime
 
| form.desiredTime
 
| string
 
| string
| This Value is shared by the Date & Time section in the callback form. A string value 'now' pre-selects 'As soon As Possible' section and sets current local time as the desired time. When a string Date Time value/date object is passed, the desired time is set to this value in the Custom Date & Time input field. During form submission to the server desired time time is converted into UTC string format.
+
| This value is shared by the immediate or scheduled callback drop down option in the form (in other words, As Soon As Possible or Pick date & time). A string value 'now' pre-selects the 'As Soon As Possible' option. A string value with Date Time or Date Object, is passed into this drop down option and pre-selected. During form submission, it is converted into UTC string format and sent to the server as the desired callback time.
 
|-
 
|-
 
| form.phonenumber
 
| form.phonenumber
 
| string
 
| string
 
| Value for the phone entry field. Should be a valid telephone number, when used with a prefix '+' auto selects the country flag near the phone input field.
 
| Value for the phone entry field. Should be a valid telephone number, when used with a prefix '+' auto selects the country flag near the phone input field.
 +
|-
 +
| formJSON
 +
| object
 +
| A JSON object containing a custom registration form definition. See [[CallbackCCRF|Customizable Callback Registration Form]]
 
|-
 
|-
 
| form.userData
 
| form.userData
Line 105: Line 105:
 
=== Example ===
 
=== Example ===
 
<source lang='javascript'>
 
<source lang='javascript'>
oMyPlugin.command('Callback.close').done(function(e){
+
oMyPlugin.command('Callback.close');
 
 
// Callback closed successfully
 
 
 
}).fail(function(e){
 
 
 
// Callback failed to close
 
});
 
 
</source>
 
</source>
  
Line 130: Line 123:
 
| When Callback form is already closed
 
| When Callback form is already closed
 
| 'already closed'
 
| 'already closed'
 +
|-
 +
| rejected
 +
| When user has entered some details on the form and trying to close it without confirming cancellation.
 +
| 'User must confirm close'
 
|-
 
|-
 
|}
 
|}
== configure ==
+
== minimize ==
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.
+
Minimize or unminimize Callback UI.
 
<br /><br />
 
<br /><br />
 
=== Example ===
 
=== Example ===
 
<source lang='javascript'>
 
<source lang='javascript'>
oMyPlugin.command('Callback.configure', {
+
oMyPlugin.command('Callback.minimize');
 +
</source>
  
formValidation: true,
+
<br />
countryCodes: true
+
=== Options ===
 
+
{|
}).done(function(e){
+
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| minimized
 +
| boolean
 +
| Rather than toggling the current minimized state you can specify the minimized state directly: true = minimized, false = unminimized.
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| Always
 +
| n/a
 +
|-
 +
| rejected
 +
| Never
 +
| n/a
 +
|-
 +
|}
 +
== showOverlay ==
 +
A slide-down overlay opens over the Callback's content. You can fill this overlay with content such as disclaimers, articles, and other information.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('Callback.showOverlay', {
  
// Callback configured successfully
+
html: '<div>Example text</div>'
  
}).fail(function(e){
 
 
// Callback wasn't configured properly
 
 
});
 
});
 
</source>
 
</source>
Line 160: Line 187:
 
! Description
 
! Description
 
|-
 
|-
| formValidation
+
| html
 +
| string or HTML reference
 +
| The HTML content you want to display in the overlay.
 +
|-
 +
| hideFooter
 
| boolean
 
| boolean
| Enable/disable browser form validations.
+
| Normally the overlay appears between the titlebar and footer bar. Set this to true to have the overlay overlap the footer to gain a bit more vertical space. This should only be used in special cases. For general use, don't set this value.
 
|-
 
|-
| countryCodes
+
|}
| boolean
+
<br />
| Enable/disable country flags display for phone numbers.
+
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When Callback is open and the overlay opens.
 +
| n/a
 +
|-
 +
| rejected
 +
| When Callback is not currently open.
 +
| Callback is not currently open. Ignoring command.
 
|-
 
|-
 
|}
 
|}
 +
== hideOverlay ==
 +
Hides the slide-down overlay.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('Callback.hideOverlay');
 +
</source>
 +
 
<br />
 
<br />
 
=== Resolutions ===
 
=== Resolutions ===
Line 178: Line 230:
 
|-
 
|-
 
| resolved
 
| resolved
| When configuration options are provided and set
+
| When Callback is open and the overlay closes.
 
| n/a
 
| n/a
 
|-
 
|-
 
| rejected
 
| rejected
| When no configuration options are provided
+
| When Callback is not currently open.
| 'No configuration provided'
+
| Callback is not currently open. Ignoring command.
 
|-
 
|-
 
|}
 
|}
 +
== 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 />
  
 
[[Category:V:PSAAS:Public]]
 
[[Category:V:PSAAS:Public]]

Revision as of 22:04, May 11, 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('Callback.open');

open

Opens the Callback UI.

Example

oMyPlugin.command('Callback.open', {

	form: {

		autoSubmit: false,
		firstname: 'John',
		lastname: 'Smith',
		subject: 'Customer Satisfaction',
		desiredTime: 'now',
		phonenumber: '8881110000'
	},
	formJSON: {...}

}).done(function(e){

	// Callback opened successfully

}).fail(function(e){

	// Callback failed to open
});


Options

Option Type Description
form object Object containing form data to prefill in the callback form and optionally auto-submit the form.
form.autoSubmit boolean Automatically submit the callback form.
form.firstname string Value for the first name entry field.
form.lastname string Value for the last name entry field.
form.subject string Value for the notes entry field.
form.desiredTime string This value is shared by the immediate or scheduled callback drop down option in the form (in other words, As Soon As Possible or Pick date & time). A string value 'now' pre-selects the 'As Soon As Possible' option. A string value with Date Time or Date Object, is passed into this drop down option and pre-selected. During form submission, it is converted into UTC string format and sent to the server as the desired callback time.
form.phonenumber string Value for the phone entry field. Should be a valid telephone number, when used with a prefix '+' auto selects the country flag near the phone input field.
formJSON object A JSON object containing a custom registration form definition. See Customizable Callback Registration Form
form.userData object Arbitrary data that is to be attached with callback schedule. Properties defined here will be merged with default userData set in the configuration object.


Resolutions

Status When Returns
resolved When callback form is successfully opened n/a
rejected When callback form is already open 'already opened'

close

Closes the Callback UI.

Example

oMyPlugin.command('Callback.close');


Resolutions

Status When Returns
resolved When Callback form is successfully closed n/a
rejected When Callback form is already closed 'already closed'
rejected When user has entered some details on the form and trying to close it without confirming cancellation. 'User must confirm close'

minimize

Minimize or unminimize Callback UI.

Example

oMyPlugin.command('Callback.minimize');


Options

Option Type Description
minimized boolean Rather than toggling the current minimized state you can specify the minimized state directly: true = minimized, false = unminimized.


Resolutions

Status When Returns
resolved Always n/a
rejected Never n/a

showOverlay

A slide-down overlay opens over the Callback's content. You can fill this overlay with content such as disclaimers, articles, and other information.

Example

oMyPlugin.command('Callback.showOverlay', {

	html: '<div>Example text</div>'

});


Options

Option Type Description
html string or HTML reference The HTML content you want to display in the overlay.
hideFooter boolean Normally the overlay appears between the titlebar and footer bar. Set this to true to have the overlay overlap the footer to gain a bit more vertical space. This should only be used in special cases. For general use, don't set this value.


Resolutions

Status When Returns
resolved When Callback is open and the overlay opens. n/a
rejected When Callback is not currently open. Callback is not currently open. Ignoring command.

hideOverlay

Hides the slide-down overlay.

Example

oMyPlugin.command('Callback.hideOverlay');


Resolutions

Status When Returns
resolved When Callback is open and the overlay closes. n/a
rejected When Callback is not currently open. Callback is not currently open. Ignoring command.

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.

Comments or questions about this documentation? Contact us for support!