System namespace

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Service Client API Reference for version Current of Developer.

Learn about the System namespace methods in the Service Client API.

Important
Depending on your environment, you might need to contact your Genesys representative to complete the configuration described on this page.

Methods

The System namespace includes the following methods:

getAllowedServices

Signature <static> getAllowedServices() → {Array.<string>}
Description Gets the list of allowed services, as determined by the Security configuration. If the domain of the web application that calls this method isn't listed in the service-client-api.accepted-web-content-origins option, then this method fails.
Returns Array.<string>

triggerActivity

Signature <static> triggerActivity()
Description Triggers a fake activity to prevent the inactivity timer from closing the agent session.

popupToast

Signature <static> popupToast(parameters) → {string}
Description Pops up a new custom toast.
Parameters
Name Type Description
title string The title
iconUrl string The URL of the icon you want to display in the title bar of the custom toast popup.
subject string Optional. The subject
message string Optional. The message
keyValues string Optional. JSON object used to fill the key value pair list. For example: {"key1" ; "value one","key2" ; "value two","key3" ; "value three"}.
buttons Array.<string> Optional. Each character string in this array becomes a button. All buttons are displayed as buttons, not hyperlinks, in the following order: [Button 2] [Button 3] ... [Button N] [Button 1].
buttonShowDismiss boolean Optional. If set to true, displays the Show and Dismiss buttons and pops up the current iframe if the Show button is pushed. If set to false , displays '"OK"' or custom buttons based on the parameter's buttons.
autoCloseTimeout object Optional. If set to greater than 0, the popup is automatically closed after the specified milliseconds.
sendToMyMessage object Optional. If set to true, sends the subject, iconUrl, title, keyValues, and message parameters to the MyMessage panel.
width number Optional. The width of the custom toast popup, in pixels. This values takes precedence over the service-client-api.toast.width configuration option.
Returns A unique identifier

updateToast

Signature <static> updateToast(id, parameters) → {boolean}
Description Updates the specified toast.
Parameters
Name Type Description
id string The identifier of the toast to update. The identifier is returned by the popupToast method.
parameters object
Name Type Description
title string The title
iconURL string The URL of the icon you want to display in the title bar of the custom toast popup.
subject string Optional. The subject.
message string Optional. The message.
keyValues object Optional. JSON object used to fill the key value pair list. For example: {"key1" : "value one","key2" : "value two","key3" : "value three"}.
buttons Array.<string> Each character string in this array becomes a button. All buttons are displayed as buttons, not hyperlinks, in the following order: [Button 2] [Button 3] ... [Button N] [Button 1].
buttonShowDismiss boolean If set to true, displays Show and Dismiss buttons and pops up the current iframe if the Show button is pushed. If set to false, displays '"OK"' or custom buttons based on the parameter's buttons.
Returns true if the toast has been updated; false if the toast identifier has not been found.

closeToast

Signature <static> closeToast(id) → {boolean}
Description Closes the specified toast.
Parameters
Name Type Description
id string The identifier of the toast to close. The identifier is returned by the popupToast method.
Returns true if the toast has been updated; false if the toast identifier has not been found.

isFrameLeading

Signature <static> isFrameLeading(succeeded, failed) → {boolean}
Description Find out if the browser tab is leading.
Parameters
Name Type Description
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if the browser tab is the leader.

isFrameFollowing

Signature <static> isFrameFollowing(succeeded, failed) → {boolean}
Description Find out if the browser tab is following.
Parameters
Name Type Description
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if this browser tab is following.

isFrameNegotiating

Signature <static> isFrameNegotiating(succeeded, failed) → {boolean}
Description Find out if there is an election in progress and the browser tab state is not yet set to leading or following (the tab is "negotiating.")
Parameters
Name Type Description
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if the tab is negotiating.

isFrameLeadingOrNegotiating

Signature <static> isFrameLeadingOrNegotiating(succeeded, failed) → {boolean}
Description Find out if the browser tab is leading or there is an election in progress and the tab state is not yet set to leading or following (the tab is "negotiating.").
Parameters
Name Type Description
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if the browser tab is leading or negotiating.

isLastActiveFrame

Signature <static> isLastActiveFrame(succeeded, failed) → {boolean}
Description Find out if this is the last active browser tab.
Parameters
Name Type Description
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if this is the last active browser tab.

amIVisible

Signature <static> amIVisible() → {boolean}
Description Get the current visibility state of the frame.
Returns true if the frame is visible.

Sample request

setTimeout(function() {
    genesys.wwe.service.system.amIVisible(succeeded, failed);
}, 3000); // This gives 3 seconds to switch the panel to test.

Sample response

The asynchronous answer is included in the data attribute:
{
  "request": "system.amIVisible",
  "data": true,
  "userAgent": "WWE Server",
  "protocolVersion": 2
}

openDialog

Signature <static> openDialog(url, options, succeeded, failed) → {string}
Description Open an iframe in a dialog, based on the configured parameters.
Parameters
Name Type Description
url string The URL of the iframe to load in the dialog.
options object Optional parameters to configure the dialog. This value can't be null, so you must pass {} if there are no specific options. You can include any of the following options:
  • label - Set a custom value for the aria-label attribute on the dialog. When the dialog pops up, this value identifies it to accessibility tools like screen readers.
  • width - The initial width of the dialog. Valid formats are px or %.
  • height - The initial height of the dialog. Valid formats are px or %.
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns The dialog identifier or null if the url parameter is not defined.

Sample request

genesys.wwe.service.system.openDialog("<url>", {
  label: "Dialog $Agent.FullName$",
  width: "430px",
  height: "325px"
}, succeeded, failed)

Sample response

The asynchronous answer is included in the data attribute:
{
    "request": "system.openDialog",
    "data": "wweCustomDialog1",
    "userAgent": "WWE Server",
    "protocolVersion": 2
}

closeDialog

Signature <static> closeDialog(dialogId, succeeded, failed) → {boolean}
Description Close a previously opened dialog.
Parameters
Name Type Description
dialogId string The dialog identifier (returned in the response of openDialog).
succeeded string The callback function to use if the operation succeeded.
failed string The callback function to use if the operation failed.
Returns true if the dialog is closed; false if the dialog is not found.

Sample request

genesys.wwe.service.system.closeDialog("wweCustomDialog1", succeeded, failed)

Sample response

The asynchronous answer is included in the data attribute:
{
    "request": "system.closeDialog",
    "data": true,
    "userAgent": "WWE Server",
    "protocolVersion": 2
}