@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
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# Contact Center — SPEC
|
|
2
|
+
|
|
3
|
+
> Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md). This is the module's canonical specification.
|
|
4
|
+
|
|
5
|
+
## Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Module id | `contact-center` |
|
|
10
|
+
| Source path(s) | `src` |
|
|
11
|
+
| Doc kind | Module spec |
|
|
12
|
+
| Coverage score | Partial (manifest-authoritative); 15/15 required document fields present |
|
|
13
|
+
| Generated from | `module-spec` @ SDLC template library `0.2.1` |
|
|
14
|
+
| generated_by / approved_by / updated_at | Codex generator / developer-approved Agent Wellness Break remediation / 2026-09-07 |
|
|
15
|
+
| Validation status | Agent Wellness Break v0.4 remediation independently validated by claude-code on 2026-09-07; coverage remains Partial until the remaining baseline promotion criteria are satisfied |
|
|
16
|
+
|
|
17
|
+
## Evidence Rules
|
|
18
|
+
Every requirement cites stable source and test file paths. Code/tests are the behavioral referee; routed source text supplies explicit intent and rationale. Missing or contradictory evidence blocks promotion.
|
|
19
|
+
|
|
20
|
+
## Source Material Register
|
|
21
|
+
| Source material | Scope | Decision | Detail location or disposition |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| Reviewed prior module guides and architecture material | overview / architecture / API / tests | used and code-checked | Content is placed by meaning throughout this specification; exact routing remains in the manifest. |
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
Contact Center is one of nine confirmed Contact Center SDK modules. Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing. Existing reviewed documentation is migrated by meaning and code/tests remain the behavioral referee.
|
|
27
|
+
|
|
28
|
+
The `@webex/contact-center` package is a Webex SDK plugin that provides a TypeScript/JavaScript API for building Contact Center agent applications. It enables:
|
|
29
|
+
|
|
30
|
+
- **Agent Session Management**: Register, login, logout, state changes
|
|
31
|
+
|
|
32
|
+
- **Task Handling**: Inbound/outbound calls, chat, transfers, conferences
|
|
33
|
+
|
|
34
|
+
- **Real-time Events**: WebSocket-based notifications for agent and task events
|
|
35
|
+
|
|
36
|
+
- **Browser-based Calling**: WebRTC integration for browser softphone
|
|
37
|
+
|
|
38
|
+
- **Metrics & Diagnostics**: Built-in telemetry and log upload
|
|
39
|
+
|
|
40
|
+
- **Answer on Webex**: Accept, Decline, Mute, and DTMF for voice offers when the agent uses Webex App desktop calling (`enableWxBetterTogether`).
|
|
41
|
+
|
|
42
|
+
- **Agent Wellness Break**: Effective enablement, agent/org-scoped notifications, active-session action reporting, system idle-code lookup, and legacy state transitions.
|
|
43
|
+
|
|
44
|
+
## Purpose / Responsibility
|
|
45
|
+
Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing.
|
|
46
|
+
|
|
47
|
+
## Stack
|
|
48
|
+
TypeScript 5.4, WebexPlugin, Node EventEmitter, WebSocket/WebRTC integrations, Jest 27, Yarn 3.4.1.
|
|
49
|
+
|
|
50
|
+
## Folder / Package Structure
|
|
51
|
+
```text
|
|
52
|
+
src/
|
|
53
|
+
├── index.ts package exports and plugin registration
|
|
54
|
+
├── cc.ts ContactCenter façade and lifecycle orchestration
|
|
55
|
+
├── types.ts package-level public contracts
|
|
56
|
+
├── metrics/ telemetry manager and taxonomy
|
|
57
|
+
├── services/ transport, agent, config, data, and calling collaborators
|
|
58
|
+
│ ├── UserPreference.ts user-preference CRUD REST client
|
|
59
|
+
│ └── task/ task objects, manager, media implementations, state machine
|
|
60
|
+
└── utils/PageCache.ts shared pagination cache
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Key Files (source of truth)
|
|
64
|
+
| File | Holds |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `src/index.ts` | Authoritative Contact Center implementation or contract source. |
|
|
67
|
+
| `src/cc.ts` | Authoritative Contact Center implementation or contract source. |
|
|
68
|
+
| `src/types.ts` | Authoritative Contact Center implementation or contract source. |
|
|
69
|
+
| `src/constants.ts` | Authoritative Contact Center implementation or contract source. |
|
|
70
|
+
| `src/config.ts` | Authoritative Contact Center implementation or contract source. |
|
|
71
|
+
| `src/services/UserPreference.ts` | User-preference CRUD implementation exposed through `cc.userPreference`. |
|
|
72
|
+
| `src/services/task/dialer.ts` | Preview-campaign AQM request implementations. |
|
|
73
|
+
| `src/services/task/types.ts` | `PreviewContactPayload`, `DropConferenceParticipantPayload`, `TaskResponse`, and task contract types. |
|
|
74
|
+
|
|
75
|
+
## Public Surface
|
|
76
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
77
|
+
|---|---|---|---|---|---|---|
|
|
78
|
+
| `contact-center.surface` | SDK / event / internal API | Published `@webex/contact-center` exports and the `ContactCenter` (`cc`) WebexPlugin API. | Stable module consumption boundary. | Additive changes by default; breaking package exports require a major-version transition. | `src/index.ts` | `CONTRACTS.md` |
|
|
79
|
+
| `contact-center.consult-transfer-lists` | SDK data API | Existing `getQueues` and `getEntryPoints` methods, their existing search/response types, and full `ContactServiceQueue` / `EntryPointRecord` rows. | Provide consult/transfer telephony defaults without adding a parallel list API or projected destination model. | Behavioral default correction; explicit existing filter/sort/profile inputs remain overrides and full record types remain the response contract. | `src/cc.ts`, `src/services/Queue.ts`, `src/services/EntryPoint.ts`, `src/types.ts` | `CONTRACTS.md` |
|
|
80
|
+
| `contact-center.consult-transfer-controls` | SDK task control API | Ordered `TaskUIControls.consultTransferDestinations` arrays using the existing destination values. | Give all Task consumers the same ordered, action-specific destination visibility without a second policy call. | Additive public field; consumers may hide SDK-allowed categories but must not enable omitted categories. | `src/cc.ts`, `src/services/task/types.ts`, `src/services/task/state-machine/uiControlsComputer.ts`, `src/index.ts` | `CONTRACTS.md` |
|
|
81
|
+
| `contact-center.user-preference` | SDK data API | Exported `UserPreference`, `cc.userPreference`, and user-preference request/response types. | Read and mutate user preferences through authenticated REST operations. | Additive public API; removals or signature changes are breaking. | `src/services/UserPreference.ts`, `src/services/config/types.ts` | `CONTRACTS.md` |
|
|
82
|
+
| `contact-center.preview-campaign` | SDK task API | `acceptPreviewContact`, `skipPreviewContact`, `removePreviewContact`. | Resolve campaign preview reservations through typed AQM operations. | Additive public API; removals or signature changes are breaking. | `src/cc.ts`, `src/services/task/dialer.ts`, `src/services/task/types.ts` | `CONTRACTS.md` |
|
|
83
|
+
| `contact-center.conference-participant-drop` | SDK task API | Exported `DropConferenceParticipantPayload` and `ITask.dropConferenceParticipant`. | Remove a conference participant through the media-specific task implementation and correlated AQM completion. | Additive public API; removals or signature changes are breaking. | `src/index.ts`, `src/services/task/types.ts`, `src/services/task/voice/Voice.ts` | `CONTRACTS.md` |
|
|
84
|
+
| `contact-center.agent-wellness-break` | SDK API / events | `Profile.isWellnessBreakEnabled`, `requestWellnessBreak`, `respondToWellnessBreak`, `getWellbeingBreakIdleCode`, and the wellness notification event contract. | Let hosts implement the public wellness-break lifecycle without reproducing backend payloads, routing rules, or session validation. | Additive public API; the effective gate is false unless all supported configuration inputs are affirmative. | `src/cc.ts`, `src/types.ts`, `src/services/config/types.ts` | `CONTRACTS.md` |
|
|
85
|
+
|
|
86
|
+
Compatibility notes:
|
|
87
|
+
- Do not remove or reinterpret exported symbols/events without a documented consumer migration.
|
|
88
|
+
|
|
89
|
+
## Requires (dependencies)
|
|
90
|
+
- Webex SDK host/plugin lifecycle
|
|
91
|
+
- Contact Center REST and WebSocket backends
|
|
92
|
+
- Services, TaskManager, MetricsManager, WebCallingService, UserPreference, and data-service modules
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
| ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
|
|
96
|
+
|---|---|---|---|---|---|---|
|
|
97
|
+
| CONTACT_CENTER-R-001 | Construct the service graph once after the host Webex SDK emits READY, before `register()` is invoked. | Collaborators require initialized host request, logger, and plugin configuration state. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
98
|
+
| CONTACT_CENTER-R-002 | `register()` must attach connection/message listeners, connect the primary WebSocket, and return the fetched Profile or rethrow a logged failure. | Applications need an explicit readiness boundary and must never observe a synthetic successful registration. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
99
|
+
| CONTACT_CENTER-R-003 | Delegate agent, task, data, user-preference, preview-campaign, AI-assistant, calling, and telemetry behavior to their owning collaborators while preserving typed package methods and events. Existing `getQueues` and `getEntryPoints` delegate to their services with unchanged signatures and full-record responses; the services own consult/transfer telephony filter, profile-view, ordering, and cache defaults while honoring explicit existing-parameter overrides. Before preview delegation, reject disabled skip/remove actions from task campaign flags. | A thin stable façade avoids parallel consumer APIs while service-owned defaults keep ordinary widget calls consistent and preserve an override path for other consumers. | `src/cc.ts`, `src/types.ts`, `src/services/Queue.ts`, `src/services/EntryPoint.ts`, `src/services/UserPreference.ts`, `src/services/task/dialer.ts` | `test/unit/spec/cc.ts`, `test/unit/spec/services/Queue.ts`, `test/unit/spec/services/EntryPoint.ts`, `test/unit/spec/services/UserPreference.ts`, `test/unit/spec/services/task/dialer.ts` | Public preview delegation is covered; the `campaignPreviewSkipDisabled` and `campaignPreviewRemoveDisabled` early-exit guards lack direct unit coverage. Independent review identified this gap on 2026-07-15. | PRESENT |
|
|
100
|
+
| CONTACT_CENTER-R-004 | `deregister()` must remove registered listeners, stop applicable host/calling resources, close primary and RTD WebSockets, clear agent configuration, and surface cleanup failures. | Listener or connection leaks create duplicate events and stale authenticated sessions in long-lived hosts. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
101
|
+
| CONTACT_CENTER-R-005 | On `connectionLost`, ContactCenter must own recovery policy and invoke private `silentRelogin()` only when automated relogin is allowed. | ConnectionService reports transport state; only ContactCenter has agent profile and policy context for authentication recovery. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
102
|
+
| CONTACT_CENTER-R-006 | Expose Agent Wellness Break methods, action-value objects, and types only through the package façade. Derive the public action unions from those `as const` value objects. Action calls accept no identity or context-mutating API; ApiAIAssistant reads effective enablement and organization/agent/session identity from a read-only provider supplied by ContactCenter at construction and rejects when that context is incomplete. Logout, deregistration entry, a current-session multi-login close, and relogin update the provider's source state. The exact system idle-code cache and its in-flight lookup are owned by one registration generation; a newer registration or deregistration rejects a late result instead of caching it. | Wellness actions and cached configuration are registration-scoped and must not leak across agents, relogins, multi-login closures, organizations, or registrations; one public value/type source prevents wire-value drift. | `src/cc.ts`, `src/types.ts`, `src/services/ApiAiAssistant.ts`, `src/index.ts` | `test/unit/spec/cc.ts`, `test/unit/spec/services/ApiAiAssistant.ts`, `docs/samples/contact-center/` | The backend-delivered `agentWellbeing.enable` value is treated as the server rollout decision because no distinct rollout field exists in the supported SDK response contracts. | PRESENT |
|
|
103
|
+
| CONTACT_CENTER-R-007 | When wellness is effectively enabled, connect the RTD WebSocket even if transcripts and suggested responses are disabled. Route valid `Wellness_Break_Handler` messages from the primary or RTD data-notification socket to `CC_AGENT_EVENTS.WELLNESS_BREAK`. Notification eligibility is scoped to the current agent and organization and deliberately does not compare the notification-provided `agentSessionId` with the active session; outbound wellness APIs remain active-session validated. Ignore malformed or foreign-identity messages without logging the full payload. | A long-lived host needs parity with Desktop notification routing without dropping legitimate nudges whose backend session metadata differs, while actions must still be sent only for the active local session. | `src/cc.ts`, `src/constants.ts`, `src/services/config/types.ts`, `src/services/ApiAiAssistant.ts` | `test/unit/spec/cc.ts`, `test/unit/spec/services/ApiAiAssistant.ts`, `docs/samples/contact-center/` | Notification delivery remains best-effort; the backend owns offer generation and ordering. | PRESENT |
|
|
104
|
+
| CONTACT_CENTER-R-008 | The standalone SDK sample must keep `WellbeingBreak` out of the ordinary idle-code selector, wait for legacy state confirmation and all tasks to become safe, restore `Available` after a completed break with bounded recovery, synchronize authoritative external state changes, use a session-scoped refresh marker without replaying an offer, action, or break, and revoke manual-request eligibility on `WELLNESS_BREAK_NOT_ALLOWED`. A rejected `REJECTED` or `NO_RESPONSE` delivery must retain and re-arm the offer for retry. Logout cleanup must ignore a different agent session, and deregistration cleanup must run when the SDK has completed its local teardown even if a deferred cleanup error is reported. Pure transition helpers own these decisions and are covered behaviorally; browser/source checks are limited to bundle and copy surfaces. | The sample is the executable public-contract reference and must track backend eligibility, avoid duplicated wire literals, and avoid state stranding or cross-session cleanup. | `docs/samples/contact-center/app.js`, `docs/samples/contact-center/wellness-utils.js`, `docs/samples/contact-center/index.html`, `src/webex.js` | `test/unit/spec/wellnessSampleUtils.ts`, sample build | Live QA still supplies authoritative backend/session integration evidence. | PRESENT |
|
|
105
|
+
|
|
106
|
+
## Design Overview
|
|
107
|
+
`ContactCenter` is the package façade and lifecycle owner. Its constructor waits for the host Webex SDK `READY` event, validates plugin configuration, initializes `WebexRequest`, obtains the singleton `Services` graph, and constructs calling, AI-assistant, metrics, task-management, `UserPreference`, and data-service collaborators. `register()` is deliberately narrower: it attaches runtime listeners and establishes the primary Contact Center WebSocket subscription.
|
|
108
|
+
|
|
109
|
+
Direct data/configuration and user-preference operations return authenticated REST responses. Enabled agent/task AQM operations, including preview-campaign accept/skip/remove, send authenticated HTTP requests but resolve or reject only after a matching WebSocket notification. Before delegating preview skip/remove, ContactCenter checks the task's campaign-disable flags and throws locally when the corresponding flag is `'true'`. TaskManager converts backend task events into Task instances and typed state-machine events. ContactCenter maps package-facing events through WebexPlugin `trigger` or its internal EventEmitter according to the published contract.
|
|
110
|
+
|
|
111
|
+
Inbound primary-WebSocket messages are mapped through `handleWebsocketMessage`, which emits only event names on the typed `CC_EVENTS`/`AGENT_EVENTS` allow-list. A server-controlled `eventData.data.type` that is not a known allow-listed constant is ignored and never emitted as an application event name. Untrusted remote strings that cross into diagnostic logs or metrics — the server-controlled websocket event type and the free-text `logoutReason` / `lastStateChangeReason` carried into `stationLogout` and `setAgentState` tracking — are passed through `sanitizeForObservability` before being written, so legitimate values are preserved while log/metrics injection is prevented.
|
|
112
|
+
|
|
113
|
+
Durable agent, task, and configuration records remain remote-system owned. The package owns only in-memory profile/task/listener/cache/connection state.
|
|
114
|
+
|
|
115
|
+
### Agent Wellness Break
|
|
116
|
+
|
|
117
|
+
The public enablement signal is `Profile.isWellnessBreakEnabled`. It is true only when the backend-delivered AI feature row has `agentWellbeing.enable === true`, `wellnessBreakReminders === 'ENABLED'`, and the organization reports `aiAssistantQuantity > 0`. The SDK does not create a Desktop Split client or invent a rollout response field: the backend controls rollout by deciding whether the delivered AI feature configuration enables wellness for the organization.
|
|
118
|
+
|
|
119
|
+
After station login or relogin, ContactCenter retains the current agent-session id. When registration silently restores an already logged-in station, the returned `Profile.agentSessionId` projects that active session. It is absent when registration has no active session. This lets hosts recover session-scoped state after refresh without reading SDK internals or trusting a notification's session id. ApiAIAssistant reads the current effective gate and organization/agent/session identity through a read-only provider supplied by ContactCenter at construction; it exposes no context-mutating method or separate factory. Logout, deregistration entry, and a current-session multi-login close invalidate the provider's source state. `requestWellnessBreak()` and `respondToWellnessBreak()` do not accept identity fields; they POST a direct custom event with a fresh numeric timestamp and reject disabled or incomplete context before transport. Public action types are derived from exported `as const` action-value objects so applications and samples can use the same wire values without an enum. `getWellbeingBreakIdleCode()` resolves the exact active system code named `WellbeingBreak` and caches it for the registration lifetime. The lookup captures its registration generation and organization before transport; if either ownership value changes before the response arrives, the stale result is rejected and never repopulates the cache.
|
|
120
|
+
|
|
121
|
+
Wellness payloads are handled by ContactCenter on the primary or RTD data-notification socket before ordinary routing. Only known actions with matching agent and organization are emitted; the notification session is retained as diagnostic metadata and is not treated as action authority. The canonical optional `actionText` field is normalized to public `actionText`. Deregistration clears the wellness session and system-code cache.
|
|
122
|
+
|
|
123
|
+
The standalone SDK browser sample keeps `WellbeingBreak` out of the ordinary status selector. It reads the exported wellness wire constants from the standalone `Webex` constructor, seeds its current session and legacy state from a logged-in registration profile after silent relogin, and shows only the action name in its latest-event display. It creates a session-scoped recovery marker before changing legacy state, clears manual-request eligibility when a break starts so the request control remains disabled after restoration until another `SUGGEST_WELLNESS_BREAK`, confirms the transition, sends `ACCEPTED` only after state success, and waits for every task to leave incoming, active, consult, conference, campaign, and wrap-up work before starting its 60-second demonstration timer. Restoration targets `Available / 0`, retries bounded failures, and retains reconnect recovery ownership after exhaustion. Authoritative external Available changes end the local lifecycle, while refresh recovery restores a matching current session without replaying the offer, response action, or break. Pure helpers own notification, response, logout, and deregistration transition decisions; a failed rejection/no-response delivery retains and re-arms its offer. If SDK deregistration completes its local teardown but reports a deferred error, the sample still detaches listeners and resets its local controls.
|
|
124
|
+
|
|
125
|
+
### wxApp Better Together (WXCC-6026)
|
|
126
|
+
|
|
127
|
+
Contract id: `contact-center.wxapp-answer` ([CONTRACTS.md](./CONTRACTS.md)). Task telephony routing, UI controls, and mute events are specified in [task-spec.md](../src/services/task/ai-docs/task-spec.md). Service collaborators: [services-spec.md](../src/services/ai-docs/services-spec.md).
|
|
128
|
+
|
|
129
|
+
- **Init flag:** `webex.init({ cc: { enableWxBetterTogether: boolean } })` — default `false`. When `true`, ContactCenter enables wxApp telephony routing on tasks after supported station login. **Compatible with `allowMultiLogin: true`** (multiple SDK sessions may receive offers; wxApp telephony is routed per active task instance). **Phase 1 is init-only** — to change the flag after SDK init, re-init with updated config.
|
|
130
|
+
- **Read API:** `cc.isWxBetterTogetherEnabled()` returns the current init flag value.
|
|
131
|
+
- **Phase 2 (internal/private):** `setManageWebexCallingInWxcc(enabled)` remains as a private implementation for future runtime toggle; hosts must not call it in Phase 1.
|
|
132
|
+
- **Post-login hooks:** `ensureWxAppPostStationLogin()` runs after successful `stationLogin()` and after `silentRelogin()` on socket reconnect. When the init flag is ON, it publishes usersub `true`, connects Mercury/device for mute sync, and backfills mute state on active tasks. Failures roll back wxApp config and release partial Mercury/device resources without failing station login. When OFF, it force-publishes usersub `false` (clears stale suppression after page refresh) and tears down wxApp Mercury resources.
|
|
133
|
+
- **Teardown:** `deregister()`, station logout, and wxApp teardown paths call `teardownWxAppLocalState()` — publish usersub `false`, unsubscribe Mercury, release CC-owned device/Mercury connections, and reset **session runtime** state (usersub active flag, Mercury subscriptions, task-manager wxApp routing) so stale session flags do not apply on relogin. The host init flag (`enableWxBetterTogether`) is **not** cleared on station logout — it persists until `deregister()` or re-init per Phase 1 contract. Local cleanup runs even when usersub publish fails.
|
|
134
|
+
- **Host telephony surface:** Hosts call unified `task.accept()`, `task.decline()`, `task.toggleMute({ muted? })`, and `task.transmitDtmf({ dtmf })`; SDK `Voice` routes wxApp legs internally when the flag is active. Shared-line `lineOwnerId` defaults from the wxApp agent participant when omitted.
|
|
135
|
+
|
|
136
|
+
Evidence: `src/cc.ts`, `src/config.ts`, `src/services/WebexCrossClientService.ts`, `src/services/WxAppTelephonyMercurySync.ts`, `test/unit/spec/cc.ts`.
|
|
137
|
+
|
|
138
|
+
## Data Flow
|
|
139
|
+
```mermaid
|
|
140
|
+
flowchart TD
|
|
141
|
+
Host[Host Webex SDK READY] --> Validate[Validate plugin config]
|
|
142
|
+
Validate --> WR[Initialize WebexRequest]
|
|
143
|
+
WR --> Services[Services singleton: agent/config/contact/dialer + primary/RTD WebSockets]
|
|
144
|
+
Services --> Collaborators[Create WebCalling, ApiAIAssistant, Metrics, TaskManager, UserPreference, data services]
|
|
145
|
+
Collaborators --> Register[Application calls register]
|
|
146
|
+
Register --> Listeners[Attach connection and message listeners]
|
|
147
|
+
Listeners --> Connect[Subscribe/connect primary WebSocket]
|
|
148
|
+
Connect --> Profile[Fetch/return Profile]
|
|
149
|
+
Profile --> App[Application invokes typed cc methods]
|
|
150
|
+
App --> Direct[Direct REST data/config]
|
|
151
|
+
App --> AQM[AQM HTTP initiation]
|
|
152
|
+
AQM --> WS[Correlated WebSocket completion]
|
|
153
|
+
Direct --> App
|
|
154
|
+
WS --> App
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Sequence Diagram(s)
|
|
158
|
+
Sequence coverage:
|
|
159
|
+
|
|
160
|
+
| Operation group | Diagram | Failure / recovery coverage |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| READY-time bootstrap | Bootstrap | Invalid configuration or collaborator initialization rejects readiness-dependent use. |
|
|
163
|
+
| Registration | Register | Connection/subscription failure is logged, metrics record failure, logs upload, and the error is rethrown. |
|
|
164
|
+
| Deregistration | Deregister | Cleanup failure is measured, logged, and rethrown; no synthetic success. |
|
|
165
|
+
| Connection recovery | Recovery | ConnectionService emits state; ContactCenter chooses silent relogin or preserves failure state. |
|
|
166
|
+
|
|
167
|
+
### Bootstrap
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
sequenceDiagram
|
|
171
|
+
participant Host as Host Webex SDK
|
|
172
|
+
participant CC as ContactCenter
|
|
173
|
+
participant S as Services
|
|
174
|
+
participant TM as TaskManager
|
|
175
|
+
Host-->>CC: READY
|
|
176
|
+
CC->>CC: validatePluginConfig()
|
|
177
|
+
alt configuration valid
|
|
178
|
+
CC->>CC: WebexRequest.getInstance(webex)
|
|
179
|
+
CC->>S: Services.getInstance(webex, connectionConfig)
|
|
180
|
+
CC->>CC: create WebCallingService + ApiAIAssistant + MetricsManager
|
|
181
|
+
CC->>TM: getTaskManager(aiAssistant, contact, calling, primaryWS, rtdWS)
|
|
182
|
+
CC->>CC: create EntryPoint + AddressBook + Queue; initialize LoggerProxy
|
|
183
|
+
else invalid configuration or initialization failure
|
|
184
|
+
CC-->>Host: readiness-dependent use rejects
|
|
185
|
+
end
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Register
|
|
189
|
+
|
|
190
|
+
```mermaid
|
|
191
|
+
sequenceDiagram
|
|
192
|
+
participant App
|
|
193
|
+
participant CC as ContactCenter
|
|
194
|
+
participant WS as Primary WebSocketManager
|
|
195
|
+
participant Cfg as AgentConfigService
|
|
196
|
+
participant Agent as Services.agent
|
|
197
|
+
participant Metrics
|
|
198
|
+
App->>CC: register()
|
|
199
|
+
CC->>CC: setupEventListeners(); listen for WS messages
|
|
200
|
+
CC->>Metrics: time register success/failure
|
|
201
|
+
CC->>WS: initWebSocket({body, resource: SUBSCRIBE_API})
|
|
202
|
+
WS-->>CC: Welcome data containing agentId
|
|
203
|
+
CC->>Cfg: getAgentConfig(orgId, agentId)
|
|
204
|
+
alt profile fetched
|
|
205
|
+
Cfg-->>CC: Profile
|
|
206
|
+
CC->>CC: set TaskManager/config/AI flags
|
|
207
|
+
opt applicable AI feature enabled
|
|
208
|
+
CC->>CC: start RTD WebSocket; log but contain RTD failure
|
|
209
|
+
end
|
|
210
|
+
opt browser calling applicable
|
|
211
|
+
CC->>CC: mercury.connect(); log but contain failure
|
|
212
|
+
end
|
|
213
|
+
opt allowAutomatedRelogin
|
|
214
|
+
CC->>Agent: reload()
|
|
215
|
+
Agent-->>CC: relogin result, AGENT_NOT_FOUND, or error
|
|
216
|
+
end
|
|
217
|
+
CC->>Metrics: track registration success
|
|
218
|
+
CC-->>App: Profile
|
|
219
|
+
else primary subscription/profile/relogin failure
|
|
220
|
+
CC->>Metrics: track registration failure
|
|
221
|
+
CC->>CC: uploadLogs(correlationId)
|
|
222
|
+
CC-->>App: throw error
|
|
223
|
+
end
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Deregister
|
|
227
|
+
|
|
228
|
+
```mermaid
|
|
229
|
+
sequenceDiagram
|
|
230
|
+
participant App
|
|
231
|
+
participant CC as ContactCenter
|
|
232
|
+
participant Host as Mercury/device
|
|
233
|
+
participant WS as Primary + RTD WebSockets
|
|
234
|
+
App->>CC: deregister()
|
|
235
|
+
CC->>CC: remove TaskManager/message/connection listeners
|
|
236
|
+
opt browser calling resources active
|
|
237
|
+
CC->>Host: disconnect Mercury; unregister device
|
|
238
|
+
end
|
|
239
|
+
CC->>WS: close(false, reason)
|
|
240
|
+
CC->>CC: agentConfig = null
|
|
241
|
+
alt cleanup succeeds
|
|
242
|
+
CC-->>App: void
|
|
243
|
+
else cleanup fails
|
|
244
|
+
CC-->>App: throw error
|
|
245
|
+
end
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Recovery
|
|
249
|
+
|
|
250
|
+
```mermaid
|
|
251
|
+
sequenceDiagram
|
|
252
|
+
participant CS as ConnectionService
|
|
253
|
+
participant CC as ContactCenter
|
|
254
|
+
participant Agent as Services.agent
|
|
255
|
+
CS-->>CC: connectionLost(details)
|
|
256
|
+
CC->>CC: handleConnectionLost(details)
|
|
257
|
+
alt allowAutomatedRelogin
|
|
258
|
+
CC->>CC: silentRelogin()
|
|
259
|
+
CC->>Agent: reload()
|
|
260
|
+
alt relogin succeeds
|
|
261
|
+
Agent-->>CC: relogin result; update agent config/device state
|
|
262
|
+
else AGENT_NOT_FOUND
|
|
263
|
+
Agent-->>CC: handled silently
|
|
264
|
+
else other failure
|
|
265
|
+
Agent--xCC: throw detailed error
|
|
266
|
+
end
|
|
267
|
+
else disabled
|
|
268
|
+
CC->>CC: make no relogin call; retain reported transport state
|
|
269
|
+
end
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Class / Component Relationships
|
|
273
|
+
```mermaid
|
|
274
|
+
classDiagram
|
|
275
|
+
class ContactCenter
|
|
276
|
+
class Services
|
|
277
|
+
class WebexRequest
|
|
278
|
+
class MetricsManager
|
|
279
|
+
class TaskManager
|
|
280
|
+
class WebCallingService
|
|
281
|
+
class ApiAIAssistant
|
|
282
|
+
class EntryPoint
|
|
283
|
+
class AddressBook
|
|
284
|
+
class Queue
|
|
285
|
+
ContactCenter --> WebexRequest : initializes/uses for log upload
|
|
286
|
+
ContactCenter --> Services : agent/config/contact/dialer + WebSockets
|
|
287
|
+
ContactCenter --> MetricsManager : timings and tracking
|
|
288
|
+
ContactCenter --> TaskManager : task lifecycle/events
|
|
289
|
+
ContactCenter --> WebCallingService : browser calling
|
|
290
|
+
ContactCenter --> ApiAIAssistant : transcript/suggestion API
|
|
291
|
+
ContactCenter --> EntryPoint
|
|
292
|
+
ContactCenter --> AddressBook
|
|
293
|
+
ContactCenter --> Queue
|
|
294
|
+
TaskManager --> ApiAIAssistant
|
|
295
|
+
TaskManager --> WebCallingService
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Use Cases
|
|
299
|
+
- **UC-1 Host bootstrap:** after host READY, initialize the complete collaborator graph exactly once. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
300
|
+
- **UC-2 Register:** attach listeners and establish the primary WebSocket subscription before returning Profile. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
301
|
+
- **UC-3 Delegate SDK operations:** validate/map public inputs, call the owning collaborator, track metrics, and return or emit typed results. Evidence: `src/cc.ts`, `src/index.ts`, `test/unit/spec/cc.ts`.
|
|
302
|
+
- **UC-4 Recover connection:** consume ConnectionService state and conditionally reload the agent session through ContactCenter policy. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
303
|
+
- **UC-5 Deregister:** remove the same listener identities, shut down applicable host/WebSocket resources, and clear in-memory profile state. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
304
|
+
- **UC-6 Wellness lifecycle:** consume an agent/org-scoped offer regardless of its notification session metadata, report a user action using the active local session, resolve the system idle code, and demonstrate legacy Idle/Available transitions. Evidence: `src/cc.ts`, `src/services/ApiAiAssistant.ts`, `src/services/config/index.ts`, `test/unit/spec/cc.ts`, `docs/samples/contact-center/`.
|
|
305
|
+
|
|
306
|
+
## State Model
|
|
307
|
+
ContactCenter retains in-memory `agentConfig`, collaborator references, event listeners, task collections through TaskManager, and connection/recovery state. Remote Webex services remain authoritative for agent, task, and organization data. Registration establishes runtime connectivity but does not imply station login; deregistration tears down SDK resources but does not itself perform station logout.
|
|
308
|
+
|
|
309
|
+
## Business Rules & Invariants
|
|
310
|
+
- Collaborators are initialized after host READY and before their use; `register()` must not be documented as their constructor boundary. Evidence: `src/cc.ts`.
|
|
311
|
+
- AQM promises complete only from correlated WebSocket success/failure or timeout, not from HTTP acknowledgement. Evidence: `src/services/core/aqm-reqs.ts`.
|
|
312
|
+
- `skipPreviewContact` checks `campaignPreviewSkipDisabled` and `removePreviewContact` checks `campaignPreviewRemoveDisabled` on the matching task. When the applicable value is `'true'`, ContactCenter throws before initiating an HTTP or WebSocket-correlated AQM operation; `acceptPreviewContact` has no equivalent pre-guard. Evidence: `src/cc.ts`.
|
|
313
|
+
- `handleWebsocketMessage` only re-emits event names that belong to the typed `CC_EVENTS`/`AGENT_EVENTS` allow-list; an untrusted `eventData.data.type` outside that allow-list is not emitted as an event name. Evidence: `src/cc.ts`.
|
|
314
|
+
- Untrusted remote strings are sanitized through `sanitizeForObservability` before reaching logs or metrics: the server-controlled websocket event type logged and tracked by `handleWebsocketMessage`, and the free-text `logoutReason`/`lastStateChangeReason` tracked by `stationLogout` and `setAgentState`. Sanitization leaves legitimate values effectively unchanged while preventing log/metrics injection. Evidence: `src/cc.ts`.
|
|
315
|
+
- `getBuddyAgents(data: BuddyAgents)` builds its request body with the SDK-owned `agentProfileId` (from `agentConfig.agentProfileID`) plus the resolved `mediaType` and optional `state`; caller-supplied `data` cannot override `agentProfileId`. Evidence: `src/cc.ts`.
|
|
316
|
+
- ContactCenter owns automated relogin policy; ConnectionService owns transport-state detection/emission. Evidence: `src/cc.ts`, `src/services/core/websocket/connection-service.ts`.
|
|
317
|
+
- Deregistration does not station-logout the agent. Evidence: `src/cc.ts`.
|
|
318
|
+
- Published methods/types/events remain semver-sensitive through `src/index.ts`.
|
|
319
|
+
- Wellness actions take no public identity or context-mutating input and require the effective profile flag plus non-empty SDK-owned organization, registered-agent, and current-session context read from the internal live provider; all checks fail closed after current-session logout, multi-login close, or deregistration.
|
|
320
|
+
- Wellness action unions derive from exported `as const` value objects; backend message-type and enablement sentinels use internal constants rather than duplicated literals.
|
|
321
|
+
- Malformed, unknown-action, stale-agent, and stale-org wellness notifications are ignored and measured without logging the full payload. A different notification `agentSessionId` is retained as diagnostic metadata and does not make an otherwise valid current-agent/current-org wellness event stale.
|
|
322
|
+
|
|
323
|
+
## Concurrency & Reactive Flow
|
|
324
|
+
READY initialization, REST promises, AQM WebSocket correlation, TaskManager events, calling events, and connection timers execute asynchronously. Listener cleanup must use the registered function identity. Message listeners are independent: AqmReqs correlates pending requests, ContactCenter maps package events, TaskManager owns task lifecycle, and ConnectionService tracks liveness/reconnect state.
|
|
325
|
+
|
|
326
|
+
## State Machine
|
|
327
|
+
```mermaid
|
|
328
|
+
stateDiagram-v2
|
|
329
|
+
[*] --> AwaitingHostReady
|
|
330
|
+
AwaitingHostReady --> Initialized: host READY + collaborators created
|
|
331
|
+
Initialized --> Registering: register()
|
|
332
|
+
Registering --> Registered: WebSocket/profile success
|
|
333
|
+
Registering --> Initialized: registration failure
|
|
334
|
+
Registered --> Recovering: connectionLost
|
|
335
|
+
Recovering --> Registered: reconnect/relogin succeeds
|
|
336
|
+
Recovering --> Registered: relogin disabled; transport state reported
|
|
337
|
+
Registered --> Deregistering: deregister()
|
|
338
|
+
Deregistering --> Initialized: listeners/resources cleared
|
|
339
|
+
Deregistering --> Registered: cleanup throws before completion
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Protocol / Wire Format
|
|
343
|
+
Authenticated REST initiates direct data/config operations and AQM agent/task operations. For AQM, the HTTP response is acknowledgement only; `notifSuccess.bind`/`notifFail.bind` match WebSocket payloads that settle the promise. Wellness actions are the exception: ApiAIAssistant posts a direct `CUSTOM_EVENT` to `/event` and requires HTTP 202. The primary and RTD WebSockets can carry `Wellness_Break_Handler`; ContactCenter routes it before task-specific traffic. Payload and event names are owned by `src/types.ts`, `src/services/config/types.ts`, `src/services/agent/types.ts`, and `src/services/task/types.ts`.
|
|
344
|
+
|
|
345
|
+
## Error Handling & Failure Modes
|
|
346
|
+
| Condition | Signal (error/code/result) | Caller recovery |
|
|
347
|
+
|---|---|---|
|
|
348
|
+
| Dependency rejection | Typed/rethrown error or failure event | Inspect structured details, preserve tracking id, and retry only when the operation is safe. |
|
|
349
|
+
| Timeout or missing async completion | Timeout/recovery state | Follow the module-specific recovery path; never synthesize success. |
|
|
350
|
+
|
|
351
|
+
## Pitfalls
|
|
352
|
+
- READY-time construction and `register()` are different lifecycle boundaries; moving collaborator creation into `register()` can duplicate listeners and use uninitialized host services.
|
|
353
|
+
- AQM HTTP responses are acknowledgements, not operation completion; only a correlated WebSocket notification or timeout settles the operation.
|
|
354
|
+
- Listener cleanup must use the same bound function identities registered during setup or repeated register/deregister cycles will leak handlers.
|
|
355
|
+
|
|
356
|
+
## Module Do's / Don'ts
|
|
357
|
+
- DO construct the collaborator graph only after host READY and keep registration focused on listeners, subscription, and profile retrieval.
|
|
358
|
+
- DO route agent recovery decisions through ContactCenter because it owns profile/config policy.
|
|
359
|
+
- DON'T synthesize successful register/deregister results after a dependency or cleanup failure.
|
|
360
|
+
- DON'T let transport services call `silentRelogin()` directly.
|
|
361
|
+
|
|
362
|
+
## Export Stability
|
|
363
|
+
The npm export/type-declaration surface is semver-sensitive. Additive optional types are compatible; removals, renames, or semantic changes require a major-version migration and changelog entry.
|
|
364
|
+
|
|
365
|
+
## Host Integration & Theming
|
|
366
|
+
The module registers as `cc` through the Webex SDK plugin system and depends on host-provided Webex credentials, configuration, request routing, and lifecycle events. It renders no UI and defines no theme contract.
|
|
367
|
+
|
|
368
|
+
## Key Design Trade-off
|
|
369
|
+
- A single plugin surface centralizes compatibility and event routing, while specialized modules retain implementation ownership; this costs careful bootstrap and cleanup ordering.
|
|
370
|
+
|
|
371
|
+
## Test-Case Strategy (module)
|
|
372
|
+
`test/unit/spec/cc.ts` is the characterization baseline. Cover READY-time construction, registration success/failure, listener identity, existing queue/entry-point method delegation, WebSocket event mapping, preview-campaign operations (including disabled skip/remove pre-guards), automated-relogin enabled/disabled branches, browser-calling conditions, and deregistration cleanup/error paths. Use Queue and EntryPoint service tests for default policy and explicit existing-parameter overrides, `test/unit/spec/services/UserPreference.ts` for user-preference CRUD, and `test/unit/spec/services/task/dialer.ts` for preview AQM request contracts. Preserve the package-wide 85% branch/function/line/statement threshold.
|
|
373
|
+
|
|
374
|
+
| Requirement | Existing evidence | Required revalidation |
|
|
375
|
+
|---|---|---|
|
|
376
|
+
| CONTACT_CENTER-R-001 | `test/unit/spec/cc.ts` | READY-time ownership and initialization order |
|
|
377
|
+
| CONTACT_CENTER-R-002 | `test/unit/spec/cc.ts` | register success/failure and log-upload path |
|
|
378
|
+
| CONTACT_CENTER-R-003 | `test/unit/spec/cc.ts`, `test/unit/spec/services/UserPreference.ts`, `test/unit/spec/services/task/dialer.ts` | Add direct tests proving disabled skip/remove flags throw before dialer invocation; revalidate typed delegation, user-preference CRUD, preview-campaign AQM operations, and event routing. |
|
|
379
|
+
| CONTACT_CENTER-R-004 | `test/unit/spec/cc.ts` | listener/resource cleanup and error propagation |
|
|
380
|
+
| CONTACT_CENTER-R-005 | `test/unit/spec/cc.ts` | relogin policy ownership |
|
|
381
|
+
| CONTACT_CENTER-R-006 | `test/unit/spec/cc.ts`, `test/unit/spec/services/ApiAiAssistant.ts` | Effective-gate and internal organization/agent/session validation, current-session multi-login invalidation, registration-generation idle-code cache ownership, identity-free public input, exact request body, action validation, and direct-HTTP failure paths. |
|
|
382
|
+
| CONTACT_CENTER-R-007 | `test/unit/spec/cc.ts`, `test/unit/spec/services/ApiAiAssistant.ts` | Wellness normalization on primary and RTD notification sockets, notification-session mismatch acceptance, invalid agent/org filtering, and active-session outbound validation. |
|
|
383
|
+
| CONTACT_CENTER-R-008 | `test/unit/spec/wellnessSampleUtils.ts`, sample build | Safe-work classification, legacy external/RONA decisions, minimal refresh marker, recovery decisions, retryable offer-response transitions, session-scoped logout cleanup, deferred-error deregistration cleanup, and standalone browser constant exposure. |
|
|
384
|
+
|
|
385
|
+
## Traceability
|
|
386
|
+
- Repo architecture: `ARCHITECTURE.md` · Registry: `SPEC_INDEX.md`
|
|
387
|
+
- Coverage state and contracts baseline: `../.sdd/manifest.json`
|
package/dist/cc.js
CHANGED
|
@@ -1097,7 +1097,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1097
1097
|
const resp = await logoutResponse;
|
|
1098
1098
|
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_SUCCESS, {
|
|
1099
1099
|
..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(resp),
|
|
1100
|
-
logoutReason: data.logoutReason
|
|
1100
|
+
logoutReason: (0, _Utils.sanitizeForObservability)(data.logoutReason)
|
|
1101
1101
|
}, ['behavioral', 'business', 'operational']);
|
|
1102
1102
|
if (this.webCallingService) {
|
|
1103
1103
|
await this.webCallingService.deregisterWebCallingLine();
|
|
@@ -1114,7 +1114,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1114
1114
|
const failure = error.details;
|
|
1115
1115
|
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_FAILED, {
|
|
1116
1116
|
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1117
|
-
logoutReason: data.logoutReason
|
|
1117
|
+
logoutReason: (0, _Utils.sanitizeForObservability)(data.logoutReason)
|
|
1118
1118
|
}, ['behavioral', 'business', 'operational']);
|
|
1119
1119
|
const {
|
|
1120
1120
|
error: detailedError
|
|
@@ -1213,7 +1213,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1213
1213
|
status: agentStatusResponse.data?.status,
|
|
1214
1214
|
subStatus: agentStatusResponse.data?.subStatus,
|
|
1215
1215
|
auxCodeId: data.auxCodeId,
|
|
1216
|
-
lastStateChangeReason: data.lastStateChangeReason
|
|
1216
|
+
lastStateChangeReason: (0, _Utils.sanitizeForObservability)(data.lastStateChangeReason)
|
|
1217
1217
|
}, ['behavioral', 'business', 'operational']);
|
|
1218
1218
|
_loggerProxy.default.log(`Agent state changed successfully to auxCodeId: ${agentStatusResponse.data.auxCodeId}`, {
|
|
1219
1219
|
module: _constants.CC_FILE,
|
|
@@ -1227,7 +1227,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1227
1227
|
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1228
1228
|
state: data.state,
|
|
1229
1229
|
auxCodeId: data.auxCodeId,
|
|
1230
|
-
lastStateChangeReason: data.lastStateChangeReason
|
|
1230
|
+
lastStateChangeReason: (0, _Utils.sanitizeForObservability)(data.lastStateChangeReason)
|
|
1231
1231
|
}, ['behavioral', 'business', 'operational']);
|
|
1232
1232
|
const {
|
|
1233
1233
|
error: detailedError
|
|
@@ -1333,7 +1333,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1333
1333
|
if (!eventData.type) {
|
|
1334
1334
|
return;
|
|
1335
1335
|
}
|
|
1336
|
-
_loggerProxy.default.log(`Received event: ${eventData?.data?.type ?? eventData.type}`, {
|
|
1336
|
+
_loggerProxy.default.log(`Received event: ${(0, _Utils.sanitizeForObservability)(eventData?.data?.type ?? eventData.type)}`, {
|
|
1337
1337
|
module: _constants.CC_FILE,
|
|
1338
1338
|
method: _constants.METHODS.HANDLE_WEBSOCKET_MESSAGE
|
|
1339
1339
|
});
|
|
@@ -1343,8 +1343,8 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1343
1343
|
const nestedType = eventData?.data?.type;
|
|
1344
1344
|
if (topLevelType !== _types3.CC_EVENTS.WELCOME && eventData.keepalive !== 'true') {
|
|
1345
1345
|
const metricsPayload = {
|
|
1346
|
-
ws_event_type: nestedType || topLevelType,
|
|
1347
|
-
top_level_type: topLevelType,
|
|
1346
|
+
ws_event_type: (0, _Utils.sanitizeForObservability)(nestedType || topLevelType),
|
|
1347
|
+
top_level_type: (0, _Utils.sanitizeForObservability)(topLevelType),
|
|
1348
1348
|
has_data: Boolean(eventData.data)
|
|
1349
1349
|
};
|
|
1350
1350
|
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.WEBSOCKET_EVENT_RECEIVED, metricsPayload, ['operational']);
|