@webex/contact-center 3.12.0-next.8 → 3.12.0-task-refactor.1

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.
Files changed (200) hide show
  1. package/AGENTS.md +438 -0
  2. package/ai-docs/README.md +131 -0
  3. package/ai-docs/RULES.md +455 -0
  4. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  5. package/ai-docs/patterns/testing-patterns.md +480 -0
  6. package/ai-docs/patterns/typescript-patterns.md +365 -0
  7. package/ai-docs/templates/README.md +102 -0
  8. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  9. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  10. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  11. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  12. package/ai-docs/templates/new-method/00-master.md +80 -0
  13. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  14. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  15. package/ai-docs/templates/new-method/03-tests.md +201 -0
  16. package/ai-docs/templates/new-method/04-validation.md +141 -0
  17. package/ai-docs/templates/new-service/00-master.md +109 -0
  18. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  19. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  20. package/ai-docs/templates/new-service/03-integration.md +178 -0
  21. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  22. package/ai-docs/templates/new-service/05-validation.md +145 -0
  23. package/dist/cc.js +65 -123
  24. package/dist/cc.js.map +1 -1
  25. package/dist/constants.js +13 -2
  26. package/dist/constants.js.map +1 -1
  27. package/dist/index.js +13 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/metrics/behavioral-events.js +26 -13
  30. package/dist/metrics/behavioral-events.js.map +1 -1
  31. package/dist/metrics/constants.js +7 -6
  32. package/dist/metrics/constants.js.map +1 -1
  33. package/dist/services/ApiAiAssistant.js +0 -3
  34. package/dist/services/ApiAiAssistant.js.map +1 -1
  35. package/dist/services/config/Util.js +2 -3
  36. package/dist/services/config/Util.js.map +1 -1
  37. package/dist/services/config/types.js +16 -14
  38. package/dist/services/config/types.js.map +1 -1
  39. package/dist/services/constants.js +0 -1
  40. package/dist/services/constants.js.map +1 -1
  41. package/dist/services/core/Err.js.map +1 -1
  42. package/dist/services/core/Utils.js +79 -55
  43. package/dist/services/core/Utils.js.map +1 -1
  44. package/dist/services/core/aqm-reqs.js +17 -92
  45. package/dist/services/core/aqm-reqs.js.map +1 -1
  46. package/dist/services/core/websocket/WebSocketManager.js +5 -25
  47. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  48. package/dist/services/core/websocket/types.js.map +1 -1
  49. package/dist/services/index.js +1 -2
  50. package/dist/services/index.js.map +1 -1
  51. package/dist/services/task/Task.js +644 -0
  52. package/dist/services/task/Task.js.map +1 -0
  53. package/dist/services/task/TaskFactory.js +45 -0
  54. package/dist/services/task/TaskFactory.js.map +1 -0
  55. package/dist/services/task/TaskManager.js +556 -532
  56. package/dist/services/task/TaskManager.js.map +1 -1
  57. package/dist/services/task/TaskUtils.js +132 -28
  58. package/dist/services/task/TaskUtils.js.map +1 -1
  59. package/dist/services/task/constants.js +7 -6
  60. package/dist/services/task/constants.js.map +1 -1
  61. package/dist/services/task/dialer.js +0 -51
  62. package/dist/services/task/dialer.js.map +1 -1
  63. package/dist/services/task/digital/Digital.js +77 -0
  64. package/dist/services/task/digital/Digital.js.map +1 -0
  65. package/dist/services/task/state-machine/TaskStateMachine.js +634 -0
  66. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  67. package/dist/services/task/state-machine/actions.js +366 -0
  68. package/dist/services/task/state-machine/actions.js.map +1 -0
  69. package/dist/services/task/state-machine/constants.js +139 -0
  70. package/dist/services/task/state-machine/constants.js.map +1 -0
  71. package/dist/services/task/state-machine/guards.js +256 -0
  72. package/dist/services/task/state-machine/guards.js.map +1 -0
  73. package/dist/services/task/state-machine/index.js +53 -0
  74. package/dist/services/task/state-machine/index.js.map +1 -0
  75. package/dist/services/task/state-machine/types.js +54 -0
  76. package/dist/services/task/state-machine/types.js.map +1 -0
  77. package/dist/services/task/state-machine/uiControlsComputer.js +369 -0
  78. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  79. package/dist/services/task/taskDataNormalizer.js +99 -0
  80. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  81. package/dist/services/task/types.js +157 -18
  82. package/dist/services/task/types.js.map +1 -1
  83. package/dist/services/task/voice/Voice.js +1031 -0
  84. package/dist/services/task/voice/Voice.js.map +1 -0
  85. package/dist/services/task/voice/WebRTC.js +149 -0
  86. package/dist/services/task/voice/WebRTC.js.map +1 -0
  87. package/dist/types/cc.d.ts +4 -33
  88. package/dist/types/constants.d.ts +13 -2
  89. package/dist/types/index.d.ts +11 -5
  90. package/dist/types/metrics/constants.d.ts +5 -3
  91. package/dist/types/services/ApiAiAssistant.d.ts +1 -1
  92. package/dist/types/services/config/types.d.ts +97 -25
  93. package/dist/types/services/core/Err.d.ts +0 -2
  94. package/dist/types/services/core/Utils.d.ts +25 -23
  95. package/dist/types/services/core/aqm-reqs.d.ts +0 -49
  96. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -1
  97. package/dist/types/services/core/websocket/connection-service.d.ts +0 -1
  98. package/dist/types/services/core/websocket/types.d.ts +1 -1
  99. package/dist/types/services/index.d.ts +1 -1
  100. package/dist/types/services/task/Task.d.ts +146 -0
  101. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  102. package/dist/types/services/task/TaskUtils.d.ts +39 -8
  103. package/dist/types/services/task/constants.d.ts +5 -4
  104. package/dist/types/services/task/dialer.d.ts +0 -15
  105. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  106. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +906 -0
  107. package/dist/types/services/task/state-machine/actions.d.ts +8 -0
  108. package/dist/types/services/task/state-machine/constants.d.ts +91 -0
  109. package/dist/types/services/task/state-machine/guards.d.ts +78 -0
  110. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  111. package/dist/types/services/task/state-machine/types.d.ts +256 -0
  112. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  113. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  114. package/dist/types/services/task/types.d.ts +539 -88
  115. package/dist/types/services/task/voice/Voice.d.ts +183 -0
  116. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  117. package/dist/types/types.d.ts +68 -0
  118. package/dist/types/webex.d.ts +1 -0
  119. package/dist/types.js +70 -0
  120. package/dist/types.js.map +1 -1
  121. package/dist/webex.js +14 -2
  122. package/dist/webex.js.map +1 -1
  123. package/package.json +14 -11
  124. package/src/cc.ts +91 -177
  125. package/src/constants.ts +13 -2
  126. package/src/index.ts +14 -5
  127. package/src/metrics/ai-docs/AGENTS.md +348 -0
  128. package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
  129. package/src/metrics/behavioral-events.ts +28 -14
  130. package/src/metrics/constants.ts +7 -8
  131. package/src/services/ApiAiAssistant.ts +2 -4
  132. package/src/services/agent/ai-docs/AGENTS.md +238 -0
  133. package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
  134. package/src/services/ai-docs/AGENTS.md +384 -0
  135. package/src/services/config/Util.ts +2 -3
  136. package/src/services/config/ai-docs/AGENTS.md +253 -0
  137. package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
  138. package/src/services/config/types.ts +108 -20
  139. package/src/services/constants.ts +0 -1
  140. package/src/services/core/Err.ts +0 -1
  141. package/src/services/core/Utils.ts +90 -67
  142. package/src/services/core/ai-docs/AGENTS.md +379 -0
  143. package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
  144. package/src/services/core/aqm-reqs.ts +22 -100
  145. package/src/services/core/websocket/WebSocketManager.ts +4 -23
  146. package/src/services/core/websocket/types.ts +1 -1
  147. package/src/services/index.ts +1 -2
  148. package/src/services/task/Task.ts +785 -0
  149. package/src/services/task/TaskFactory.ts +55 -0
  150. package/src/services/task/TaskManager.ts +567 -633
  151. package/src/services/task/TaskUtils.ts +175 -31
  152. package/src/services/task/ai-docs/AGENTS.md +448 -0
  153. package/src/services/task/ai-docs/ARCHITECTURE.md +573 -0
  154. package/src/services/task/constants.ts +5 -4
  155. package/src/services/task/dialer.ts +1 -56
  156. package/src/services/task/digital/Digital.ts +95 -0
  157. package/src/services/task/state-machine/TaskStateMachine.ts +793 -0
  158. package/src/services/task/state-machine/actions.ts +409 -0
  159. package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
  160. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
  161. package/src/services/task/state-machine/constants.ts +150 -0
  162. package/src/services/task/state-machine/guards.ts +295 -0
  163. package/src/services/task/state-machine/index.ts +28 -0
  164. package/src/services/task/state-machine/types.ts +228 -0
  165. package/src/services/task/state-machine/uiControlsComputer.ts +529 -0
  166. package/src/services/task/taskDataNormalizer.ts +137 -0
  167. package/src/services/task/types.ts +641 -95
  168. package/src/services/task/voice/Voice.ts +1255 -0
  169. package/src/services/task/voice/WebRTC.ts +187 -0
  170. package/src/types.ts +88 -5
  171. package/src/utils/AGENTS.md +276 -0
  172. package/src/webex.js +2 -0
  173. package/test/unit/spec/cc.ts +59 -142
  174. package/test/unit/spec/logger-proxy.ts +70 -0
  175. package/test/unit/spec/services/ApiAiAssistant.ts +17 -0
  176. package/test/unit/spec/services/config/index.ts +26 -55
  177. package/test/unit/spec/services/core/Utils.ts +103 -52
  178. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +48 -112
  179. package/test/unit/spec/services/core/websocket/connection-service.ts +5 -4
  180. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  181. package/test/unit/spec/services/task/Task.ts +416 -0
  182. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  183. package/test/unit/spec/services/task/TaskManager.ts +781 -1735
  184. package/test/unit/spec/services/task/TaskUtils.ts +125 -0
  185. package/test/unit/spec/services/task/dialer.ts +112 -198
  186. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  187. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +473 -0
  188. package/test/unit/spec/services/task/state-machine/guards.ts +288 -0
  189. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  190. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +147 -0
  191. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  192. package/test/unit/spec/services/task/voice/Voice.ts +587 -0
  193. package/test/unit/spec/services/task/voice/WebRTC.ts +242 -0
  194. package/umd/contact-center.min.js +2 -2
  195. package/umd/contact-center.min.js.map +1 -1
  196. package/dist/services/task/index.js +0 -1525
  197. package/dist/services/task/index.js.map +0 -1
  198. package/dist/types/services/task/index.d.ts +0 -650
  199. package/src/services/task/index.ts +0 -1801
  200. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,424 @@
1
+ # Config Service - Architecture
2
+
3
+ > **Purpose**: Technical documentation for agent configuration aggregation.
4
+
5
+ ---
6
+
7
+ ## Component Overview
8
+
9
+ | Component | File | Responsibility |
10
+ |-----------|------|----------------|
11
+ | `AgentConfigService` | `config/index.ts` | Main config service class |
12
+ | `parseAgentConfigs` | `config/Util.ts` | Profile parsing/aggregation |
13
+ | `endPointMap` | `config/constants.ts` | API endpoint definitions |
14
+ | `types` | `config/types.ts` | Types, events, interfaces |
15
+
16
+ ---
17
+
18
+ ## Data Flow
19
+
20
+ ```mermaid
21
+ sequenceDiagram
22
+ participant CC as ContactCenter
23
+ participant Cfg as AgentConfigService
24
+ participant WR as WebexRequest
25
+ participant API as Backend APIs
26
+
27
+ CC->>Cfg: getAgentConfig(orgId, agentId)
28
+
29
+ par Wave 1 — fire immediately
30
+ Cfg->>WR: getUserUsingCI
31
+ Cfg->>WR: getOrgInfo
32
+ Cfg->>WR: getOrganizationSetting
33
+ Cfg->>WR: getTenantData
34
+ Cfg->>WR: getURLMapping
35
+ Cfg->>WR: getAllAuxCodes
36
+ end
37
+
38
+ WR->>API: 6 parallel API calls
39
+ API-->>WR: Responses
40
+ Note over Cfg: await userConfigData (needed for wave 2)
41
+
42
+ par Wave 2 — depends on userConfigData
43
+ Cfg->>WR: getDesktopProfileById(agentProfileId)
44
+ Cfg->>WR: getSiteInfo(siteId)
45
+ Cfg->>WR: getAllTeams(teamIds)
46
+ end
47
+
48
+ Note over Cfg: getDialPlanData chained off agentProfile<br/>(fires only if dialPlanEnabled)
49
+
50
+ Note over Cfg: Single Promise.all() awaits all 9 promises<br/>(wave 1 + wave 2 + conditional dialPlan)
51
+
52
+ WR->>API: Remaining API calls
53
+ API-->>WR: Responses
54
+
55
+ Cfg->>Cfg: parseAgentConfigs(allData)
56
+ Cfg-->>CC: Profile
57
+ ```
58
+
59
+ ---
60
+
61
+ ## API Endpoints
62
+
63
+ The config service uses multiple API endpoints to fetch agent configuration data. These endpoints are defined in `constants.ts` and include:
64
+
65
+ - **Core user data**: User profile, agent settings, site information
66
+ - **Team & organization**: Team memberships, organization settings, tenant configuration
67
+ - **Auxiliary codes**: Idle codes and wrap-up codes with pagination
68
+ - **Communication settings**: Dial plans, URL mappings, multimedia profiles
69
+ - **Outbound features**: Queue lists, entry points, address books, outdial ANI entries
70
+
71
+ ### Endpoint Definitions
72
+
73
+ All endpoints are relative to the WCC API Gateway base URL. Query parameters like `agentView=true` filter responses to agent-relevant data.
74
+
75
+ **Example Usage:**
76
+ ```typescript
77
+ // Fetch user data
78
+ const resource = endPointMap.userByCI('org-123', 'agent-456');
79
+ // Result: "organization/org-123/user/by-ci-user-id/agent-456"
80
+
81
+ // Fetch teams with pagination and filtering
82
+ const resource = endPointMap.listTeams('org-123', 0, 100, ['team-1', 'team-2']);
83
+ // Result: "organization/org-123/v2/team?page=0&pageSize=100&filter=id=in=(team-1,team-2)"
84
+
85
+ // Fetch organization settings
86
+ const resource = endPointMap.orgSettings('org-123');
87
+ // Result: "organization/org-123/v2/organization-setting?agentView=true"
88
+ ```
89
+
90
+ **Full Endpoint Map:**
91
+ ```typescript
92
+ export const endPointMap = {
93
+ userByCI: (orgId: string, agentId: string) =>
94
+ `organization/${orgId}/user/by-ci-user-id/${agentId}`,
95
+
96
+ desktopProfile: (orgId: string, desktopProfileId: string) =>
97
+ `organization/${orgId}/agent-profile/${desktopProfileId}`,
98
+
99
+ multimediaProfile: (orgId: string, multimediaProfileId: string) =>
100
+ `organization/${orgId}/multimedia-profile/${multimediaProfileId}`,
101
+
102
+ listTeams: (orgId: string, page: number, pageSize: number, filter: string[]) =>
103
+ `organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}${
104
+ filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
105
+ }`,
106
+
107
+ listAuxCodes: (orgId: string, page: number, pageSize: number, filter: string[], attributes: string[]) =>
108
+ `organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}${
109
+ filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
110
+ }&attributes=${attributes}`,
111
+
112
+ orgInfo: (orgId: string) =>
113
+ `organization/${orgId}`,
114
+
115
+ orgSettings: (orgId: string) =>
116
+ `organization/${orgId}/v2/organization-setting?agentView=true`,
117
+
118
+ siteInfo: (orgId: string, siteId: string) =>
119
+ `organization/${orgId}/site/${siteId}`,
120
+
121
+ tenantData: (orgId: string) =>
122
+ `organization/${orgId}/v2/tenant-configuration?agentView=true`,
123
+
124
+ urlMapping: (orgId: string) =>
125
+ `organization/${orgId}/v2/org-url-mapping?sort=name,ASC`,
126
+
127
+ dialPlan: (orgId: string) =>
128
+ `organization/${orgId}/dial-plan?agentView=true`,
129
+
130
+ queueList: (orgId: string, queryParams: string) =>
131
+ `/organization/${orgId}/v2/contact-service-queue?${queryParams}`,
132
+
133
+ entryPointList: (orgId: string, queryParams: string) =>
134
+ `/organization/${orgId}/v2/entry-point?${queryParams}`,
135
+
136
+ addressBookEntries: (orgId: string, addressBookId: string, queryParams: string) =>
137
+ `/organization/${orgId}/v2/address-book/${addressBookId}/entry?${queryParams}`,
138
+
139
+ outdialAniEntries: (orgId: string, outdialANI: string, queryParams: string) =>
140
+ `organization/${orgId}/v2/outdial-ani/${outdialANI}/entry${
141
+ queryParams ? `?${queryParams}` : ''
142
+ }`,
143
+ };
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Pagination Pattern
149
+
150
+ For endpoints with pagination (teams, aux codes):
151
+
152
+ ```typescript
153
+ import {DEFAULT_PAGE} from './constants'; // DEFAULT_PAGE = 0
154
+
155
+ public async getAllTeams(orgId, pageSize, filter): Promise<TeamList[]> {
156
+ let allTeams: TeamList[] = [];
157
+ let page = DEFAULT_PAGE;
158
+
159
+ // First request to get totalPages
160
+ const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
161
+ allTeams = allTeams.concat(firstResponse.data);
162
+ const totalPages = firstResponse.meta.totalPages;
163
+
164
+ // Parallel requests for remaining pages
165
+ const requests = [];
166
+ for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
167
+ requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
168
+ }
169
+
170
+ const responses = await Promise.all(requests);
171
+ for (const response of responses) {
172
+ allTeams = allTeams.concat(response.data);
173
+ }
174
+
175
+ return allTeams;
176
+ }
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Profile Parsing
182
+
183
+ `parseAgentConfigs` in Util.ts combines all data into a unified `Profile` object. See [types.ts](../types.ts) for full type definitions.
184
+
185
+ ### API Response Structures
186
+
187
+ The service fetches data from multiple APIs with these response structures:
188
+
189
+ | API Method | Response Type | Key Fields | Usage |
190
+ |------------|---------------|------------|-------|
191
+ | `getUserUsingCI` | `AgentResponse` | `ciUserId`, `id`, `firstName`, `lastName`, `email`, `teamIds`, `agentProfileId`, `siteId` | Primary agent identity and profile references |
192
+ | `getDesktopProfileById` | `DesktopProfileResponse` | `dialPlanEnabled`, `autoAnswer`, `accessWrapUpCode`, `wrapUpCodes`, `accessIdleCode`, `idleCodes`, `loginVoiceOptions` | Agent desktop settings and feature enablement |
193
+ | `getAllTeams` | `TeamList[]` | `id`, `name`, `type`, `channelMap` (+ 10 more fields) | Full team details with channel configurations |
194
+ | `getTenantData` | `TenantData` | `outdialEnabled`, `forceDefaultDn`, `privacyShieldVisible`, `timeoutDesktopInactivityEnabled` | Tenant-level feature flags |
195
+ | `getOrgInfo` | `OrgInfo` | `tenantId`, `timezone` | Organization metadata |
196
+ | `getAllAuxCodes` | `AuxCode[]` | `id`, `name`, `workTypeCode`, `active`, `isSystemCode`, `defaultCode` | Auxiliary codes for idle/wrap-up states |
197
+ | `getOrganizationSetting` | `OrgSettings` | `webRtcEnabled`, `maskSensitiveData`, `campaignManagerEnabled` | Organization-level feature flags |
198
+ | `getDialPlanData` | `DialPlanEntity[]` | `id`, `name`, `regularExpression`, `prefix`, `strippedChars` | Dial plan rules for outbound calling |
199
+ | `getURLMapping` | `URLMapping[]` | `name`, `url` | External service URL mappings |
200
+ | `getSiteInfo` | `SiteInfo` | Site-specific configuration | Site details |
201
+
202
+ These responses are parsed and aggregated into a single `Profile` object by the `parseAgentConfigs` function.
203
+
204
+ ### Profile Aggregation Function
205
+
206
+ ```typescript
207
+ // See full implementation in Util.ts
208
+ function parseAgentConfigs(profileData: {
209
+ userData: AgentResponse; // See types.ts:AgentResponse
210
+ teamData: Team[]; // NOTE: Declared as Team[] (teamId, teamName) but receives TeamList[] (id, name, + 12 more fields) at runtime
211
+ tenantData: TenantData; // See types.ts:TenantData
212
+ orgInfoData: OrgInfo; // See types.ts:OrgInfo
213
+ auxCodes: AuxCode[]; // See types.ts:AuxCode
214
+ orgSettingsData: OrgSettings; // See types.ts:OrgSettings
215
+ agentProfileData: DesktopProfileResponse; // See types.ts:DesktopProfileResponse
216
+ dialPlanData: DialPlanEntity[]; // See types.ts:DialPlanEntity
217
+ urlMapping: URLMapping[]; // See types.ts:URLMapping
218
+ multimediaProfileId: string;
219
+ }): Profile { // See types.ts:Profile
220
+ const { userData, teamData, tenantData, orgInfoData, auxCodes,
221
+ orgSettingsData, agentProfileData, dialPlanData, urlMapping } = profileData;
222
+
223
+ // Aux code filtering via getFilterAuxCodes():
224
+ // - checks auxCode.active
225
+ // - checks specificCodes access level (ALL → no filter, SPECIFIC → include list)
226
+ // - maps to Entity {id, name, isSystem, isDefault}
227
+ const wrapupCodes = getFilterAuxCodes(auxCodes, WRAP_UP_CODE,
228
+ agentProfileData.accessWrapUpCode === 'ALL' ? [] : agentProfileData.wrapUpCodes);
229
+ const idleCodes = getFilterAuxCodes(auxCodes, IDLE_CODE,
230
+ agentProfileData.accessIdleCode === 'ALL' ? [] : agentProfileData.idleCodes);
231
+
232
+ // Hardcoded "Available" state always appended to idle codes
233
+ idleCodes.push({ id: '0', name: 'Available', isSystem: false, isDefault: false });
234
+
235
+ return {
236
+ agentId: userData.ciUserId, // NOTE: uses ciUserId for agent identification
237
+ analyserUserId: userData.id, // NOTE: userData.id is used for analytics/reporting
238
+ agentName: `${userData.firstName} ${userData.lastName}`,
239
+ teams: teamData, // NOTE: Raw TeamList[] passed directly without mapping
240
+ idleCodes, // NOTE: Filtered via getFilterAuxCodes() + hardcoded "Available" state
241
+ wrapupCodes, // NOTE: Filtered via getFilterAuxCodes()
242
+ webRtcEnabled: orgSettingsData.webRtcEnabled,
243
+ loginVoiceOptions: agentProfileData.loginVoiceOptions ?? [],
244
+ enterpriseId: orgInfoData.tenantId,
245
+ tenantTimezone: orgInfoData.timezone,
246
+ multimediaProfileId: profileData.multimediaProfileId,
247
+ // ... 30+ more fields — see Util.ts:184-258 for full implementation
248
+ };
249
+ }
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Error Handling
255
+
256
+ Each method follows consistent error handling:
257
+
258
+ ```typescript
259
+ public async getUserUsingCI(orgId: string, agentId: string): Promise<AgentResponse> {
260
+ LoggerProxy.info('Fetching user data using CI', {
261
+ module: CONFIG_FILE_NAME,
262
+ method: METHODS.GET_USER_USING_CI,
263
+ });
264
+
265
+ try {
266
+ const resource = endPointMap.userByCI(orgId, agentId);
267
+ const response = await this.webexReq.request({
268
+ service: WCC_API_GATEWAY,
269
+ resource,
270
+ method: HTTP_METHODS.GET,
271
+ });
272
+
273
+ if (response.statusCode !== 200) {
274
+ throw new Error(`API call failed with ${response.statusCode}`);
275
+ }
276
+
277
+ LoggerProxy.log('getUserUsingCI api success.', {
278
+ module: CONFIG_FILE_NAME,
279
+ method: METHODS.GET_USER_USING_CI,
280
+ });
281
+
282
+ return Promise.resolve(response.body);
283
+ } catch (error) {
284
+ LoggerProxy.error(`getUserUsingCI API call failed with ${error}`, {
285
+ module: CONFIG_FILE_NAME,
286
+ method: METHODS.GET_USER_USING_CI,
287
+ });
288
+ throw error;
289
+ }
290
+ }
291
+ ```
292
+
293
+ ---
294
+
295
+ ## Troubleshooting
296
+
297
+ ### Common Issues and Log Patterns
298
+
299
+ #### Issue: Profile incomplete or getAgentConfig fails
300
+
301
+ **Cause**: One of the parallel API calls failed (network error, 401/403/404/500 response)
302
+
303
+ **Log patterns to search for:**
304
+ ```typescript
305
+ // General config failure
306
+ "getAgentConfig call failed"
307
+ "module": "config/index.ts", "method": "getAgentConfig"
308
+
309
+ // Specific API method failures
310
+ "getUserUsingCI API call failed"
311
+ "getDesktopProfileById API call failed"
312
+ "getAllTeams API call failed"
313
+ "getAllAuxCodes API call failed"
314
+
315
+ // Look for HTTP error codes
316
+ "API call failed with 401" // Authentication
317
+ "API call failed with 403" // Authorization
318
+ "API call failed with 404" // Not found
319
+ "API call failed with 500" // Server error
320
+ ```
321
+
322
+ **Solution**:
323
+ 1. Check logs for specific API that failed
324
+ 2. Verify orgId and agentId are correct
325
+ 3. Ensure authentication tokens are valid
326
+ 4. Check network connectivity to WCC API Gateway
327
+
328
+ #### Issue: Empty teams or aux codes
329
+
330
+ **Cause**: Pagination not completing or filter parameters incorrect
331
+
332
+ **Log patterns:**
333
+ ```typescript
334
+ "getAllTeams API call failed"
335
+ "getAllAuxCodes API call failed"
336
+ "method": "getListOfTeams"
337
+ "method": "getListOfAuxCodes"
338
+ ```
339
+
340
+ **Solution**:
341
+ 1. Check `totalPages` in first response
342
+ 2. Verify filter array contains valid team/aux code IDs
343
+ 3. Check if pageSize is appropriate (default: 100)
344
+ 4. Ensure all pages are fetched in Promise.all()
345
+
346
+ #### Issue: WebRTC or other features not enabled
347
+
348
+ **Cause**: Organization or tenant settings have feature disabled
349
+
350
+ **Log patterns:**
351
+ ```typescript
352
+ "getOrganizationSetting api success"
353
+ "getTenantData api success"
354
+ ```
355
+
356
+ **Solution**:
357
+ 1. Check `orgSettingsData.webRtcEnabled` in response
358
+ 2. Check `tenantData.outdialEnabled` for outbound features
359
+ 3. Verify feature is enabled in admin portal settings
360
+ 4. Confirm agentProfileData has correct feature flags
361
+
362
+ #### Issue: Missing dial plan data
363
+
364
+ **Cause**: `dialPlanEnabled` is false in desktop profile
365
+
366
+ **Solution**:
367
+ 1. Check `agentProfileData.dialPlanEnabled` value
368
+ 2. Verify dial plans are assigned in agent profile configuration
369
+ 3. Note: dial plan fetch only happens if `dialPlanEnabled === true`
370
+
371
+ #### Issue: Incorrect auxiliary code filtering
372
+
373
+ **Cause**: Access level set to 'SPECIFIC' but missing code IDs
374
+
375
+ **Log patterns:**
376
+ ```typescript
377
+ "method": "getFilterAuxCodes"
378
+ ```
379
+
380
+ **Solution**:
381
+ 1. Check `agentProfileData.accessWrapUpCode` (should be 'ALL' or 'SPECIFIC')
382
+ 2. Check `agentProfileData.accessIdleCode`
383
+ 3. If 'SPECIFIC', verify `wrapUpCodes` and `idleCodes` arrays contain valid IDs
384
+ 4. Ensure aux codes have `active: true` status
385
+ 5. Note: "Available" state is always appended to idle codes
386
+
387
+ ---
388
+
389
+ ## Types and Events
390
+
391
+ The config service defines comprehensive TypeScript types for all data structures. See [types.ts](../types.ts) for complete definitions.
392
+
393
+ ### Core Types
394
+
395
+ **Configuration Types:**
396
+ - `Profile` - Unified agent profile after aggregation
397
+ - `AgentResponse` - User data from userByCI endpoint
398
+ - `DesktopProfileResponse` - Agent desktop settings
399
+ - `TeamList` - Team data with full details (id, name, type, channelMap, etc.)
400
+ - `Team` - Simplified team reference (teamId, teamName, desktopLayoutId)
401
+ - `AuxCode` - Auxiliary code definition
402
+ - `Entity` - Filtered code entity (used for idle/wrapup codes in Profile)
403
+
404
+ **Organization Types:**
405
+ - `OrgInfo` - Organization metadata
406
+ - `OrgSettings` - Organization-level feature flags
407
+ - `TenantData` - Tenant configuration and feature enablement
408
+ - `SiteInfo` - Site-specific configuration
409
+
410
+ **Communication Types:**
411
+ - `DialPlanEntity` - Dial plan rule definition
412
+ - `URLMapping` - External service URL mapping
413
+ - `MultimediaProfile` - Multimedia profile configuration
414
+
415
+ **Note:** The config service itself does not emit events. For agent and task events, see the Agent and Task services. Event constants are defined in [types.ts](../types.ts) under `CC_AGENT_EVENTS` and `CC_TASK_EVENTS`.
416
+
417
+ ---
418
+
419
+ ## Related Files
420
+
421
+ - [index.ts](../index.ts) - Service implementation with all API methods
422
+ - [types.ts](../types.ts) - Complete type definitions and event constants
423
+ - [Util.ts](../Util.ts) - Profile parsing utilities (parseAgentConfigs, getFilterAuxCodes, etc.)
424
+ - [constants.ts](../constants.ts) - API endpoints, default values, and method names
@@ -65,6 +65,8 @@ export const CC_TASK_EVENTS = {
65
65
  AGENT_CONFERENCE_TRANSFER_FAILED: 'AgentConferenceTransferFailed',
66
66
  /** Event emitted for post-call activity by participant */
67
67
  PARTICIPANT_POST_CALL_ACTIVITY: 'ParticipantPostCallActivity',
68
+ /** Event emitted when consulted participant is being moved/transferred */
69
+ CONSULTED_PARTICIPANT_MOVING: 'ConsultedParticipantMoving',
68
70
  /** Event emitted when contact is blind transferred */
69
71
  AGENT_BLIND_TRANSFERRED: 'AgentBlindTransferred',
70
72
  /** Event emitted when blind transfer fails */
@@ -81,6 +83,8 @@ export const CC_TASK_EVENTS = {
81
83
  AGENT_CONSULT_TRANSFER_FAILED: 'AgentConsultTransferFailed',
82
84
  /** Event emitted when contact recording is paused */
83
85
  CONTACT_RECORDING_PAUSED: 'ContactRecordingPaused',
86
+ /** Event emitted when contact recording is started */
87
+ CONTACT_RECORDING_STARTED: 'ContactRecordingStarted',
84
88
  /** Event emitted when pausing contact recording fails */
85
89
  CONTACT_RECORDING_PAUSE_FAILED: 'ContactRecordingPauseFailed',
86
90
  /** Event emitted when contact recording is resumed */
@@ -91,6 +95,10 @@ export const CC_TASK_EVENTS = {
91
95
  CONTACT_ENDED: 'ContactEnded',
92
96
  /** Event emitted when contact is merged */
93
97
  CONTACT_MERGED: 'ContactMerged',
98
+ /** Event emitted when contact payload is updated (routing updates) */
99
+ CONTACT_UPDATED: 'ContactUpdated',
100
+ /** Event emitted when contact owner changes */
101
+ CONTACT_OWNER_CHANGED: 'ContactOwnerChanged',
94
102
  /** Event emitted when ending contact fails */
95
103
  AGENT_CONTACT_END_FAILED: 'AgentContactEndFailed',
96
104
  /** Event emitted when agent enters wrap-up state */
@@ -111,12 +119,6 @@ export const CC_TASK_EVENTS = {
111
119
  AGENT_CONTACT_UNASSIGNED: 'AgentContactUnassigned',
112
120
  /** Event emitted when inviting agent fails */
113
121
  AGENT_INVITE_FAILED: 'AgentInviteFailed',
114
- /** Event emitted when a campaign preview contact is offered to the agent */
115
- AGENT_OFFER_CAMPAIGN_RESERVATION: 'AgentOfferCampaignReservation',
116
- /** Event emitted when campaign contact is updated */
117
- CAMPAIGN_CONTACT_UPDATED: 'CampaignContactUpdated',
118
- /** Event emitted when accepting a campaign preview contact fails */
119
- CAMPAIGN_PREVIEW_ACCEPT_FAILED: 'CampaignPreviewAcceptFailed',
120
122
  /** Event emitted when a real-time transcript chunk is received */
121
123
  REAL_TIME_TRANSCRIPTION: 'REAL_TIME_TRANSCRIPTION',
122
124
  } as const;
@@ -185,6 +187,15 @@ export type WelcomeEvent = {
185
187
  agentId: string;
186
188
  };
187
189
 
190
+ /**
191
+ * Available login options for voice channel access
192
+ * 'AGENT_DN' - Login using agent's DN
193
+ * 'EXTENSION' - Login using extension number
194
+ * 'BROWSER' - Login using browser-based WebRTC
195
+ * @public
196
+ */
197
+ export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
198
+
188
199
  /**
189
200
  * Response type for welcome events which can be either success or error
190
201
  * @public
@@ -283,6 +294,31 @@ export type AgentResponse = {
283
294
  * Represents the response from getDesktopProfileById method.
284
295
  */
285
296
  export type DesktopProfileResponse = {
297
+ /**
298
+ * Unique identifier of the agent profile configuration.
299
+ */
300
+ id: string;
301
+
302
+ /**
303
+ * Display name for the agent profile.
304
+ */
305
+ name: string;
306
+
307
+ /**
308
+ * Description of the agent profile.
309
+ */
310
+ description: string;
311
+
312
+ /**
313
+ * Parent entity type for the profile (for example ORGANIZATION).
314
+ */
315
+ parentType: string;
316
+
317
+ /**
318
+ * Indicates whether screen pop is enabled.
319
+ */
320
+ screenPopup: boolean;
321
+
286
322
  /**
287
323
  * Represents the voice options of an agent.
288
324
  */
@@ -323,6 +359,11 @@ export type DesktopProfileResponse = {
323
359
  */
324
360
  autoWrapUp: boolean;
325
361
 
362
+ /**
363
+ * Whether the agent personal greeting is enabled.
364
+ */
365
+ agentPersonalGreeting: boolean;
366
+
326
367
  /**
327
368
  * Auto answer allowed.
328
369
  */
@@ -343,6 +384,36 @@ export type DesktopProfileResponse = {
343
384
  */
344
385
  allowAutoWrapUpExtension: boolean;
345
386
 
387
+ /**
388
+ * Access control for queues assigned to the agent (ALL or SPECIFIC).
389
+ */
390
+ accessQueue: string;
391
+
392
+ /**
393
+ * Queue identifiers available to the agent when access is SPECIFIC.
394
+ */
395
+ queues: string[];
396
+
397
+ /**
398
+ * Access control for entry points assigned to the agent.
399
+ */
400
+ accessEntryPoint: string;
401
+
402
+ /**
403
+ * Entry point identifiers available to the agent when access is SPECIFIC.
404
+ */
405
+ entryPoints: string[];
406
+
407
+ /**
408
+ * Access control for buddy teams assigned to the agent.
409
+ */
410
+ accessBuddyTeam: string;
411
+
412
+ /**
413
+ * Buddy team identifiers available to the agent when access is SPECIFIC.
414
+ */
415
+ buddyTeams: string[];
416
+
346
417
  /**
347
418
  * Outdial enabled for the agent.
348
419
  */
@@ -386,6 +457,11 @@ export type DesktopProfileResponse = {
386
457
  */
387
458
  agentDNValidation: string;
388
459
 
460
+ /**
461
+ * Additional DN validation criteria configured for the agent.
462
+ */
463
+ agentDNValidationCriterions: string[];
464
+
389
465
  /**
390
466
  * Dial plans of the agent.
391
467
  */
@@ -420,6 +496,31 @@ export type DesktopProfileResponse = {
420
496
  * State synchronization in Webex enabled or not.
421
497
  */
422
498
  stateSynchronizationWebex: boolean;
499
+
500
+ /**
501
+ * Threshold rules configured for the agent profile.
502
+ */
503
+ thresholdRules: Array<Record<string, string | number>>;
504
+
505
+ /**
506
+ * Whether the agent profile is currently active.
507
+ */
508
+ active: boolean;
509
+
510
+ /**
511
+ * Whether this profile is the system default.
512
+ */
513
+ systemDefault: boolean;
514
+
515
+ /**
516
+ * Timestamp when the profile was created.
517
+ */
518
+ createdTime: number;
519
+
520
+ /**
521
+ * Timestamp when the profile was last updated.
522
+ */
523
+ lastUpdatedTime: number;
423
524
  };
424
525
 
425
526
  /**
@@ -588,8 +689,6 @@ export type OrgInfo = {
588
689
  tenantId: string;
589
690
  /** Organization timezone */
590
691
  timezone: string;
591
- /** Current environment (e.g., 'produs1', 'intgus1') */
592
- environment: string;
593
692
  };
594
693
 
595
694
  /**
@@ -866,15 +965,6 @@ export type WrapupData = {
866
965
  };
867
966
  };
868
967
 
869
- /**
870
- * Available login options for voice channel access
871
- * 'AGENT_DN' - Login using agent's DN
872
- * 'EXTENSION' - Login using extension number
873
- * 'BROWSER' - Login using browser-based WebRTC
874
- * @public
875
- */
876
- export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
877
-
878
968
  /**
879
969
  * Team configuration information
880
970
  * @public
@@ -1047,7 +1137,7 @@ export type Profile = {
1047
1137
  /** Outbound entry point */
1048
1138
  outDialEp: string;
1049
1139
  /** Whether ending calls is enabled */
1050
- isEndCallEnabled: boolean;
1140
+ isEndTaskEnabled: boolean;
1051
1141
  /** Whether ending consultations is enabled */
1052
1142
  isEndConsultEnabled: boolean;
1053
1143
  /** Optional lifecycle manager URL */
@@ -1094,8 +1184,6 @@ export type Profile = {
1094
1184
  isAnalyzerEnabled?: boolean;
1095
1185
  /** Tenant timezone */
1096
1186
  tenantTimezone?: string;
1097
- /** Current environment (e.g., 'produs1', 'intgus1') */
1098
- environment?: string;
1099
1187
  /** Available voice login options */
1100
1188
  loginVoiceOptions?: LoginOption[];
1101
1189
  /** Current login device type */
@@ -58,7 +58,6 @@ export const AGENT = 'agent';
58
58
  * @ignore
59
59
  */
60
60
  export const SUBSCRIBE_API = 'v1/notification/subscribe';
61
-
62
61
  /**
63
62
  * API path for realtime transcription subscription.
64
63
  * @type {string}
@@ -38,7 +38,6 @@ export type TaskErrorIds =
38
38
  | {'Service.aqm.task.pauseRecording': Failure}
39
39
  | {'Service.aqm.task.resumeRecording': Failure}
40
40
  | {'Service.aqm.dialer.startOutdial': Failure}
41
- | {'Service.aqm.dialer.acceptPreviewContact': Failure}
42
41
  | {'Service.reqs.generic.failure': {trackingId: string}};
43
42
 
44
43
  export type ReqError =