@webex/contact-center 3.13.0-next.12 → 3.13.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-docs/contact-center-spec.md +387 -0
- package/dist/cc.js +7 -7
- package/dist/cc.js.map +1 -1
- package/dist/services/core/Utils.js +21 -2
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +1 -1
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +18 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/keepalive.worker.js +0 -9
- package/dist/services/core/websocket/keepalive.worker.js.map +1 -1
- package/dist/services/task/TaskManager.js +9 -1
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +7 -4
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/types/services/core/Utils.d.ts +9 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +1 -1
- package/dist/webex.js +1 -1
- package/package.json +1 -1
- package/src/cc.ts +19 -11
- package/src/services/core/Utils.ts +19 -0
- package/src/services/core/ai-docs/core-spec.md +808 -0
- package/src/services/core/aqm-reqs.ts +1 -1
- package/src/services/core/websocket/connection-service.ts +21 -2
- package/src/services/core/websocket/keepalive.worker.js +0 -9
- package/src/services/task/TaskManager.ts +12 -1
- package/src/services/task/TaskUtils.ts +10 -9
- package/src/services/task/ai-docs/task-spec.md +1511 -0
- package/test/unit/spec/cc.ts +124 -0
- package/test/unit/spec/services/core/Utils.ts +27 -0
- package/test/unit/spec/services/core/aqm-reqs.ts +18 -0
- package/test/unit/spec/services/core/websocket/connection-service.ts +29 -0
- package/test/unit/spec/services/core/websocket/keepalive.worker.ts +18 -0
- package/test/unit/spec/services/task/TaskManager.ts +52 -0
- package/test/unit/spec/services/task/TaskUtils.ts +51 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -277,7 +277,7 @@ export default class AqmReqs {
|
|
|
277
277
|
const typeField = typeMap.typeField || 'type';
|
|
278
278
|
const msgType = msg[typeField];
|
|
279
279
|
|
|
280
|
-
if (typeMap.conditions && typeMap.conditions
|
|
280
|
+
if (typeMap.conditions && Object.prototype.hasOwnProperty.call(typeMap.conditions, msgType)) {
|
|
281
281
|
const condition = typeMap.conditions[msgType];
|
|
282
282
|
for (const field of Object.keys(condition)) {
|
|
283
283
|
if (!msg[field] || msg[field] !== condition[field]) {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import {CONNECTION_SERVICE_FILE} from '../../../constants';
|
|
12
12
|
import {SubscribeRequest} from '../../../types';
|
|
13
13
|
import {SUBSCRIBE_API} from '../../constants';
|
|
14
|
+
import {isRecord} from '../Utils';
|
|
14
15
|
|
|
15
16
|
export class ConnectionService extends EventEmitter {
|
|
16
17
|
private connectionProp: ConnectionProp = {
|
|
@@ -90,8 +91,26 @@ export class ConnectionService extends EventEmitter {
|
|
|
90
91
|
this.connectionProp = prop;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
private onPing = (event:
|
|
94
|
-
|
|
94
|
+
private onPing = (event: unknown): void => {
|
|
95
|
+
let parsedEvent: unknown;
|
|
96
|
+
try {
|
|
97
|
+
parsedEvent = JSON.parse(event as string);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
LoggerProxy.error(`onPing failed to parse payload: ${(error as Error)?.message}`, {
|
|
100
|
+
module: CONNECTION_SERVICE_FILE,
|
|
101
|
+
method: METHODS.ON_PING,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!isRecord(parsedEvent)) {
|
|
107
|
+
LoggerProxy.error(`onPing received non-object payload, ignoring`, {
|
|
108
|
+
module: CONNECTION_SERVICE_FILE,
|
|
109
|
+
method: METHODS.ON_PING,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
95
114
|
if (this.reconnectingTimer) {
|
|
96
115
|
clearTimeout(this.reconnectingTimer);
|
|
97
116
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// TODO: Try to find alternative to using Blob and script here
|
|
2
2
|
const workerScript = `
|
|
3
|
-
console.log("*** Keepalive Worker Thread ***");
|
|
4
3
|
let intervalId, intervalDuration, timeOutId, isSocketClosed, closeSocketTimeout;
|
|
5
4
|
let initialised = false;
|
|
6
5
|
let initiateWebSocketClosure = false;
|
|
@@ -15,10 +14,6 @@ const resetOfflineHandler = function () {
|
|
|
15
14
|
|
|
16
15
|
const checkOnlineStatus = function () {
|
|
17
16
|
const onlineStatus = navigator.onLine;
|
|
18
|
-
console.log(
|
|
19
|
-
\`[WebSocketStatus] event=checkOnlineStatus | online status=\`,
|
|
20
|
-
onlineStatus
|
|
21
|
-
);
|
|
22
17
|
return onlineStatus;
|
|
23
18
|
};
|
|
24
19
|
|
|
@@ -52,7 +47,6 @@ addEventListener("message", (event) => {
|
|
|
52
47
|
if (event.data?.type === "start") {
|
|
53
48
|
intervalDuration = event.data?.intervalDuration || 4000;
|
|
54
49
|
closeSocketTimeout = event.data?.closeSocketTimeout || 5000;
|
|
55
|
-
console.log("event=Websocket startWorker | keepalive Worker started");
|
|
56
50
|
intervalId = setInterval(
|
|
57
51
|
(checkIfSocketClosed) => {
|
|
58
52
|
checkNetworkStatus();
|
|
@@ -66,7 +60,6 @@ addEventListener("message", (event) => {
|
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
if (event.data?.type === "terminate" && intervalId) {
|
|
69
|
-
console.log("event=Websocket terminateWorker | keepalive Worker stopped");
|
|
70
63
|
clearInterval(intervalId);
|
|
71
64
|
intervalId = null;
|
|
72
65
|
resetOfflineHandler();
|
|
@@ -75,12 +68,10 @@ addEventListener("message", (event) => {
|
|
|
75
68
|
|
|
76
69
|
// Listen for online and offline events
|
|
77
70
|
self.addEventListener('online', () => {
|
|
78
|
-
console.log('Network status: online');
|
|
79
71
|
checkNetworkStatus();
|
|
80
72
|
});
|
|
81
73
|
|
|
82
74
|
self.addEventListener('offline', () => {
|
|
83
|
-
console.log('Network status: offline');
|
|
84
75
|
checkNetworkStatus();
|
|
85
76
|
});
|
|
86
77
|
`;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
getIsConferenceInProgress,
|
|
26
26
|
isCampaignPreviewTask,
|
|
27
27
|
isCampaignPreviewReservation,
|
|
28
|
+
isNonEmptyString,
|
|
28
29
|
isSecondaryEpDnAgent,
|
|
29
30
|
shouldAutoAnswerTask,
|
|
30
31
|
} from './TaskUtils';
|
|
@@ -1692,10 +1693,20 @@ export default class TaskManager extends EventEmitter {
|
|
|
1692
1693
|
if (!action || !this.apiAIAssistant) return;
|
|
1693
1694
|
if (this.configFlags?.aiFeature?.realtimeTranscripts?.enable !== true) return;
|
|
1694
1695
|
|
|
1696
|
+
const trimmedId = interactionId.trim();
|
|
1697
|
+
if (!isNonEmptyString(trimmedId)) {
|
|
1698
|
+
LoggerProxy.error(`Rejected transcript ${action} event with invalid interactionId`, {
|
|
1699
|
+
module: TASK_MANAGER_FILE,
|
|
1700
|
+
method: METHODS.REQUEST_REAL_TIME_TRANSCRIPTS,
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1695
1706
|
this.apiAIAssistant
|
|
1696
1707
|
.sendEvent(
|
|
1697
1708
|
this.agentId,
|
|
1698
|
-
|
|
1709
|
+
trimmedId,
|
|
1699
1710
|
AIAssistantEventType.CUSTOM_EVENT,
|
|
1700
1711
|
AIAssistantEventName.GET_TRANSCRIPTS,
|
|
1701
1712
|
{action}
|
|
@@ -285,7 +285,8 @@ export const isEpDnConsultPendingConferenceMerge = (
|
|
|
285
285
|
const selfParticipant = interaction.participants?.[selfAgentId] as
|
|
286
286
|
| {consultState?: string}
|
|
287
287
|
| undefined;
|
|
288
|
-
|
|
288
|
+
const selfConsultState = selfParticipant?.consultState;
|
|
289
|
+
if (taskData.isConsulted === true || selfConsultState === 'consultCompleted') {
|
|
289
290
|
return false;
|
|
290
291
|
}
|
|
291
292
|
|
|
@@ -308,22 +309,22 @@ export const isEpDnConsultPendingConferenceMerge = (
|
|
|
308
309
|
const callProcessingDetails = interaction.callProcessingDetails as
|
|
309
310
|
| {hasCustomerLeft?: string}
|
|
310
311
|
| undefined;
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
!getIsCustomerInCall(interaction, mainCallId);
|
|
312
|
+
const hasCustomerLeft = callProcessingDetails?.hasCustomerLeft;
|
|
313
|
+
const customerLeft = hasCustomerLeft === 'true' || !getIsCustomerInCall(interaction, mainCallId);
|
|
314
314
|
|
|
315
|
+
const interactionState = interaction.state;
|
|
315
316
|
const conferenceFromPayload =
|
|
316
|
-
|
|
317
|
+
interactionState === INTERACTION_STATE.CONFERENCE ||
|
|
317
318
|
getIsConferenceInProgress(taskData) ||
|
|
318
|
-
(
|
|
319
|
+
(interactionState === INTERACTION_STATE.POST_CALL && customerLeft);
|
|
319
320
|
if (!conferenceFromPayload) return false;
|
|
320
321
|
|
|
321
322
|
return (
|
|
322
323
|
taskData.consultingAgentId === selfAgentId ||
|
|
323
324
|
interaction.owner === selfAgentId ||
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
selfConsultState === CONSULT_STATE.CONSULTING ||
|
|
326
|
+
selfConsultState === CONSULT_STATE.CONFERENCING ||
|
|
327
|
+
selfConsultState === 'consultInitiated'
|
|
327
328
|
);
|
|
328
329
|
};
|
|
329
330
|
|