Skip to content

Commit ae2a7c0

Browse files
bretticus-mcBrett McStotts
and
Brett McStotts
authored
adding custom task ringtones, disable task ringtone, and removing local storage check for login popups (#860)
* adding custom task ringtones, disable task ringtone, and removing local storage check for login popups --------- Co-authored-by: Brett McStotts <mcstotts@amazon.com>
1 parent f769093 commit ae2a7c0

12 files changed

+149
-90
lines changed

Documentation.md

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ In version 1.x, we also support `make` for legacy builds. This option was remove
1616

1717
# Important Announcements
1818

19+
1. March 2024 - In response to a Google Chrome feature launched on 7/13/2023 called [Storage Partitioning](https://developers.google.com/privacy-sandbox/3pcd/storage-partitioning), we made a short term fix on 2/10/2024 to adjust our mute functionality and synchronize the mute state across all CCPs. However, due to current limitations, this change required us to disable muting while being on hold. As a workaround, agents should mute themselves on the call before going on hold. We are planning to address this issue by August 2024 and revert back to original mute behavior.
20+
* At the moment, the following APIs will fail when the contact is on hold:
21+
* `voiceConnection.muteParticipant()`
22+
* `voiceConnection.unmuteParticipant()`
23+
* `agent.mute()`
24+
* `agent.unmute()`
25+
* As a workaround, you can mute the call prior to placing the call on hold.
26+
1927
1. December 2022 - In addition to the CCP, customers can now embed an application that provides guided experiences to your agents using the connect.agentApp. See the [updated documentation](https://github.com/amazon-connect/amazon-connect-streams/blob/master/Documentation.md#initialization-for-ccp-customer-profiles-amazon-q-connect-and-customviews) for details on usage.
2028
- ### Guided experiences for agents
2129
- With Amazon Connect you can now create guided step-by-step experiences that walk agents through tailored views that focus on what must be seen or done by the agent at a given moment during an interaction. You can design workflows for various types of customer interactions and present agents with different step-by-step guides based on context, such as call queue, customer information, and interactive voice response (IVR). This feature is available in the Connect agent workspace as well as an embeddable application that can be embedded into another website via the Streams API. For more information, visit the AWS website: https://aws.amazon.com/connect/agent-workspace/

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Run `npm run release` to generate new release files. Full instructions for build
1818
In version 1.x, we also support `make` for legacy builds. This option was removed in version 2.x.
1919

2020
# Important Announcements
21+
1. March 2024 - In response to a Google Chrome feature launched on 7/13/2023 called [Storage Partitioning](https://developers.google.com/privacy-sandbox/3pcd/storage-partitioning), we made a short term fix on 2/10/2024 to adjust our mute functionality and synchronize the mute state across all CCPs. However, due to current limitations, this change required us to disable muting while being on hold. As a workaround, agents should mute themselves on the call before going on hold. We are planning to address this issue by August 2024 and revert back to original mute behavior.
22+
* At the moment, the following APIs will fail when the contact is on hold:
23+
* `voiceConnection.muteParticipant()`
24+
* `voiceConnection.unmuteParticipant()`
25+
* `agent.mute()`
26+
* `agent.unmute()`
27+
* As a workaround, you can mute the call prior to placing the call on hold.
2128
1. December 2022 - In addition to the CCP, customers can now embed an application that provides guided experiences to your agents using the connect.agentApp. See the [updated documentation](https://github.com/amazon-connect/amazon-connect-streams/blob/master/Documentation.md#initialization-for-ccp-customer-profiles-amazon-q-connect-and-customviews) for details on usage.
2229
* ### Guided experiences for agents
2330
+ With Amazon Connect you can now create guided step-by-step experiences that walk agents through tailored views that focus on what must be seen or done by the agent at a given moment during an interaction. You can design workflows for various types of customer interactions and present agents with different step-by-step guides based on context, such as call queue, customer information, and interactive voice response (IVR). This feature is available in the Connect agent workspace as well as an embeddable application that can be embedded into another website via the Streams API. For more information, visit the AWS website: https://aws.amazon.com/connect/agent-workspace/
@@ -199,6 +206,10 @@ everything setup correctly and that you will be able to listen for events.
199206
allowFramedVideoCall: true, // optional, default to false
200207
allowEarlyGum: true //optional, default to true
201208
},
209+
task: {
210+
disableRingtone: false, // optional, defaults to false
211+
ringtoneUrl: "[your-ringtone-filepath].mp3", // optional, defaults to CCP's default ringtone if a falsy value is set
212+
},
202213
pageOptions: { //optional
203214
enableAudioDeviceSettings: false, //optional, defaults to 'false'
204215
enableVideoDeviceSettings: false, //optional, defaults to 'false'

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amazon-connect-streams",
3-
"version": "2.14.0",
3+
"version": "2.14.1",
44
"description": "Amazon Connect Streams Library",
55
"engines": {
66
"node": ">=12.0.0"

release/connect-streams-dr-min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/connect-streams-dr.js

+16-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/connect-streams-min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/connect-streams.js

+34-31
Original file line numberDiff line numberDiff line change
@@ -26891,7 +26891,7 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
2689126891

2689226892
connect.core = {};
2689326893
connect.core.initialized = false;
26894-
connect.version = "2.14.0";
26894+
connect.version = "2.14.1";
2689526895
connect.outerContextStreamsVersion = null;
2689626896
connect.DEFAULT_BATCH_SIZE = 500;
2689726897

@@ -27454,19 +27454,31 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
2745427454
params.ringtone.chat.ringtoneUrl = otherParams.chat.ringtoneUrl;
2745527455
}
2745627456
}
27457-
27457+
27458+
if (otherParams.task) {
27459+
if (otherParams.task.disableRingtone) {
27460+
params.ringtone.task.disabled = true;
27461+
}
27462+
27463+
if (otherParams.task.ringtoneUrl) {
27464+
params.ringtone.task.ringtoneUrl = otherParams.task.ringtoneUrl;
27465+
}
27466+
}
27467+
2745827468
// Merge in ringtone settings from downstream.
2745927469
if (otherParams.ringtone) {
2746027470
params.ringtone.voice = connect.merge(params.ringtone.voice,
2746127471
otherParams.ringtone.voice || {});
2746227472
params.ringtone.queue_callback = connect.merge(params.ringtone.queue_callback,
2746327473
otherParams.ringtone.voice || {});
2746427474
params.ringtone.chat = connect.merge(params.ringtone.chat,
27465-
otherParams.ringtone.chat || {});
27475+
otherParams.ringtone.chat || {});
27476+
params.ringtone.task = connect.merge(params.ringtone.task,
27477+
otherParams.ringtone.task || {});
2746627478
}
2746727479
};
27468-
27469-
// Merge params from params.softphone and params.chat into params.ringtone
27480+
27481+
// Merge params from params.softphone and params.chat and params.task into params.ringtone
2747027482
// for embedded and non-embedded use cases so that defaults are picked up.
2747127483
mergeParams(params, params);
2747227484

@@ -28229,12 +28241,13 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
2822928241
connect.core.masterClient = new connect.UpstreamConduitMasterClient(conduit);
2823028242
connect.core.portStreamId = data.id;
2823128243

28232-
if (params.softphone || params.chat || params.pageOptions || params.shouldAddNamespaceToLogs || params.disasterRecoveryOn) {
28244+
if (params.softphone || params.chat || params.task || params.pageOptions || params.shouldAddNamespaceToLogs || params.disasterRecoveryOn) {
2823328245
// Send configuration up to the CCP.
2823428246
//set it to false if secondary
2823528247
conduit.sendUpstream(connect.EventType.CONFIGURE, {
2823628248
softphone: params.softphone,
2823728249
chat: params.chat,
28250+
task: params.task,
2823828251
pageOptions: params.pageOptions,
2823928252
shouldAddNamespaceToLogs: params.shouldAddNamespaceToLogs,
2824028253
disasterRecoveryOn: params.disasterRecoveryOn,
@@ -28316,10 +28329,6 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
2831628329
try {
2831728330
var loginUrl = getLoginUrl(params);
2831828331
connect.getLog().warn("ACK_TIMEOUT occurred, attempting to pop the login page if not already open.").sendInternalLogToServer();
28319-
// clear out last opened timestamp for SAML authentication when there is ACK_TIMEOUT
28320-
if (params.loginUrl) {
28321-
connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP);
28322-
}
2832328332
connect.core.loginWindow = connect.core.getPopupManager().open(loginUrl, connect.MasterTopics.LOGIN_POPUP, params.loginOptions);
2832428333
} catch (e) {
2832528334
connect.getLog().error("ACK_TIMEOUT occurred but we are unable to open the login popup.").withException(e).sendInternalLogToServer();
@@ -28332,7 +28341,6 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
2833228341
this.unsubscribe();
2833328342
global.clearTimeout(connect.core.iframeRefreshTimeout);
2833428343
connect.core.iframeRefreshTimeout = null;
28335-
connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP);
2833628344
if ((params.loginPopupAutoClose || (params.loginOptions && params.loginOptions.autoClose)) && connect.core.loginWindow) {
2833728345
connect.core.loginWindow.close();
2833828346
connect.core.loginWindow = null;
@@ -33986,28 +33994,23 @@ AWS.apiLoader.services['connect']['2017-02-15'] = require('../apis/connect-2017-
3398633994
connect.PopupManager = function () { };
3398733995

3398833996
connect.PopupManager.prototype.open = function (url, name, options) {
33989-
var then = this._getLastOpenedTimestamp(name);
33990-
var now = new Date().getTime();
3399133997
var win = null;
33992-
if (now - then > ONE_DAY_MILLIS) {
33993-
if (options) {
33994-
// default values are chosen to provide a minimum height without scrolling
33995-
// and a uniform margin based on the css of the ccp login page
33996-
var height = options.height || DEFAULT_POPUP_HEIGHT;
33997-
var width = options.width || DEFAULT_POPUP_WIDTH;
33998-
var top = options.top || 0;
33999-
var left = options.left || 0;
34000-
win = window.open('', name, "width="+width+", height="+height+", top="+top+", left="+left);
34001-
if (win.location !== url) {
34002-
win = window.open(url, name, "width="+width+", height="+height+", top="+top+", left="+left);
34003-
}
34004-
} else {
34005-
win = window.open('', name);
34006-
if (win.location !== url) {
34007-
win = window.open(url, name);
34008-
}
33998+
if (options) {
33999+
// default values are chosen to provide a minimum height without scrolling
34000+
// and a uniform margin based on the css of the ccp login page
34001+
var height = options.height || DEFAULT_POPUP_HEIGHT;
34002+
var width = options.width || DEFAULT_POPUP_WIDTH;
34003+
var top = options.top || 0;
34004+
var left = options.left || 0;
34005+
win = window.open('', name, "width="+width+", height="+height+", top="+top+", left="+left);
34006+
if (win.location !== url) {
34007+
win = window.open(url, name, "width="+width+", height="+height+", top="+top+", left="+left);
34008+
}
34009+
} else {
34010+
win = window.open('', name);
34011+
if (win.location !== url) {
34012+
win = window.open(url, name);
3400934013
}
34010-
this._setLastOpenedTimestamp(name, now);
3401134014
}
3401234015
return win;
3401334016
};

src/core.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -574,19 +574,31 @@
574574
params.ringtone.chat.ringtoneUrl = otherParams.chat.ringtoneUrl;
575575
}
576576
}
577-
577+
578+
if (otherParams.task) {
579+
if (otherParams.task.disableRingtone) {
580+
params.ringtone.task.disabled = true;
581+
}
582+
583+
if (otherParams.task.ringtoneUrl) {
584+
params.ringtone.task.ringtoneUrl = otherParams.task.ringtoneUrl;
585+
}
586+
}
587+
578588
// Merge in ringtone settings from downstream.
579589
if (otherParams.ringtone) {
580590
params.ringtone.voice = connect.merge(params.ringtone.voice,
581591
otherParams.ringtone.voice || {});
582592
params.ringtone.queue_callback = connect.merge(params.ringtone.queue_callback,
583593
otherParams.ringtone.voice || {});
584594
params.ringtone.chat = connect.merge(params.ringtone.chat,
585-
otherParams.ringtone.chat || {});
595+
otherParams.ringtone.chat || {});
596+
params.ringtone.task = connect.merge(params.ringtone.task,
597+
otherParams.ringtone.task || {});
586598
}
587599
};
588-
589-
// Merge params from params.softphone and params.chat into params.ringtone
600+
601+
// Merge params from params.softphone and params.chat and params.task into params.ringtone
590602
// for embedded and non-embedded use cases so that defaults are picked up.
591603
mergeParams(params, params);
592604

@@ -1349,12 +1361,13 @@
13491361
connect.core.masterClient = new connect.UpstreamConduitMasterClient(conduit);
13501362
connect.core.portStreamId = data.id;
13511363

1352-
if (params.softphone || params.chat || params.pageOptions || params.shouldAddNamespaceToLogs || params.disasterRecoveryOn) {
1364+
if (params.softphone || params.chat || params.task || params.pageOptions || params.shouldAddNamespaceToLogs || params.disasterRecoveryOn) {
13531365
// Send configuration up to the CCP.
13541366
//set it to false if secondary
13551367
conduit.sendUpstream(connect.EventType.CONFIGURE, {
13561368
softphone: params.softphone,
13571369
chat: params.chat,
1370+
task: params.task,
13581371
pageOptions: params.pageOptions,
13591372
shouldAddNamespaceToLogs: params.shouldAddNamespaceToLogs,
13601373
disasterRecoveryOn: params.disasterRecoveryOn,
@@ -1436,10 +1449,6 @@
14361449
try {
14371450
var loginUrl = getLoginUrl(params);
14381451
connect.getLog().warn("ACK_TIMEOUT occurred, attempting to pop the login page if not already open.").sendInternalLogToServer();
1439-
// clear out last opened timestamp for SAML authentication when there is ACK_TIMEOUT
1440-
if (params.loginUrl) {
1441-
connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP);
1442-
}
14431452
connect.core.loginWindow = connect.core.getPopupManager().open(loginUrl, connect.MasterTopics.LOGIN_POPUP, params.loginOptions);
14441453
} catch (e) {
14451454
connect.getLog().error("ACK_TIMEOUT occurred but we are unable to open the login popup.").withException(e).sendInternalLogToServer();
@@ -1452,7 +1461,6 @@
14521461
this.unsubscribe();
14531462
global.clearTimeout(connect.core.iframeRefreshTimeout);
14541463
connect.core.iframeRefreshTimeout = null;
1455-
connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP);
14561464
if ((params.loginPopupAutoClose || (params.loginOptions && params.loginOptions.autoClose)) && connect.core.loginWindow) {
14571465
connect.core.loginWindow.close();
14581466
connect.core.loginWindow = null;

src/index.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ declare namespace connect {
441441
readonly ringtoneUrl?: string;
442442
}
443443

444+
interface TaskOptions {
445+
/** This option allows you to completely disable the built-in ringtone audio that is played when a task is incoming. */
446+
readonly disableRingtone?: boolean;
447+
448+
/** If the ringtone is not disabled, this allows for overriding the ringtone with any browser-supported audio file accessible by the user. */
449+
readonly ringtoneUrl?: string;
450+
}
451+
444452
interface LoginOptions {
445453
/*
446454
* Whether to auto close the login prompt.
@@ -526,6 +534,9 @@ declare namespace connect {
526534
/** Allows you to specify ringtone settings for Chat. */
527535
readonly chat?: ChatOptions;
528536

537+
/** Allows you to specify ringtone settings for Task. */
538+
readonly task?: TaskOptions;
539+
529540
/**
530541
* Allows you to customize the title attribute of the CCP iframe.
531542
* @example "Contact Control Panel"

src/util.js

+15-20
Original file line numberDiff line numberDiff line change
@@ -560,28 +560,23 @@
560560
connect.PopupManager = function () { };
561561

562562
connect.PopupManager.prototype.open = function (url, name, options) {
563-
var then = this._getLastOpenedTimestamp(name);
564-
var now = new Date().getTime();
565563
var win = null;
566-
if (now - then > ONE_DAY_MILLIS) {
567-
if (options) {
568-
// default values are chosen to provide a minimum height without scrolling
569-
// and a uniform margin based on the css of the ccp login page
570-
var height = options.height || DEFAULT_POPUP_HEIGHT;
571-
var width = options.width || DEFAULT_POPUP_WIDTH;
572-
var top = options.top || 0;
573-
var left = options.left || 0;
574-
win = window.open('', name, "width="+width+", height="+height+", top="+top+", left="+left);
575-
if (win.location !== url) {
576-
win = window.open(url, name, "width="+width+", height="+height+", top="+top+", left="+left);
577-
}
578-
} else {
579-
win = window.open('', name);
580-
if (win.location !== url) {
581-
win = window.open(url, name);
582-
}
564+
if (options) {
565+
// default values are chosen to provide a minimum height without scrolling
566+
// and a uniform margin based on the css of the ccp login page
567+
var height = options.height || DEFAULT_POPUP_HEIGHT;
568+
var width = options.width || DEFAULT_POPUP_WIDTH;
569+
var top = options.top || 0;
570+
var left = options.left || 0;
571+
win = window.open('', name, "width="+width+", height="+height+", top="+top+", left="+left);
572+
if (win.location !== url) {
573+
win = window.open(url, name, "width="+width+", height="+height+", top="+top+", left="+left);
574+
}
575+
} else {
576+
win = window.open('', name);
577+
if (win.location !== url) {
578+
win = window.open(url, name);
583579
}
584-
this._setLastOpenedTimestamp(name, now);
585580
}
586581
return win;
587582
};

0 commit comments

Comments
 (0)