@webex/contact-center 3.12.0-next.17 → 3.12.0-next.170

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 (328) hide show
  1. package/.sdd/manifest.json +887 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +62 -0
  5. package/ai-docs/GETTING_STARTED.md +168 -0
  6. package/ai-docs/GLOSSARY.md +43 -0
  7. package/ai-docs/README.md +138 -0
  8. package/ai-docs/REVIEW_CHECKLIST.md +41 -0
  9. package/ai-docs/RULES.md +444 -0
  10. package/ai-docs/SECURITY.md +52 -0
  11. package/ai-docs/SERVICE_STATE.md +52 -0
  12. package/ai-docs/SPEC_INDEX.md +65 -0
  13. package/ai-docs/adr/0001-spec-source-policy.md +55 -0
  14. package/ai-docs/adr/README.md +8 -0
  15. package/ai-docs/adr/_adr-template.md +31 -0
  16. package/ai-docs/contact-center-spec.md +385 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/contact-owner-change-refactor.md +78 -0
  19. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  20. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  21. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  22. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  23. package/ai-docs/patterns/testing-patterns.md +480 -0
  24. package/ai-docs/patterns/typescript-patterns.md +365 -0
  25. package/ai-docs/templates/README.md +102 -0
  26. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  27. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  28. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  29. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  30. package/ai-docs/templates/new-method/00-master.md +80 -0
  31. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  32. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  33. package/ai-docs/templates/new-method/03-tests.md +201 -0
  34. package/ai-docs/templates/new-method/04-validation.md +141 -0
  35. package/ai-docs/templates/new-service/00-master.md +109 -0
  36. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  37. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  38. package/ai-docs/templates/new-service/03-integration.md +178 -0
  39. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  40. package/ai-docs/templates/new-service/05-validation.md +145 -0
  41. package/dist/cc.js +888 -49
  42. package/dist/cc.js.map +1 -1
  43. package/dist/config.js +13 -0
  44. package/dist/config.js.map +1 -1
  45. package/dist/constants.js +38 -3
  46. package/dist/constants.js.map +1 -1
  47. package/dist/index.js +54 -17
  48. package/dist/index.js.map +1 -1
  49. package/dist/metrics/MetricsManager.js +16 -0
  50. package/dist/metrics/MetricsManager.js.map +1 -1
  51. package/dist/metrics/behavioral-events.js +185 -0
  52. package/dist/metrics/behavioral-events.js.map +1 -1
  53. package/dist/metrics/constants.js +54 -4
  54. package/dist/metrics/constants.js.map +1 -1
  55. package/dist/services/AddressBook.js +18 -15
  56. package/dist/services/AddressBook.js.map +1 -1
  57. package/dist/services/AnswerCallOnWebexService.js +202 -0
  58. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  59. package/dist/services/ApiAiAssistant.js +369 -14
  60. package/dist/services/ApiAiAssistant.js.map +1 -1
  61. package/dist/services/EntryPoint.js +46 -68
  62. package/dist/services/EntryPoint.js.map +1 -1
  63. package/dist/services/Queue.js +27 -22
  64. package/dist/services/Queue.js.map +1 -1
  65. package/dist/services/UserPreference.js +427 -0
  66. package/dist/services/UserPreference.js.map +1 -0
  67. package/dist/services/WebCallingService.js +10 -2
  68. package/dist/services/WebCallingService.js.map +1 -1
  69. package/dist/services/WebexCrossClientService.js +225 -0
  70. package/dist/services/WebexCrossClientService.js.map +1 -0
  71. package/dist/services/WxAppTelephonyMercurySync.js +111 -0
  72. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  73. package/dist/services/config/Util.js +48 -48
  74. package/dist/services/config/Util.js.map +1 -1
  75. package/dist/services/config/constants.js +56 -78
  76. package/dist/services/config/constants.js.map +1 -1
  77. package/dist/services/config/index.js +100 -226
  78. package/dist/services/config/index.js.map +1 -1
  79. package/dist/services/config/types.js +93 -24
  80. package/dist/services/config/types.js.map +1 -1
  81. package/dist/services/constants.js +11 -1
  82. package/dist/services/constants.js.map +1 -1
  83. package/dist/services/core/Err.js.map +1 -1
  84. package/dist/services/core/Utils.js +131 -32
  85. package/dist/services/core/Utils.js.map +1 -1
  86. package/dist/services/core/WebexRequest.js +6 -2
  87. package/dist/services/core/WebexRequest.js.map +1 -1
  88. package/dist/services/core/aqm-reqs.js +17 -11
  89. package/dist/services/core/aqm-reqs.js.map +1 -1
  90. package/dist/services/core/constants.js +9 -1
  91. package/dist/services/core/constants.js.map +1 -1
  92. package/dist/services/core/types.js.map +1 -1
  93. package/dist/services/core/websocket/WebSocketManager.js +19 -2
  94. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  95. package/dist/services/core/websocket/types.js.map +1 -1
  96. package/dist/services/index.js +1 -1
  97. package/dist/services/index.js.map +1 -1
  98. package/dist/services/task/Task.js +955 -0
  99. package/dist/services/task/Task.js.map +1 -0
  100. package/dist/services/task/TaskFactory.js +50 -0
  101. package/dist/services/task/TaskFactory.js.map +1 -0
  102. package/dist/services/task/TaskManager.js +1272 -605
  103. package/dist/services/task/TaskManager.js.map +1 -1
  104. package/dist/services/task/TaskUtils.js +221 -27
  105. package/dist/services/task/TaskUtils.js.map +1 -1
  106. package/dist/services/task/WebexCallingUtils.js +70 -0
  107. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  108. package/dist/services/task/constants.js +19 -2
  109. package/dist/services/task/constants.js.map +1 -1
  110. package/dist/services/task/contact.js +29 -0
  111. package/dist/services/task/contact.js.map +1 -1
  112. package/dist/services/task/digital/Digital.js +78 -0
  113. package/dist/services/task/digital/Digital.js.map +1 -0
  114. package/dist/services/task/state-machine/TaskStateMachine.js +982 -0
  115. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  116. package/dist/services/task/state-machine/actions.js +572 -0
  117. package/dist/services/task/state-machine/actions.js.map +1 -0
  118. package/dist/services/task/state-machine/constants.js +161 -0
  119. package/dist/services/task/state-machine/constants.js.map +1 -0
  120. package/dist/services/task/state-machine/guards.js +379 -0
  121. package/dist/services/task/state-machine/guards.js.map +1 -0
  122. package/dist/services/task/state-machine/index.js +53 -0
  123. package/dist/services/task/state-machine/index.js.map +1 -0
  124. package/dist/services/task/state-machine/types.js +54 -0
  125. package/dist/services/task/state-machine/types.js.map +1 -0
  126. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  127. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  128. package/dist/services/task/taskDataNormalizer.js +99 -0
  129. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  130. package/dist/services/task/types.js +215 -5
  131. package/dist/services/task/types.js.map +1 -1
  132. package/dist/services/task/voice/Voice.js +1504 -0
  133. package/dist/services/task/voice/Voice.js.map +1 -0
  134. package/dist/services/task/voice/WebRTC.js +152 -0
  135. package/dist/services/task/voice/WebRTC.js.map +1 -0
  136. package/dist/services/task/voice/wxAppOfferObservability.js +145 -0
  137. package/dist/services/task/voice/wxAppOfferObservability.js.map +1 -0
  138. package/dist/services/task/voice/wxAppVoiceMethods.js +395 -0
  139. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  140. package/dist/services/wxAppDiagnosticLogging.js +159 -0
  141. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  142. package/dist/services/wxAppTelephonyUtils.js +19 -0
  143. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  144. package/dist/types/cc.d.ts +152 -9
  145. package/dist/types/config.d.ts +13 -0
  146. package/dist/types/constants.d.ts +36 -1
  147. package/dist/types/index.d.ts +54 -20
  148. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  149. package/dist/types/metrics/constants.d.ts +48 -1
  150. package/dist/types/services/AddressBook.d.ts +2 -1
  151. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  152. package/dist/types/services/ApiAiAssistant.d.ts +67 -5
  153. package/dist/types/services/EntryPoint.d.ts +7 -5
  154. package/dist/types/services/Queue.d.ts +5 -3
  155. package/dist/types/services/UserPreference.d.ts +118 -0
  156. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  157. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  158. package/dist/types/services/config/Util.d.ts +4 -8
  159. package/dist/types/services/config/constants.d.ts +49 -76
  160. package/dist/types/services/config/index.d.ts +16 -64
  161. package/dist/types/services/config/types.d.ts +240 -114
  162. package/dist/types/services/constants.d.ts +9 -0
  163. package/dist/types/services/core/Err.d.ts +2 -0
  164. package/dist/types/services/core/Utils.d.ts +43 -13
  165. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  166. package/dist/types/services/core/constants.d.ts +7 -0
  167. package/dist/types/services/core/types.d.ts +2 -0
  168. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  169. package/dist/types/services/core/websocket/types.d.ts +1 -1
  170. package/dist/types/services/index.d.ts +1 -1
  171. package/dist/types/services/task/Task.d.ts +186 -0
  172. package/dist/types/services/task/TaskFactory.d.ts +14 -0
  173. package/dist/types/services/task/TaskUtils.d.ts +54 -2
  174. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  175. package/dist/types/services/task/constants.d.ts +17 -0
  176. package/dist/types/services/task/contact.d.ts +4 -0
  177. package/dist/types/services/task/digital/Digital.d.ts +23 -0
  178. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -0
  179. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  180. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  181. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  182. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  183. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  184. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  185. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  186. package/dist/types/services/task/types.d.ts +738 -66
  187. package/dist/types/services/task/voice/Voice.d.ts +241 -0
  188. package/dist/types/services/task/voice/WebRTC.d.ts +54 -0
  189. package/dist/types/services/task/voice/wxAppOfferObservability.d.ts +39 -0
  190. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +68 -0
  191. package/dist/types/services/wxAppDiagnosticLogging.d.ts +63 -0
  192. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  193. package/dist/types/types.d.ts +213 -11
  194. package/dist/types/utils/PageCache.d.ts +20 -3
  195. package/dist/types/webex.d.ts +1 -0
  196. package/dist/types.js +168 -6
  197. package/dist/types.js.map +1 -1
  198. package/dist/utils/PageCache.js +19 -5
  199. package/dist/utils/PageCache.js.map +1 -1
  200. package/dist/webex.js +22 -2
  201. package/dist/webex.js.map +1 -1
  202. package/package.json +16 -12
  203. package/src/cc.ts +1137 -67
  204. package/src/config.ts +13 -0
  205. package/src/constants.ts +39 -1
  206. package/src/index.ts +62 -15
  207. package/src/metrics/MetricsManager.ts +16 -0
  208. package/src/metrics/ai-docs/AGENTS.md +350 -0
  209. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  210. package/src/metrics/ai-docs/metrics-spec.md +971 -0
  211. package/src/metrics/behavioral-events.ts +190 -0
  212. package/src/metrics/constants.ts +59 -4
  213. package/src/services/AddressBook.ts +17 -6
  214. package/src/services/AnswerCallOnWebexService.ts +239 -0
  215. package/src/services/ApiAiAssistant.ts +494 -15
  216. package/src/services/EntryPoint.ts +59 -60
  217. package/src/services/Queue.ts +29 -12
  218. package/src/services/UserPreference.ts +509 -0
  219. package/src/services/WebCallingService.ts +16 -2
  220. package/src/services/WebexCrossClientService.ts +298 -0
  221. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  222. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  223. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  224. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  225. package/src/services/ai-docs/AGENTS.md +386 -0
  226. package/src/services/ai-docs/services-spec.md +512 -0
  227. package/src/services/config/Util.ts +54 -84
  228. package/src/services/config/ai-docs/AGENTS.md +250 -0
  229. package/src/services/config/ai-docs/ARCHITECTURE.md +413 -0
  230. package/src/services/config/ai-docs/config-spec.md +669 -0
  231. package/src/services/config/constants.ts +63 -85
  232. package/src/services/config/index.ts +116 -277
  233. package/src/services/config/types.ts +229 -125
  234. package/src/services/constants.ts +10 -0
  235. package/src/services/core/Err.ts +1 -0
  236. package/src/services/core/Utils.ts +151 -37
  237. package/src/services/core/WebexRequest.ts +3 -1
  238. package/src/services/core/ai-docs/AGENTS.md +381 -0
  239. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  240. package/src/services/core/ai-docs/core-spec.md +797 -0
  241. package/src/services/core/aqm-reqs.ts +18 -12
  242. package/src/services/core/constants.ts +8 -0
  243. package/src/services/core/types.ts +33 -1
  244. package/src/services/core/websocket/WebSocketManager.ts +28 -2
  245. package/src/services/core/websocket/types.ts +1 -1
  246. package/src/services/index.ts +1 -1
  247. package/src/services/task/Task.ts +1211 -0
  248. package/src/services/task/TaskFactory.ts +82 -0
  249. package/src/services/task/TaskManager.ts +1585 -724
  250. package/src/services/task/TaskUtils.ts +316 -25
  251. package/src/services/task/WebexCallingUtils.ts +136 -0
  252. package/src/services/task/ai-docs/AGENTS.md +457 -0
  253. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  254. package/src/services/task/ai-docs/task-spec.md +1501 -0
  255. package/src/services/task/constants.ts +18 -0
  256. package/src/services/task/contact.ts +30 -0
  257. package/src/services/task/digital/Digital.ts +102 -0
  258. package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
  259. package/src/services/task/state-machine/actions.ts +741 -0
  260. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  261. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1156 -0
  262. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2247 -0
  263. package/src/services/task/state-machine/constants.ts +172 -0
  264. package/src/services/task/state-machine/guards.ts +442 -0
  265. package/src/services/task/state-machine/index.ts +28 -0
  266. package/src/services/task/state-machine/types.ts +258 -0
  267. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  268. package/src/services/task/taskDataNormalizer.ts +137 -0
  269. package/src/services/task/types.ts +918 -70
  270. package/src/services/task/voice/Voice.ts +1878 -0
  271. package/src/services/task/voice/WebRTC.ts +194 -0
  272. package/src/services/task/voice/wxAppOfferObservability.ts +204 -0
  273. package/src/services/task/voice/wxAppVoiceMethods.ts +575 -0
  274. package/src/services/wxAppDiagnosticLogging.ts +286 -0
  275. package/src/services/wxAppTelephonyUtils.ts +14 -0
  276. package/src/types.ts +272 -13
  277. package/src/utils/AGENTS.md +289 -0
  278. package/src/utils/PageCache.ts +38 -5
  279. package/src/utils/ai-docs/utils-spec.md +391 -0
  280. package/src/webex.js +10 -0
  281. package/test/unit/fixtures/aiSummaryTestUtils.ts +40 -0
  282. package/test/unit/spec/cc.ts +3553 -107
  283. package/test/unit/spec/index.ts +885 -0
  284. package/test/unit/spec/logger-proxy.ts +70 -0
  285. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  286. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  287. package/test/unit/spec/services/AddressBook.ts +37 -6
  288. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  289. package/test/unit/spec/services/ApiAiAssistant.ts +442 -23
  290. package/test/unit/spec/services/EntryPoint.ts +87 -40
  291. package/test/unit/spec/services/Queue.ts +123 -12
  292. package/test/unit/spec/services/UserPreference.ts +401 -0
  293. package/test/unit/spec/services/WebCallingService.ts +45 -1
  294. package/test/unit/spec/services/WebexCrossClientService.ts +509 -0
  295. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  296. package/test/unit/spec/services/config/Util.ts +501 -0
  297. package/test/unit/spec/services/config/index.ts +317 -547
  298. package/test/unit/spec/services/core/Utils.ts +447 -8
  299. package/test/unit/spec/services/core/WebexRequest.ts +8 -7
  300. package/test/unit/spec/services/core/aqm-reqs.ts +142 -1
  301. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +129 -53
  302. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  303. package/test/unit/spec/services/task/Task.ts +2723 -0
  304. package/test/unit/spec/services/task/TaskFactory.ts +116 -0
  305. package/test/unit/spec/services/task/TaskManager.ts +4734 -1769
  306. package/test/unit/spec/services/task/TaskUtils.ts +307 -0
  307. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  308. package/test/unit/spec/services/task/contact.ts +33 -0
  309. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  310. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
  311. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  312. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  313. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  314. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  315. package/test/unit/spec/services/task/voice/Voice.ts +2355 -0
  316. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  317. package/test/unit/spec/services/task/voice/wxAppOfferObservability.ts +361 -0
  318. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +719 -0
  319. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +179 -0
  320. package/test/unit/spec/wellnessSampleUtils.ts +288 -0
  321. package/typedoc.md +1 -1
  322. package/umd/contact-center.min.js +2 -2
  323. package/umd/contact-center.min.js.map +1 -1
  324. package/dist/services/task/index.js +0 -1530
  325. package/dist/services/task/index.js.map +0 -1
  326. package/dist/types/services/task/index.d.ts +0 -650
  327. package/src/services/task/index.ts +0 -1806
  328. package/test/unit/spec/services/task/index.ts +0 -2205
@@ -0,0 +1,413 @@
1
+ # Config Service - Architecture
2
+
3
+ > **Legacy/reference-only.** Canonical SDD: [`config-spec.md`](config-spec.md). Use the package [manifest](../../../../.sdd/manifest.json) and [`SPEC_INDEX.md`](../../../../ai-docs/SPEC_INDEX.md) for routing; code and tests remain the behavioral referee.
4
+
5
+ > **Purpose**: Technical documentation for agent configuration aggregation.
6
+
7
+ ---
8
+
9
+ ## Component Overview
10
+
11
+ | Component | File | Responsibility |
12
+ |-----------|------|----------------|
13
+ | `AgentConfigService` | `config/index.ts` | Main config service class |
14
+ | `parseAgentConfigs` | `config/Util.ts` | Profile parsing/aggregation |
15
+ | `endPointMap` | `config/constants.ts` | API endpoint definitions |
16
+ | `types` | `config/types.ts` | Types, events, interfaces |
17
+
18
+ ---
19
+
20
+ ## Data Flow
21
+
22
+ ```mermaid
23
+ sequenceDiagram
24
+ participant CC as ContactCenter
25
+ participant Cfg as AgentConfigService
26
+ participant WR as WebexRequest
27
+ participant API as Backend APIs
28
+
29
+ CC->>Cfg: getAgentConfig(orgId, agentId)
30
+
31
+ par Wave 1 — fire immediately
32
+ Cfg->>WR: getUserDesktopLoginConfig
33
+ Cfg->>WR: getOrgDesktopLoginConfig
34
+ Cfg->>WR: getAllAuxCodes
35
+ end
36
+
37
+ WR->>API: 3 parallel API calls
38
+ API-->>WR: Responses
39
+ Note over Cfg: await userConfig (supplies dbId, siteId, dialPlanEnabled)
40
+
41
+ par Wave 2 — depends on userConfig
42
+ Cfg->>WR: getSiteInfo(user.siteId)
43
+ Cfg->>WR: getAllTeams(user.dbId)
44
+ Cfg->>WR: getDialPlanData (only if agentProfile.dialPlanEnabled)
45
+ end
46
+
47
+ Note over Cfg: Single Promise.all() awaits 5 promises<br/>(org aggregate + aux codes + site + teams + conditional dialPlan)
48
+ Note over Cfg: multimediaProfileId = team value, else site value
49
+
50
+ WR->>API: Remaining API calls
51
+ API-->>WR: Responses
52
+
53
+ Cfg->>Cfg: parseAgentConfigs(allData)
54
+ Cfg-->>CC: Profile
55
+ ```
56
+
57
+ ---
58
+
59
+ ## API Endpoints
60
+
61
+ The config service uses multiple API endpoints to fetch agent configuration data. These endpoints are defined in `constants.ts` and include:
62
+
63
+ - **User desktop-login aggregate**: agent identity plus the `agentProfile` section in one call
64
+ - **Organization desktop-login aggregate**: organization info, organization settings, tenant configuration, URL mappings, AI feature, Microsoft/Webex config in one call
65
+ - **Team & site**: Team memberships filtered by the agent's `userId`, plus site information
66
+ - **Auxiliary codes**: Idle codes and wrap-up codes with pagination
67
+ - **Communication settings**: Dial plans, multimedia profiles
68
+ - **Outbound features**: Queue lists, entry points, address books, outdial ANI entries
69
+
70
+ ### Endpoint Definitions
71
+
72
+ All endpoints are relative to the WCC API Gateway base URL. Query parameters like `agentView=true` filter responses to agent-relevant data.
73
+
74
+ **Example Usage:**
75
+ ```typescript
76
+ // Fetch the user desktop-login aggregate
77
+ const resource = endPointMap.userDesktopLogin('org-123', 'agent-456');
78
+ // Result: "organization/org-123/v2/user/by-ci-user-id/agent-456/desktop-login"
79
+
80
+ // Fetch teams with pagination, filtered by the user's database id
81
+ const resource = endPointMap.listTeams('org-123', 0, 100, 'user-db-id');
82
+ // Result: "organization/org-123/v2/team?page=0&pageSize=100&agentView=true&filter=userId==user-db-id"
83
+
84
+ // Fetch the organization desktop-login aggregate
85
+ const resource = endPointMap.orgDesktopLogin('org-123');
86
+ // Result: "organization/org-123/desktop-login"
87
+ ```
88
+
89
+ **Full Endpoint Map:**
90
+ ```typescript
91
+ export const endPointMap = {
92
+ orgDesktopLogin: (orgId: string) =>
93
+ `organization/${orgId}/desktop-login`,
94
+
95
+ userDesktopLogin: (orgId: string, ciUserId: string) =>
96
+ `organization/${orgId}/v2/user/by-ci-user-id/${ciUserId}/desktop-login`,
97
+
98
+ multimediaProfile: (orgId: string, multimediaProfileId: string) =>
99
+ `organization/${orgId}/multimedia-profile/${multimediaProfileId}`,
100
+
101
+ // The filter value must stay unquoted — the quoted form returns HTTP 400.
102
+ listTeams: (orgId: string, page: number, pageSize: number, userDbId: string) =>
103
+ `organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}` +
104
+ `&agentView=true&filter=userId==${userDbId}`,
105
+
106
+ listAuxCodes: (orgId: string, page: number, pageSize: number, filter: string[], attributes: string[]) =>
107
+ `organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}${
108
+ filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''
109
+ }&attributes=${attributes}`,
110
+
111
+ siteInfo: (orgId: string, siteId: string) =>
112
+ `organization/${orgId}/site/${siteId}`,
113
+
114
+ dialPlan: (orgId: string) =>
115
+ `organization/${orgId}/dial-plan?agentView=true`,
116
+
117
+ queueList: (orgId: string, queryParams: string) =>
118
+ `/organization/${orgId}/v2/contact-service-queue?${queryParams}`,
119
+
120
+ entryPointDialNumberList: (orgId: string, queryParams: string) =>
121
+ `/organization/${orgId}/v3/dial-number?${queryParams}`,
122
+
123
+ addressBookEntries: (orgId: string, addressBookId: string, queryParams: string) =>
124
+ `/organization/${orgId}/v2/address-book/${addressBookId}/entry?${queryParams}`,
125
+
126
+ outdialAniEntries: (orgId: string, outdialANI: string, queryParams: string) =>
127
+ `organization/${orgId}/v2/outdial-ani/${outdialANI}/entry${
128
+ queryParams ? `?${queryParams}` : ''
129
+ }`,
130
+ };
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Pagination Pattern
136
+
137
+ For endpoints with pagination (teams, aux codes):
138
+
139
+ ```typescript
140
+ import {DEFAULT_PAGE} from './constants'; // DEFAULT_PAGE = 0
141
+
142
+ public async getAllTeams(orgId, pageSize, filter): Promise<TeamList[]> {
143
+ let allTeams: TeamList[] = [];
144
+ let page = DEFAULT_PAGE;
145
+
146
+ // First request to get totalPages
147
+ const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
148
+ allTeams = allTeams.concat(firstResponse.data);
149
+ const totalPages = firstResponse.meta.totalPages;
150
+
151
+ // Parallel requests for remaining pages
152
+ const requests = [];
153
+ for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
154
+ requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
155
+ }
156
+
157
+ const responses = await Promise.all(requests);
158
+ for (const response of responses) {
159
+ allTeams = allTeams.concat(response.data);
160
+ }
161
+
162
+ return allTeams;
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Profile Parsing
169
+
170
+ `parseAgentConfigs` in Util.ts combines all data into a unified `Profile` object. See [types.ts](../types.ts) for full type definitions.
171
+
172
+ ### API Response Structures
173
+
174
+ The service fetches data from multiple APIs with these response structures:
175
+
176
+ | API Method | Response Type | Key Fields | Usage |
177
+ |------------|---------------|------------|-------|
178
+ | `getUserDesktopLoginConfig` | `UserDesktopLoginResponse` | `user`: `ciUserId`, `id`, `dbId`, `firstName`, `lastName`, `email`, `agentProfileId`, `siteId`. `agentProfile`: `dialPlanEnabled`, `accessWrapUpCode`, `accessIdleCode`, `loginVoiceOptions`, `viewableStatistics` | Agent identity, team-filter id, site reference, and desktop settings in one call |
179
+ | `getOrgDesktopLoginConfig` | `OrgDesktopLoginResponse` | `organization`: `tenantId`, `timezone`. `organizationSetting`: `webRtcEnabled`, `maskSensitiveData`, `campaignManagerEnabled`, `aiAssistantQuantity`. `tenantConfiguration`: `outdialEnabled`, `forceDefaultDn`, `privacyShieldVisible`, `timeoutDesktopInactivityEnabled`. Optional `urlMappings`, `aiFeature`, `microsoftConfig`, `webexConfig` | All organization-, tenant- and feature-scoped configuration in one call |
180
+ | `getAllTeams` | `TeamList[]` | `id`, `name`, `teamType`, `siteId`, `siteName`, `multiMediaProfileId` (+ more) | Team details for the teams the agent belongs to |
181
+ | `getAllAuxCodes` | `AuxCode[]` | `id`, `name`, `workTypeCode`, `active`, `isSystemCode`, `defaultCode` | Auxiliary codes for idle/wrap-up states |
182
+ | `getDialPlanData` | `DialPlanEntity[]` | `id`, `name`, `regularExpression`, `prefix`, `strippedChars`, `active` | Dial plan rules for outbound calling |
183
+ | `getSiteInfo` | `SiteInfo` | Site-specific configuration | Site details, including the `multimediaProfileId` fallback |
184
+
185
+ These responses are parsed and aggregated into a single `Profile` object by the `parseAgentConfigs` function.
186
+
187
+ ### Profile Aggregation Function
188
+
189
+ ```typescript
190
+ // See full implementation in Util.ts
191
+ function parseAgentConfigs(profileData: {
192
+ orgConfig: OrgDesktopLoginResponse; // See types.ts:OrgDesktopLoginResponse
193
+ userData: AgentResponse; // `user` section; see types.ts:AgentResponse
194
+ agentProfileData: AgentProfile; // `agentProfile` section; see types.ts:AgentProfile
195
+ teamData: TeamList[]; // See types.ts:TeamList
196
+ auxCodes: AuxCode[]; // See types.ts:AuxCode
197
+ dialPlanData: DialPlanEntity[]; // See types.ts:DialPlanEntity
198
+ multimediaProfileId: string;
199
+ }): Profile { // See types.ts:Profile
200
+ const { orgConfig, userData, agentProfileData, teamData, auxCodes,
201
+ dialPlanData } = profileData;
202
+ const {
203
+ organization: orgInfoData,
204
+ organizationSetting: orgSettingsData,
205
+ tenantConfiguration: tenantData,
206
+ urlMappings,
207
+ aiFeature,
208
+ microsoftConfig,
209
+ webexConfig,
210
+ } = orgConfig;
211
+
212
+ // Aux code filtering via getFilterAuxCodes():
213
+ // - checks auxCode.workTypeCode and auxCode.active
214
+ // - the aggregate returns the full org pool, so no per-agent restriction is applied
215
+ // - maps to Entity {id, name, isSystem, isDefault}
216
+ const wrapupCodes = getFilterAuxCodes(auxCodes, WRAP_UP_CODE);
217
+ const idleCodes = getFilterAuxCodes(auxCodes, IDLE_CODE);
218
+
219
+ // Hardcoded "Available" state always appended to idle codes
220
+ idleCodes.push({ id: '0', name: 'Available', isSystem: false, isDefault: false });
221
+
222
+ return {
223
+ agentId: userData.ciUserId, // NOTE: uses ciUserId for agent identification
224
+ analyserUserId: userData.id, // NOTE: userData.id is used for analytics/reporting
225
+ agentName: `${userData.firstName} ${userData.lastName}`,
226
+ teams: teamData, // TeamList[] straight from the team API; Profile.teams is TeamList[]
227
+ idleCodes, // NOTE: Filtered via getFilterAuxCodes() + hardcoded "Available" state
228
+ wrapupCodes, // NOTE: Filtered via getFilterAuxCodes()
229
+ webRtcEnabled: orgSettingsData.webRtcEnabled,
230
+ loginVoiceOptions: agentProfileData.loginVoiceOptions ?? [],
231
+ enterpriseId: orgInfoData.tenantId,
232
+ tenantTimezone: orgInfoData.timezone,
233
+ multimediaProfileId: profileData.multimediaProfileId,
234
+ // ... 30+ more fields — see Util.ts:184-258 for full implementation
235
+ };
236
+ }
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Error Handling
242
+
243
+ Each method follows consistent error handling:
244
+
245
+ ```typescript
246
+ public async getUserDesktopLoginConfig(
247
+ orgId: string,
248
+ ciUserId: string
249
+ ): Promise<UserDesktopLoginResponse> {
250
+ LoggerProxy.info('Fetching user desktop-login configuration', {
251
+ module: CONFIG_FILE_NAME,
252
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
253
+ });
254
+
255
+ try {
256
+ const resource = endPointMap.userDesktopLogin(orgId, ciUserId);
257
+ const response = await this.webexReq.request({
258
+ service: WCC_API_GATEWAY,
259
+ resource,
260
+ method: HTTP_METHODS.GET,
261
+ });
262
+
263
+ if (response.statusCode !== 200) {
264
+ throw new Error(`API call failed with ${response.statusCode}`);
265
+ }
266
+
267
+ LoggerProxy.log('getUserDesktopLoginConfig api success.', {
268
+ module: CONFIG_FILE_NAME,
269
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
270
+ });
271
+
272
+ return Promise.resolve(response.body);
273
+ } catch (error) {
274
+ LoggerProxy.error(`getUserDesktopLoginConfig API call failed with ${error}`, {
275
+ module: CONFIG_FILE_NAME,
276
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
277
+ });
278
+ throw error;
279
+ }
280
+ }
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Troubleshooting
286
+
287
+ ### Common Issues and Log Patterns
288
+
289
+ #### Issue: Profile incomplete or getAgentConfig fails
290
+
291
+ **Cause**: One of the parallel API calls failed (network error, 401/403/404/500 response)
292
+
293
+ **Log patterns to search for:**
294
+ ```typescript
295
+ // General config failure
296
+ "getAgentConfig call failed"
297
+ "module": "config/index.ts", "method": "getAgentConfig"
298
+
299
+ // Specific API method failures
300
+ "getUserDesktopLoginConfig API call failed"
301
+ "getOrgDesktopLoginConfig API call failed"
302
+ "getAllTeams API call failed"
303
+ "getAllAuxCodes API call failed"
304
+
305
+ // Look for HTTP error codes
306
+ "API call failed with 401" // Authentication
307
+ "API call failed with 403" // Authorization
308
+ "API call failed with 404" // Not found
309
+ "API call failed with 500" // Server error
310
+ ```
311
+
312
+ **Solution**:
313
+ 1. Check logs for specific API that failed
314
+ 2. Verify orgId and agentId are correct
315
+ 3. Ensure authentication tokens are valid
316
+ 4. Check network connectivity to WCC API Gateway
317
+
318
+ #### Issue: Empty teams or aux codes
319
+
320
+ **Cause**: Pagination not completing or filter parameters incorrect
321
+
322
+ **Log patterns:**
323
+ ```typescript
324
+ "getAllTeams API call failed"
325
+ "getAllAuxCodes API call failed"
326
+ "method": "getListOfTeams"
327
+ "method": "getListOfAuxCodes"
328
+ ```
329
+
330
+ **Solution**:
331
+ 1. Check `totalPages` in first response
332
+ 2. Verify the team filter carries a valid `userDbId` (`user.dbId`, not the CI user id) and that aux-code filters contain valid IDs
333
+ 3. Check if pageSize is appropriate (default: 100)
334
+ 4. Ensure all pages are fetched in Promise.all()
335
+
336
+ #### Issue: WebRTC or other features not enabled
337
+
338
+ **Cause**: Organization or tenant settings have feature disabled
339
+
340
+ **Log patterns:**
341
+ ```typescript
342
+ "getOrgDesktopLoginConfig api success."
343
+ "getUserDesktopLoginConfig api success."
344
+ ```
345
+
346
+ **Solution**:
347
+ 1. Check `orgSettingsData.webRtcEnabled` in response
348
+ 2. Check `tenantData.outdialEnabled` for outbound features
349
+ 3. Verify feature is enabled in admin portal settings
350
+ 4. Confirm agentProfileData has correct feature flags
351
+
352
+ #### Issue: Missing dial plan data
353
+
354
+ **Cause**: `dialPlanEnabled` is false in desktop profile
355
+
356
+ **Solution**:
357
+ 1. Check `agentProfileData.dialPlanEnabled` value
358
+ 2. Verify dial plans are assigned in agent profile configuration
359
+ 3. Note: dial plan fetch only happens if `dialPlanEnabled === true`
360
+
361
+ #### Issue: Expected auxiliary codes missing from the returned pool
362
+
363
+ **Log patterns:**
364
+ ```typescript
365
+ "method": "getFilterAuxCodes"
366
+ ```
367
+
368
+ **Solution**:
369
+ 1. `getFilterAuxCodes` no longer applies a per-agent restriction list — the full organization pool is returned for every agent
370
+ 2. `Profile.idleCodesAccess` / `wrapupCodesAccess` still report `ALL` or `SPECIFIC` from `agentProfileData`
371
+ 3. Ensure aux codes have `active: true` status and the expected `workTypeCode`
372
+ 4. Note: "Available" state is always appended to idle codes
373
+
374
+ ---
375
+
376
+ ## Types and Events
377
+
378
+ The config service defines comprehensive TypeScript types for all data structures. See [types.ts](../types.ts) for complete definitions.
379
+
380
+ ### Core Types
381
+
382
+ **Configuration Types:**
383
+ - `Profile` - Unified agent profile after aggregation
384
+ - `OrgDesktopLoginResponse` - Organization desktop-login aggregate
385
+ - `UserDesktopLoginResponse` - User desktop-login aggregate (`user` + `agentProfile`)
386
+ - `AgentResponse` - `user` section of the user aggregate
387
+ - `AgentProfile` - `agentProfile` section of the user aggregate
388
+ - `TeamList` - Team data with full details (id, name, teamType, siteId, multiMediaProfileId, etc.)
389
+ - `AuxCode` - Auxiliary code definition
390
+ - `Entity` - Filtered code entity (used for idle/wrapup codes in Profile)
391
+
392
+ **Organization Types:**
393
+ - `OrgInfo` - Organization metadata
394
+ - `OrgSettings` - Organization-level feature flags
395
+ - `TenantData` - Tenant configuration and feature enablement
396
+ - `SiteInfo` - Site-specific configuration
397
+
398
+ **Communication Types:**
399
+ - `DialPlanEntity` - Dial plan rule definition (includes `active`)
400
+ - `OrgUrlMappings` - Keyed external service URL mappings
401
+ - `MicrosoftConfig` / `WebexConfig` - Org-level presence configuration
402
+ - `MultimediaProfile` - Multimedia profile configuration
403
+
404
+ **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`.
405
+
406
+ ---
407
+
408
+ ## Related Files
409
+
410
+ - [index.ts](../index.ts) - Service implementation with all API methods
411
+ - [types.ts](../types.ts) - Complete type definitions and event constants
412
+ - [Util.ts](../Util.ts) - Profile parsing utilities (parseAgentConfigs, getFilterAuxCodes, etc.)
413
+ - [constants.ts](../constants.ts) - API endpoints, default values, and method names