@webex/contact-center 3.12.0-next.12 → 3.12.0-next.121
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/.sdd/manifest.json +884 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +51 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +138 -0
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +444 -0
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +359 -0
- package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +808 -40
- package/dist/cc.js.map +1 -1
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +27 -3
- package/dist/constants.js.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/MetricsManager.js +16 -0
- package/dist/metrics/MetricsManager.js.map +1 -1
- package/dist/metrics/behavioral-events.js +205 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +43 -4
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +18 -15
- package/dist/services/AddressBook.js.map +1 -1
- package/dist/services/AnswerCallOnWebexService.js +202 -0
- package/dist/services/AnswerCallOnWebexService.js.map +1 -0
- package/dist/services/ApiAiAssistant.js +153 -8
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/EntryPoint.js +46 -68
- package/dist/services/EntryPoint.js.map +1 -1
- package/dist/services/Queue.js +27 -22
- package/dist/services/Queue.js.map +1 -1
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/WebexCrossClientService.js +222 -0
- package/dist/services/WebexCrossClientService.js.map +1 -0
- package/dist/services/WxAppTelephonyMercurySync.js +108 -0
- package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
- package/dist/services/config/Util.js +6 -3
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +33 -8
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/types.js +53 -9
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +107 -32
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/WebexRequest.js +6 -2
- package/dist/services/core/WebexRequest.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +28 -14
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/types.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +2 -1
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +754 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +49 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +1053 -520
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +211 -27
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/WebexCallingUtils.js +70 -0
- package/dist/services/task/WebexCallingUtils.js.map +1 -0
- package/dist/services/task/constants.js +12 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +29 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/dialer.js +78 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +78 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +954 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +572 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +379 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +228 -5
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1447 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +152 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js +354 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
- package/dist/services/wxAppDiagnosticLogging.js +122 -0
- package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
- package/dist/services/wxAppTelephonyUtils.js +19 -0
- package/dist/services/wxAppTelephonyUtils.js.map +1 -0
- package/dist/types/cc.d.ts +172 -5
- package/dist/types/config.d.ts +13 -0
- package/dist/types/constants.d.ts +25 -1
- package/dist/types/index.d.ts +24 -7
- package/dist/types/metrics/MetricsManager.d.ts +6 -0
- package/dist/types/metrics/constants.d.ts +38 -1
- package/dist/types/services/AddressBook.d.ts +2 -1
- package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
- package/dist/types/services/ApiAiAssistant.d.ts +22 -4
- package/dist/types/services/EntryPoint.d.ts +7 -5
- package/dist/types/services/Queue.d.ts +5 -3
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebexCrossClientService.d.ts +32 -0
- package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
- package/dist/types/services/config/constants.d.ts +29 -5
- package/dist/types/services/config/types.d.ts +184 -10
- package/dist/types/services/core/Err.d.ts +6 -0
- package/dist/types/services/core/Utils.d.ts +33 -13
- package/dist/types/services/core/WebexRequest.d.ts +1 -0
- package/dist/types/services/core/types.d.ts +2 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
- package/dist/types/services/core/websocket/types.d.ts +1 -1
- package/dist/types/services/index.d.ts +1 -1
- package/dist/types/services/task/Task.d.ts +175 -0
- package/dist/types/services/task/TaskFactory.d.ts +13 -0
- package/dist/types/services/task/TaskUtils.d.ts +48 -2
- package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
- package/dist/types/services/task/constants.d.ts +10 -0
- package/dist/types/services/task/contact.d.ts +4 -0
- package/dist/types/services/task/dialer.d.ts +30 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1356 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +103 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +277 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +680 -66
- package/dist/types/services/task/voice/Voice.d.ts +227 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +55 -0
- package/dist/types/services/wxAppDiagnosticLogging.d.ts +51 -0
- package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
- package/dist/types/types.d.ts +149 -8
- package/dist/types/utils/PageCache.d.ts +20 -3
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +125 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +19 -5
- package/dist/utils/PageCache.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +16 -12
- package/src/cc.ts +986 -42
- package/src/config.ts +13 -0
- package/src/constants.ts +25 -1
- package/src/index.ts +25 -5
- package/src/metrics/MetricsManager.ts +16 -0
- package/src/metrics/ai-docs/AGENTS.md +350 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
- package/src/metrics/ai-docs/metrics-spec.md +922 -0
- package/src/metrics/behavioral-events.ts +212 -0
- package/src/metrics/constants.ts +47 -4
- package/src/services/AddressBook.ts +17 -6
- package/src/services/AnswerCallOnWebexService.ts +239 -0
- package/src/services/ApiAiAssistant.ts +203 -8
- package/src/services/EntryPoint.ts +59 -60
- package/src/services/Queue.ts +29 -12
- package/src/services/UserPreference.ts +509 -0
- package/src/services/WebexCrossClientService.ts +293 -0
- package/src/services/WxAppTelephonyMercurySync.ts +142 -0
- package/src/services/agent/ai-docs/AGENTS.md +240 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
- package/src/services/agent/ai-docs/agent-spec.md +505 -0
- package/src/services/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +497 -0
- package/src/services/config/Util.ts +6 -3
- package/src/services/config/ai-docs/AGENTS.md +255 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
- package/src/services/config/ai-docs/config-spec.md +675 -0
- package/src/services/config/constants.ts +35 -7
- package/src/services/config/types.ts +186 -11
- package/src/services/core/Err.ts +3 -0
- package/src/services/core/Utils.ts +123 -37
- package/src/services/core/WebexRequest.ts +3 -1
- package/src/services/core/ai-docs/AGENTS.md +381 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
- package/src/services/core/ai-docs/core-spec.md +787 -0
- package/src/services/core/aqm-reqs.ts +30 -15
- package/src/services/core/types.ts +2 -0
- package/src/services/core/websocket/WebSocketManager.ts +2 -0
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/services/task/Task.ts +908 -0
- package/src/services/task/TaskFactory.ts +60 -0
- package/src/services/task/TaskManager.ts +1239 -608
- package/src/services/task/TaskUtils.ts +303 -25
- package/src/services/task/WebexCallingUtils.ts +136 -0
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
- package/src/services/task/ai-docs/task-spec.md +1470 -0
- package/src/services/task/constants.ts +10 -0
- package/src/services/task/contact.ts +30 -0
- package/src/services/task/dialer.ts +80 -0
- package/src/services/task/digital/Digital.ts +97 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1293 -0
- package/src/services/task/state-machine/actions.ts +741 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1145 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2207 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +442 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +258 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +819 -70
- package/src/services/task/voice/Voice.ts +1809 -0
- package/src/services/task/voice/WebRTC.ts +191 -0
- package/src/services/task/voice/wxAppVoiceMethods.ts +516 -0
- package/src/services/wxAppDiagnosticLogging.ts +174 -0
- package/src/services/wxAppTelephonyUtils.ts +14 -0
- package/src/types.ts +199 -11
- package/src/utils/AGENTS.md +289 -0
- package/src/utils/PageCache.ts +38 -5
- package/src/utils/ai-docs/utils-spec.md +391 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +1947 -124
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/metrics/MetricsManager.ts +25 -0
- package/test/unit/spec/metrics/behavioral-events.ts +60 -0
- package/test/unit/spec/services/AddressBook.ts +37 -6
- package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +178 -20
- package/test/unit/spec/services/EntryPoint.ts +87 -40
- package/test/unit/spec/services/Queue.ts +123 -12
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/WebexCrossClientService.ts +467 -0
- package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
- package/test/unit/spec/services/config/Util.ts +85 -0
- package/test/unit/spec/services/config/index.ts +30 -30
- package/test/unit/spec/services/core/Utils.ts +425 -8
- package/test/unit/spec/services/core/WebexRequest.ts +3 -1
- package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +677 -0
- package/test/unit/spec/services/task/TaskFactory.ts +99 -0
- package/test/unit/spec/services/task/TaskManager.ts +1972 -1549
- package/test/unit/spec/services/task/TaskUtils.ts +235 -0
- package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
- package/test/unit/spec/services/task/contact.ts +33 -0
- package/test/unit/spec/services/task/dialer.ts +190 -0
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3459 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +1903 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +603 -0
- package/test/unit/spec/services/wxAppDiagnosticLogging.ts +143 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- package/dist/services/task/index.js.map +0 -1
- package/dist/types/services/task/index.d.ts +0 -650
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import LoggerProxy from '../logger-proxy';
|
|
2
|
+
|
|
3
|
+
export const WXAPP_LOG_FEATURE = 'wxApp';
|
|
4
|
+
export const WXAPP_LOG_PREFIX = '[CC wxApp]';
|
|
5
|
+
|
|
6
|
+
export type WxAppAcceptReason =
|
|
7
|
+
| 'wxApp_offer_ready'
|
|
8
|
+
| 'wxApp_answer_pending'
|
|
9
|
+
| 'wxApp_accept_in_flight'
|
|
10
|
+
| 'extension_non_wxApp_offer'
|
|
11
|
+
| 'browser_webrtc_offer'
|
|
12
|
+
| 'outdial_auto_answer';
|
|
13
|
+
|
|
14
|
+
export type WxAppSessionSkipReason =
|
|
15
|
+
| 'unsupported_browser_login'
|
|
16
|
+
| 'flag_disabled'
|
|
17
|
+
| 'mercury_subscribe_failed'
|
|
18
|
+
| 'publish_failed';
|
|
19
|
+
|
|
20
|
+
export type WxAppTelephonyAction = 'accept' | 'decline' | 'mute' | 'dtmf';
|
|
21
|
+
export type WxAppTelephonyPhase = 'started' | 'success' | 'failed';
|
|
22
|
+
|
|
23
|
+
type WxAppLogData = Record<string, string | boolean | number | undefined>;
|
|
24
|
+
|
|
25
|
+
/** Last 8 chars of callId for correlation without logging full id. */
|
|
26
|
+
export function callIdSuffix(callId: string | null | undefined): string | undefined {
|
|
27
|
+
if (!callId) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return callId.length <= 8 ? callId : callId.slice(-8);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function logWxApp(message: string, method: string, data: WxAppLogData): void {
|
|
35
|
+
LoggerProxy.info(`${WXAPP_LOG_PREFIX} ${message}`, {
|
|
36
|
+
module: 'wxAppDiagnosticLogging',
|
|
37
|
+
method,
|
|
38
|
+
data: {feature: WXAPP_LOG_FEATURE, ...data},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function logWxAppError(message: string, method: string, data: WxAppLogData): void {
|
|
43
|
+
LoggerProxy.error(`${WXAPP_LOG_PREFIX} ${message}`, {
|
|
44
|
+
module: 'wxAppDiagnosticLogging',
|
|
45
|
+
method,
|
|
46
|
+
data: {feature: WXAPP_LOG_FEATURE, ...data},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function logWxAppSessionReadiness(params: {
|
|
51
|
+
enableWxBetterTogether: boolean;
|
|
52
|
+
loginOption: string | undefined;
|
|
53
|
+
wxAppHooksApplied: boolean;
|
|
54
|
+
usersubPublished: boolean;
|
|
55
|
+
mercurySubscribed: boolean;
|
|
56
|
+
telephonyTaskType: 'Voice' | 'WebRTC' | 'unknown';
|
|
57
|
+
skipReason?: WxAppSessionSkipReason;
|
|
58
|
+
}): void {
|
|
59
|
+
logWxApp('session readiness', 'logWxAppSessionReadiness', {
|
|
60
|
+
event: 'session_readiness',
|
|
61
|
+
enableWxBetterTogether: params.enableWxBetterTogether,
|
|
62
|
+
loginOption: params.loginOption,
|
|
63
|
+
wxAppHooksApplied: params.wxAppHooksApplied,
|
|
64
|
+
usersubPublished: params.usersubPublished,
|
|
65
|
+
mercurySubscribed: params.mercurySubscribed,
|
|
66
|
+
telephonyTaskType: params.telephonyTaskType,
|
|
67
|
+
skipReason: params.skipReason,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function deriveWxAppAcceptReason(params: {
|
|
72
|
+
isWxAppInboundOffer: boolean;
|
|
73
|
+
isWxAppOutdialOffer: boolean;
|
|
74
|
+
isWebrtc: boolean;
|
|
75
|
+
isOutdial: boolean;
|
|
76
|
+
wxAppAcceptInFlight: boolean;
|
|
77
|
+
wxAppAnswerPending: boolean;
|
|
78
|
+
enableWxBetterTogether: boolean;
|
|
79
|
+
hasDeviceCallId: boolean;
|
|
80
|
+
}): WxAppAcceptReason {
|
|
81
|
+
if (params.isWxAppInboundOffer || params.isWxAppOutdialOffer) {
|
|
82
|
+
if (params.wxAppAcceptInFlight) {
|
|
83
|
+
return 'wxApp_accept_in_flight';
|
|
84
|
+
}
|
|
85
|
+
if (params.wxAppAnswerPending) {
|
|
86
|
+
return 'wxApp_answer_pending';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return 'wxApp_offer_ready';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (params.isWebrtc && !params.isOutdial) {
|
|
93
|
+
return 'browser_webrtc_offer';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (params.isOutdial) {
|
|
97
|
+
return 'outdial_auto_answer';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (params.enableWxBetterTogether && !params.hasDeviceCallId) {
|
|
101
|
+
return 'extension_non_wxApp_offer';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return 'extension_non_wxApp_offer';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function logWxAppOfferDecision(params: {
|
|
108
|
+
interactionId: string;
|
|
109
|
+
acceptVisible: boolean;
|
|
110
|
+
acceptEnabled: boolean;
|
|
111
|
+
acceptReason: WxAppAcceptReason;
|
|
112
|
+
wxAppParticipantDeviceType?: string;
|
|
113
|
+
hasDeviceCallId: boolean;
|
|
114
|
+
}): void {
|
|
115
|
+
logWxApp('offer decision', 'logWxAppOfferDecision', {
|
|
116
|
+
event: 'offer_decision',
|
|
117
|
+
interactionId: params.interactionId,
|
|
118
|
+
acceptVisible: params.acceptVisible,
|
|
119
|
+
acceptEnabled: params.acceptEnabled,
|
|
120
|
+
acceptReason: params.acceptReason,
|
|
121
|
+
wxAppParticipantDeviceType: params.wxAppParticipantDeviceType,
|
|
122
|
+
hasDeviceCallId: params.hasDeviceCallId,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function logWxAppTelephonyAction(params: {
|
|
127
|
+
action: WxAppTelephonyAction;
|
|
128
|
+
phase: WxAppTelephonyPhase;
|
|
129
|
+
interactionId?: string;
|
|
130
|
+
trackingId?: string;
|
|
131
|
+
httpStatus?: number | string;
|
|
132
|
+
failureReason?: string;
|
|
133
|
+
}): void {
|
|
134
|
+
const payload: WxAppLogData = {
|
|
135
|
+
event: 'telephony_action',
|
|
136
|
+
action: params.action,
|
|
137
|
+
phase: params.phase,
|
|
138
|
+
interactionId: params.interactionId,
|
|
139
|
+
trackingId: params.trackingId,
|
|
140
|
+
httpStatus: params.httpStatus,
|
|
141
|
+
failureReason: params.failureReason,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
if (params.phase === 'failed') {
|
|
145
|
+
logWxAppError(`telephony ${params.action} ${params.phase}`, 'logWxAppTelephonyAction', payload);
|
|
146
|
+
} else {
|
|
147
|
+
logWxApp(`telephony ${params.action} ${params.phase}`, 'logWxAppTelephonyAction', payload);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function logWxAppValidationFailure(reason: string, interactionId?: string): void {
|
|
152
|
+
logWxAppError('validation failed', 'logWxAppValidationFailure', {
|
|
153
|
+
event: 'validation_failed',
|
|
154
|
+
reason,
|
|
155
|
+
interactionId,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function logWxAppMercuryMuteSync(params: {
|
|
160
|
+
phase: 'received' | 'applied' | 'dropped';
|
|
161
|
+
muted?: boolean;
|
|
162
|
+
callIdSuffix?: string;
|
|
163
|
+
interactionId?: string;
|
|
164
|
+
dropReason?: string;
|
|
165
|
+
}): void {
|
|
166
|
+
logWxApp(`mercury mute sync ${params.phase}`, 'logWxAppMercuryMuteSync', {
|
|
167
|
+
event: 'mercury_mute_sync',
|
|
168
|
+
phase: params.phase,
|
|
169
|
+
muted: params.muted,
|
|
170
|
+
callIdSuffix: params.callIdSuffix,
|
|
171
|
+
interactionId: params.interactionId,
|
|
172
|
+
dropReason: params.dropReason,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expected Hydra responses when mute backfill races call creation (WXCC-6026).
|
|
3
|
+
* These must not be logged as errors — see task-spec wxApp mute backfill guard.
|
|
4
|
+
*/
|
|
5
|
+
export function isWxAppCallNotFoundError(error: unknown): boolean {
|
|
6
|
+
const err = error as {status?: number | string; message?: string};
|
|
7
|
+
if (err?.status === 400 || err?.status === '400') {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const message = String(err?.message ?? error ?? '');
|
|
12
|
+
|
|
13
|
+
return message.includes('Call not found') || message.includes('101002');
|
|
14
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -6,7 +6,12 @@ import {
|
|
|
6
6
|
} from '@webex/internal-plugin-metrics/src/metrics.types';
|
|
7
7
|
import * as Agent from './services/agent/types';
|
|
8
8
|
import * as Contact from './services/task/types';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
AIFeatureFlags,
|
|
11
|
+
Profile,
|
|
12
|
+
CreateUserPreferenceRequest,
|
|
13
|
+
UpdateUserPreferenceRequest,
|
|
14
|
+
} from './services/config/types';
|
|
10
15
|
import {PaginatedResponse, BaseSearchParams} from './utils/PageCache';
|
|
11
16
|
|
|
12
17
|
/**
|
|
@@ -88,12 +93,19 @@ export type WebexRequestPayload = {
|
|
|
88
93
|
*/
|
|
89
94
|
type Listener = (e: string, data?: unknown) => void;
|
|
90
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Mercury event handler callback.
|
|
98
|
+
* @internal
|
|
99
|
+
* @ignore
|
|
100
|
+
*/
|
|
101
|
+
type MercuryEventHandler = (data?: unknown) => void;
|
|
102
|
+
|
|
91
103
|
/**
|
|
92
104
|
* Event listener removal function type.
|
|
93
105
|
* @internal
|
|
94
106
|
* @ignore
|
|
95
107
|
*/
|
|
96
|
-
type ListenerOff = (e: string) => void;
|
|
108
|
+
type ListenerOff = (e: string, handler?: MercuryEventHandler) => void;
|
|
97
109
|
|
|
98
110
|
/**
|
|
99
111
|
* Service host configuration.
|
|
@@ -156,6 +168,10 @@ export interface CCPluginConfig {
|
|
|
156
168
|
};
|
|
157
169
|
/** Configuration for the calling client */
|
|
158
170
|
callingClientConfig: CallingClientConfig;
|
|
171
|
+
/** Whether to skip Mobius/WebRTC registration for browser login flows */
|
|
172
|
+
disableWebRTCRegistration?: boolean;
|
|
173
|
+
/** Whether wxApp Better Together (telephony REST + usersub) is enabled at init (WXCC-6026) */
|
|
174
|
+
enableWxBetterTogether?: boolean;
|
|
159
175
|
}
|
|
160
176
|
|
|
161
177
|
/**
|
|
@@ -286,6 +302,12 @@ interface IWebexInternal {
|
|
|
286
302
|
version: string;
|
|
287
303
|
/** Calling behavior configuration */
|
|
288
304
|
callingBehavior: string;
|
|
305
|
+
/** Whether the device is registered with WDM */
|
|
306
|
+
registered?: boolean;
|
|
307
|
+
/** Register the device with WDM */
|
|
308
|
+
register?: () => Promise<void>;
|
|
309
|
+
/** Unregister the device from WDM */
|
|
310
|
+
unregister?: () => Promise<void>;
|
|
289
311
|
};
|
|
290
312
|
/** Presence service */
|
|
291
313
|
presence: unknown;
|
|
@@ -542,22 +564,22 @@ export type RequestBody =
|
|
|
542
564
|
| Contact.cancelCtq
|
|
543
565
|
| Contact.WrapupPayLoad
|
|
544
566
|
| Contact.DialerPayload
|
|
545
|
-
| Contact.PreviewContactPayload
|
|
567
|
+
| Contact.PreviewContactPayload
|
|
568
|
+
| CreateUserPreferenceRequest
|
|
569
|
+
| UpdateUserPreferenceRequest;
|
|
546
570
|
|
|
547
571
|
/**
|
|
548
572
|
* Represents the options to fetch buddy agents for the logged in agent.
|
|
549
|
-
* Buddy agents are other agents who can be consulted or
|
|
573
|
+
* Buddy agents are other agents who can be consulted or transferred to.
|
|
550
574
|
* @public
|
|
551
575
|
* @example
|
|
552
576
|
* const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };
|
|
553
|
-
* @ignore
|
|
554
577
|
*/
|
|
555
578
|
export type BuddyAgents = {
|
|
556
579
|
/**
|
|
557
|
-
* The media type channel to filter buddy agents.
|
|
558
|
-
* Determines which channel capability the returned agents must have.
|
|
580
|
+
* The media type channel to filter buddy agents. Defaults to telephony when omitted.
|
|
559
581
|
*/
|
|
560
|
-
mediaType
|
|
582
|
+
mediaType?: 'telephony' | 'chat' | 'social' | 'email';
|
|
561
583
|
|
|
562
584
|
/**
|
|
563
585
|
* Optional filter for agent state.
|
|
@@ -565,9 +587,37 @@ export type BuddyAgents = {
|
|
|
565
587
|
* If omitted, returns both available and idle agents.
|
|
566
588
|
*/
|
|
567
589
|
state?: 'Available' | 'Idle';
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Applies the default state policy for the operation. An explicit state takes precedence.
|
|
593
|
+
*/
|
|
594
|
+
action?: 'Consult' | 'Transfer';
|
|
568
595
|
};
|
|
569
596
|
|
|
570
597
|
/**
|
|
598
|
+
* Holds the configuration flags for the Agent.
|
|
599
|
+
* These flags determine the availability of certain features in the Agent UI.
|
|
600
|
+
* @internal
|
|
601
|
+
*/
|
|
602
|
+
export type ConfigFlags = {
|
|
603
|
+
isEndTaskEnabled: boolean;
|
|
604
|
+
isEndConsultEnabled: boolean;
|
|
605
|
+
webRtcEnabled: boolean;
|
|
606
|
+
autoWrapup: boolean;
|
|
607
|
+
aiFeature?: AIFeatureFlags;
|
|
608
|
+
/** Agent-profile policy used to derive task consult/transfer destination controls. */
|
|
609
|
+
consultTransfer?: Contact.ConsultTransferDestinationConfig;
|
|
610
|
+
/**
|
|
611
|
+
* Optional toggle to globally enable/disable recording controls.
|
|
612
|
+
* Falls back to backend hints when omitted.
|
|
613
|
+
*/
|
|
614
|
+
isRecordingEnabled?: boolean;
|
|
615
|
+
/** Whether wxApp thick-client answer controls/APIs are enabled (WXCC-6026) */
|
|
616
|
+
enableWxBetterTogether?: boolean;
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
|
|
571
621
|
* Generic error structure for Contact Center SDK errors.
|
|
572
622
|
* Contains detailed information about the error context.
|
|
573
623
|
* @public
|
|
@@ -653,10 +703,12 @@ export interface AddressBookEntrySearchParams extends BaseSearchParams {
|
|
|
653
703
|
export interface EntryPointRecord {
|
|
654
704
|
id: string;
|
|
655
705
|
name: string;
|
|
706
|
+
/** Dialled number mapped to this entry point when included in the list response. */
|
|
707
|
+
number?: string;
|
|
656
708
|
description?: string;
|
|
657
|
-
type
|
|
658
|
-
isActive
|
|
659
|
-
orgId
|
|
709
|
+
type?: string;
|
|
710
|
+
isActive?: boolean;
|
|
711
|
+
orgId?: string;
|
|
660
712
|
createdAt?: string;
|
|
661
713
|
updatedAt?: string;
|
|
662
714
|
settings?: Record<string, any>;
|
|
@@ -821,38 +873,174 @@ export type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;
|
|
|
821
873
|
*/
|
|
822
874
|
export type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;
|
|
823
875
|
|
|
876
|
+
/**
|
|
877
|
+
* Supported transcript control actions for AI Assistant events.
|
|
878
|
+
* @public
|
|
879
|
+
* @example
|
|
880
|
+
* const action: TranscriptAction = 'START';
|
|
881
|
+
* @ignore
|
|
882
|
+
*/
|
|
824
883
|
export type TranscriptAction = 'START' | 'STOP';
|
|
825
884
|
|
|
885
|
+
/**
|
|
886
|
+
* Parameters used to request AI Assistant real-time assistance.
|
|
887
|
+
* @public
|
|
888
|
+
* @example
|
|
889
|
+
* const params: RealTimeAssistanceParams = {
|
|
890
|
+
* interactionId: 'interaction-123',
|
|
891
|
+
* context: 'Need help with credit card payment due date',
|
|
892
|
+
* };
|
|
893
|
+
*/
|
|
894
|
+
export type RealTimeAssistanceParams = {
|
|
895
|
+
/** Agent identifier */
|
|
896
|
+
agentId: string;
|
|
897
|
+
/** Interaction identifier for which assistance should be generated */
|
|
898
|
+
interactionId: string;
|
|
899
|
+
/** Optional additional context that should refine the assistance */
|
|
900
|
+
context?: string;
|
|
901
|
+
/** Optional language code for assistance (for example, 'en'). Defaults to 'en'. */
|
|
902
|
+
languageCode?: string;
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Supported user actions on an AI Assistant real-time assistance adaptive card.
|
|
907
|
+
* @public
|
|
908
|
+
*/
|
|
909
|
+
export const RealTimeAssistanceUserActionId = {
|
|
910
|
+
/** User liked the real-time assistance response */
|
|
911
|
+
LIKE: 'likeButton',
|
|
912
|
+
/** User disliked the real-time assistance response */
|
|
913
|
+
DISLIKE: 'dislikeButton',
|
|
914
|
+
/** User copied the real-time assistance response */
|
|
915
|
+
COPY: 'copyButton',
|
|
916
|
+
} as const;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Union type of supported real-time assistance user actions.
|
|
920
|
+
* @public
|
|
921
|
+
*/
|
|
922
|
+
export type RealTimeAssistanceUserActionId = Enum<typeof RealTimeAssistanceUserActionId>;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Parameters used to send user action feedback for a real-time assistance adaptive card.
|
|
926
|
+
* @public
|
|
927
|
+
* @example
|
|
928
|
+
* const params: RealTimeAssistanceUserActionParams = {
|
|
929
|
+
* agentId: 'agent-123',
|
|
930
|
+
* interactionId: 'interaction-123',
|
|
931
|
+
* adaptiveCardId: 'adaptive-card-123',
|
|
932
|
+
* actionId: RealTimeAssistanceUserActionId.LIKE,
|
|
933
|
+
* };
|
|
934
|
+
*/
|
|
935
|
+
export type RealTimeAssistanceUserActionParams = {
|
|
936
|
+
/** Agent identifier */
|
|
937
|
+
agentId: string;
|
|
938
|
+
/** Interaction identifier associated with the real-time assistance response */
|
|
939
|
+
interactionId: string;
|
|
940
|
+
/** Adaptive card identifier from the real-time assistance payload */
|
|
941
|
+
adaptiveCardId: string;
|
|
942
|
+
/** User action performed on the adaptive card */
|
|
943
|
+
actionId: RealTimeAssistanceUserActionId;
|
|
944
|
+
/** Optional language code. Defaults to 'en'. */
|
|
945
|
+
languageCode?: string;
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Supported AI Assistant event categories.
|
|
950
|
+
* @public
|
|
951
|
+
* @example
|
|
952
|
+
* const eventType: AIAssistantEventType = AIAssistantEventType.CUSTOM_EVENT;
|
|
953
|
+
* @ignore
|
|
954
|
+
*/
|
|
826
955
|
export const AIAssistantEventType = {
|
|
956
|
+
/** Custom AI Assistant event */
|
|
827
957
|
CUSTOM_EVENT: 'CUSTOM_EVENT',
|
|
958
|
+
/** CTI-backed AI Assistant event */
|
|
828
959
|
CTI_EVENT: 'CTI_EVENT',
|
|
829
960
|
} as const;
|
|
830
961
|
|
|
962
|
+
/**
|
|
963
|
+
* Union type of AI Assistant event categories.
|
|
964
|
+
* @public
|
|
965
|
+
* @example
|
|
966
|
+
* function send(type: AIAssistantEventType) { ... }
|
|
967
|
+
* @ignore
|
|
968
|
+
*/
|
|
831
969
|
export type AIAssistantEventType = Enum<typeof AIAssistantEventType>;
|
|
832
970
|
|
|
971
|
+
/**
|
|
972
|
+
* Supported AI Assistant event names.
|
|
973
|
+
* @public
|
|
974
|
+
* @example
|
|
975
|
+
* const name: AIAssistantEventName = AIAssistantEventName.GET_TRANSCRIPTS;
|
|
976
|
+
* @ignore
|
|
977
|
+
*/
|
|
833
978
|
export const AIAssistantEventName = {
|
|
979
|
+
/** Request transcript streaming for an interaction */
|
|
834
980
|
GET_TRANSCRIPTS: 'GET_TRANSCRIPTS',
|
|
981
|
+
/** Request a suggested response for an interaction */
|
|
982
|
+
GET_SUGGESTIONS: 'GET_SUGGESTIONS',
|
|
983
|
+
/** Add extra context to refine a suggested response */
|
|
984
|
+
ADD_SUGGESTIONS_EXTRA_CONTEXT: 'ADD_SUGGESTIONS_EXTRA_CONTEXT',
|
|
985
|
+
/** Request mid-call summary generation */
|
|
835
986
|
GET_MID_CALL_SUMMARY: 'GET_MID_CALL_SUMMARY',
|
|
987
|
+
/** Request post-call summary generation */
|
|
836
988
|
GET_POST_CALL_SUMMARY: 'GET_POST_CALL_SUMMARY',
|
|
989
|
+
/** Mid-call summary response event */
|
|
837
990
|
MID_CALL_SUMMARY_RESPONSE: 'MID_CALL_SUMMARY_RESPONSE',
|
|
991
|
+
/** Post-call summary response event */
|
|
838
992
|
POST_CALL_SUMMARY_RESPONSE: 'POST_CALL_SUMMARY_RESPONSE',
|
|
993
|
+
/** Suggested digital response event */
|
|
839
994
|
SUGGESTED_RESPONSES_DIGITAL: 'SUGGESTED_RESPONSES_DIGITAL',
|
|
995
|
+
/** User action on a suggested response adaptive card */
|
|
996
|
+
SUGGESTED_RESPONSES_USER_ACTION: 'SUGGESTED_RESPONSES_USER_ACTION',
|
|
840
997
|
} as const;
|
|
841
998
|
|
|
999
|
+
/**
|
|
1000
|
+
* Union type of AI Assistant event names.
|
|
1001
|
+
* @public
|
|
1002
|
+
* @example
|
|
1003
|
+
* function handle(name: AIAssistantEventName) { ... }
|
|
1004
|
+
* @ignore
|
|
1005
|
+
*/
|
|
842
1006
|
export type AIAssistantEventName = Enum<typeof AIAssistantEventName>;
|
|
843
1007
|
|
|
1008
|
+
/**
|
|
1009
|
+
* A single transcript message entry returned by AI Assistant APIs.
|
|
1010
|
+
* @public
|
|
1011
|
+
* @example
|
|
1012
|
+
* const message: TranscriptMessage = { role: 'AGENT', content: 'Hello', messageId: '1', publishTimestamp: Date.now() };
|
|
1013
|
+
*
|
|
1014
|
+
*/
|
|
844
1015
|
export type TranscriptMessage = {
|
|
1016
|
+
/** Speaker role for this message */
|
|
845
1017
|
role: string;
|
|
1018
|
+
/** Transcript chunk content */
|
|
846
1019
|
content: string;
|
|
1020
|
+
/** Unique message identifier */
|
|
847
1021
|
messageId: string;
|
|
1022
|
+
/** Message publish timestamp (epoch milliseconds) */
|
|
848
1023
|
publishTimestamp: number;
|
|
849
1024
|
};
|
|
850
1025
|
|
|
1026
|
+
/**
|
|
1027
|
+
* Response payload for historic transcripts API.
|
|
1028
|
+
* @public
|
|
1029
|
+
* @example
|
|
1030
|
+
* const resp: HistoricTranscriptsResponse = { orgId: 'org', agentId: 'agent', conversationId: null, interactionId: 'int', source: 'AI', data: [] };
|
|
1031
|
+
*
|
|
1032
|
+
*/
|
|
851
1033
|
export type HistoricTranscriptsResponse = {
|
|
1034
|
+
/** Organization identifier */
|
|
852
1035
|
orgId: string;
|
|
1036
|
+
/** Agent identifier */
|
|
853
1037
|
agentId: string;
|
|
1038
|
+
/** Conversation identifier when available */
|
|
854
1039
|
conversationId: string | null;
|
|
1040
|
+
/** Interaction identifier */
|
|
855
1041
|
interactionId: string;
|
|
1042
|
+
/** Data source identifier */
|
|
856
1043
|
source: string;
|
|
1044
|
+
/** Transcript messages */
|
|
857
1045
|
data: TranscriptMessage[];
|
|
858
1046
|
};
|