@webex/contact-center 3.12.0-next.16 → 3.12.0-next.160

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
@@ -6,13 +6,9 @@
6
6
  import {HTTP_METHODS} from '../../types';
7
7
  import LoggerProxy from '../../logger-proxy';
8
8
  import {
9
- DesktopProfileResponse,
10
9
  ListAuxCodesResponse,
11
- AgentResponse,
12
- TenantData,
13
- OrgInfo,
14
- OrgSettings,
15
- URLMapping,
10
+ OrgDesktopLoginResponse,
11
+ UserDesktopLoginResponse,
16
12
  TeamList,
17
13
  DialPlanEntity,
18
14
  Profile,
@@ -22,7 +18,7 @@ import {
22
18
  SiteInfo,
23
19
  OutdialAniEntriesResponse,
24
20
  OutdialAniParams,
25
- AIFeatureFlagsResponse,
21
+ Entity,
26
22
  } from './types';
27
23
  import WebexRequest from '../core/WebexRequest';
28
24
  import {WCC_API_GATEWAY} from '../constants';
@@ -34,6 +30,7 @@ import {
34
30
  DEFAULT_PAGE_SIZE,
35
31
  endPointMap,
36
32
  METHODS,
33
+ WELLBEING_BREAK_IDLE_CODE,
37
34
  } from './constants';
38
35
 
39
36
  /**
@@ -57,12 +54,8 @@ export default class AgentConfigService {
57
54
  */
58
55
  public async getAgentConfig(orgId: string, agentId: string): Promise<Profile> {
59
56
  try {
60
- const userConfigPromise = this.getUserUsingCI(orgId, agentId);
61
- const orgInfoPromise = this.getOrgInfo(orgId);
62
- const orgSettingsPromise = this.getOrganizationSetting(orgId);
63
- const tenantDataPromise = this.getTenantData(orgId);
64
- const urlMappingPromise = this.getURLMapping(orgId);
65
- const aiFeatureFlagsPromise = this.getAIFeatureFlags(orgId);
57
+ const orgConfigPromise = this.getOrgDesktopLoginConfig(orgId);
58
+ const userConfigPromise = this.getUserDesktopLoginConfig(orgId, agentId);
66
59
  const auxCodesPromise = this.getAllAuxCodes(
67
60
  orgId,
68
61
  DEFAULT_PAGE_SIZE,
@@ -70,50 +63,24 @@ export default class AgentConfigService {
70
63
  DEFAULT_AUXCODE_ATTRIBUTES
71
64
  );
72
65
 
73
- const userConfigData = await userConfigPromise;
74
- LoggerProxy.info(`Fetched user data, userId: ${userConfigData.ciUserId}`, {
66
+ const userConfig = await userConfigPromise;
67
+ const {user: userData, agentProfile: agentProfileData} = userConfig;
68
+ LoggerProxy.info(`Fetched user data, userId: ${userData.ciUserId}`, {
75
69
  module: CONFIG_FILE_NAME,
76
70
  method: METHODS.GET_AGENT_CONFIG,
77
71
  });
78
72
 
79
- const agentProfilePromise = this.getDesktopProfileById(orgId, userConfigData.agentProfileId);
80
- const siteInfoPromise = this.getSiteInfo(orgId, userConfigData.siteId);
81
-
82
- const userDialPlanPromise = agentProfilePromise.then((agentProfileConfigData) =>
83
- agentProfileConfigData.dialPlanEnabled ? this.getDialPlanData(orgId) : []
84
- );
85
-
86
- const userTeamPromise = userConfigData.teamIds
87
- ? this.getAllTeams(orgId, DEFAULT_PAGE_SIZE, userConfigData.teamIds)
73
+ const siteInfoPromise = this.getSiteInfo(orgId, userData.siteId);
74
+ const userTeamPromise = this.getAllTeams(orgId, DEFAULT_PAGE_SIZE, userData.dbId);
75
+ const userDialPlanPromise = agentProfileData.dialPlanEnabled
76
+ ? this.getDialPlanData(orgId)
88
77
  : Promise.resolve([]);
89
78
 
90
- const [
91
- agentProfileConfigData,
92
- siteInfo,
93
- userDialPlanData,
94
- userTeamData,
95
- orgInfo,
96
- orgSettingsData,
97
- tenantData,
98
- urlMappingData,
99
- aiFeatureFlagsData,
100
- auxCodesData,
101
- ] = await Promise.all([
102
- agentProfilePromise,
103
- siteInfoPromise,
104
- userDialPlanPromise,
105
- userTeamPromise,
106
- orgInfoPromise,
107
- orgSettingsPromise,
108
- tenantDataPromise,
109
- urlMappingPromise,
110
- aiFeatureFlagsPromise,
111
- auxCodesPromise,
112
- ]);
79
+ const [siteInfo, userDialPlanData, userTeamData, orgConfig, auxCodesData] = await Promise.all(
80
+ [siteInfoPromise, userDialPlanPromise, userTeamPromise, orgConfigPromise, auxCodesPromise]
81
+ );
113
82
  const multimediaProfileId =
114
- userConfigData.multimediaProfileId ||
115
- userTeamData[0]?.multiMediaProfileId ||
116
- siteInfo.multimediaProfileId;
83
+ userTeamData[0]?.multiMediaProfileId || siteInfo.multimediaProfileId;
117
84
 
118
85
  LoggerProxy.info('Fetched all required data', {
119
86
  module: CONFIG_FILE_NAME,
@@ -121,17 +88,13 @@ export default class AgentConfigService {
121
88
  });
122
89
 
123
90
  const response = parseAgentConfigs({
124
- userData: userConfigData,
91
+ orgConfig,
92
+ userData,
93
+ agentProfileData,
125
94
  teamData: userTeamData,
126
- tenantData,
127
- orgInfoData: orgInfo,
128
95
  auxCodes: auxCodesData,
129
- orgSettingsData,
130
- agentProfileData: agentProfileConfigData,
131
96
  dialPlanData: userDialPlanData,
132
- urlMapping: urlMappingData,
133
97
  multimediaProfileId,
134
- aiFeatureFlags: aiFeatureFlagsData,
135
98
  });
136
99
 
137
100
  LoggerProxy.info('Parsing completed for agent-config', {
@@ -154,22 +117,21 @@ export default class AgentConfigService {
154
117
  }
155
118
 
156
119
  /**
157
- * Fetches the agent configuration data for the given orgId and agentId.
120
+ * Fetches the aggregated organization desktop-login configuration for the given orgId.
158
121
  * @ignore
159
- * @param {string} orgId - organization ID for which the agent configuration is to be fetched.
160
- * @param {string} agentId - agent ID for which the configuration is to be fetched.
161
- * @returns {Promise<AgentResponse>} - A promise that resolves to the agent configuration response.
122
+ * @param {string} orgId - organization ID for which the configuration is to be fetched.
123
+ * @returns {Promise<OrgDesktopLoginResponse>} - A promise that resolves to the organization configuration.
162
124
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
163
125
  * @private
164
126
  */
165
- public async getUserUsingCI(orgId: string, agentId: string): Promise<AgentResponse> {
166
- LoggerProxy.info('Fetching user data using CI', {
127
+ public async getOrgDesktopLoginConfig(orgId: string): Promise<OrgDesktopLoginResponse> {
128
+ LoggerProxy.info('Fetching organization desktop-login configuration', {
167
129
  module: CONFIG_FILE_NAME,
168
- method: METHODS.GET_USER_USING_CI,
130
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
169
131
  });
170
132
 
171
133
  try {
172
- const resource = endPointMap.userByCI(orgId, agentId);
134
+ const resource = endPointMap.orgDesktopLogin(orgId);
173
135
  const response = await this.webexReq.request({
174
136
  service: WCC_API_GATEWAY,
175
137
  resource,
@@ -180,41 +142,41 @@ export default class AgentConfigService {
180
142
  throw new Error(`API call failed with ${response.statusCode}`);
181
143
  }
182
144
 
183
- LoggerProxy.log('getUserUsingCI api success.', {
145
+ LoggerProxy.log('getOrgDesktopLoginConfig api success.', {
184
146
  module: CONFIG_FILE_NAME,
185
- method: METHODS.GET_USER_USING_CI,
147
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
186
148
  });
187
149
 
188
150
  return Promise.resolve(response.body);
189
151
  } catch (error) {
190
- LoggerProxy.error(`getUserUsingCI API call failed with ${error}`, {
152
+ LoggerProxy.error(`getOrgDesktopLoginConfig API call failed with ${error}`, {
191
153
  module: CONFIG_FILE_NAME,
192
- method: METHODS.GET_USER_USING_CI,
154
+ method: METHODS.GET_ORG_DESKTOP_LOGIN_CONFIG,
193
155
  });
194
156
  throw error;
195
157
  }
196
158
  }
197
159
 
198
160
  /**
199
- * Fetches the desktop profile data for the given orgId and desktopProfileId.
161
+ * Fetches the aggregated user desktop-login configuration for the given orgId and ciUserId.
200
162
  * @ignore
201
- * @param {string} orgId - organization ID for which the desktop profile is to be fetched.
202
- * @param {string} desktopProfileId - desktop profile ID for which the data is to be fetched.
203
- * @returns {Promise<DesktopProfileResponse>} - A promise that resolves to the desktop profile response.
163
+ * @param {string} orgId - organization ID for which the configuration is to be fetched.
164
+ * @param {string} ciUserId - CI user ID of the agent whose configuration is to be fetched.
165
+ * @returns {Promise<UserDesktopLoginResponse>} - A promise that resolves to the user configuration.
204
166
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
205
167
  * @private
206
168
  */
207
- public async getDesktopProfileById(
169
+ public async getUserDesktopLoginConfig(
208
170
  orgId: string,
209
- desktopProfileId: string
210
- ): Promise<DesktopProfileResponse> {
211
- LoggerProxy.info('Fetching desktop profile', {
171
+ ciUserId: string
172
+ ): Promise<UserDesktopLoginResponse> {
173
+ LoggerProxy.info('Fetching user desktop-login configuration', {
212
174
  module: CONFIG_FILE_NAME,
213
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
175
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
214
176
  });
215
177
 
216
178
  try {
217
- const resource = endPointMap.desktopProfile(orgId, desktopProfileId);
179
+ const resource = endPointMap.userDesktopLogin(orgId, ciUserId);
218
180
  const response = await this.webexReq.request({
219
181
  service: WCC_API_GATEWAY,
220
182
  resource,
@@ -225,16 +187,16 @@ export default class AgentConfigService {
225
187
  throw new Error(`API call failed with ${response.statusCode}`);
226
188
  }
227
189
 
228
- LoggerProxy.log('getDesktopProfileById api success.', {
190
+ LoggerProxy.log('getUserDesktopLoginConfig api success.', {
229
191
  module: CONFIG_FILE_NAME,
230
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
192
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
231
193
  });
232
194
 
233
195
  return Promise.resolve(response.body);
234
196
  } catch (error) {
235
- LoggerProxy.error(`getDesktopProfileById API call failed with ${error}`, {
197
+ LoggerProxy.error(`getUserDesktopLoginConfig API call failed with ${error}`, {
236
198
  module: CONFIG_FILE_NAME,
237
- method: METHODS.GET_DESKTOP_PROFILE_BY_ID,
199
+ method: METHODS.GET_USER_DESKTOP_LOGIN_CONFIG,
238
200
  });
239
201
  throw error;
240
202
  }
@@ -286,13 +248,12 @@ export default class AgentConfigService {
286
248
  }
287
249
 
288
250
  /**
289
- * fetches the list of teams for the given orgId.
251
+ * fetches the list of teams the given user belongs to.
290
252
  * @ignore
291
253
  * @param {string} orgId - organization ID for which the teams are to be fetched.
292
254
  * @param {number} page - the page number to fetch.
293
255
  * @param {number} pageSize - the number of teams to fetch per page.
294
- * @param {string[]} filter - optional filter criteria for the teams.
295
- * @param {string[]} attributes - optional attributes to include in the response.
256
+ * @param {string} userDbId - database ID of the user whose teams are to be fetched.
296
257
  * @returns {Promise<ListTeamsResponse>} - A promise that resolves to the list of teams response.
297
258
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
298
259
  * @private
@@ -301,7 +262,7 @@ export default class AgentConfigService {
301
262
  orgId: string,
302
263
  page: number,
303
264
  pageSize: number,
304
- filter: string[]
265
+ userDbId: string
305
266
  ): Promise<ListTeamsResponse> {
306
267
  LoggerProxy.info('Fetching list of teams', {
307
268
  module: CONFIG_FILE_NAME,
@@ -309,7 +270,7 @@ export default class AgentConfigService {
309
270
  });
310
271
 
311
272
  try {
312
- const resource = endPointMap.listTeams(orgId, page, pageSize, filter);
273
+ const resource = endPointMap.listTeams(orgId, page, pageSize, userDbId);
313
274
  const response = await this.webexReq.request({
314
275
  service: WCC_API_GATEWAY,
315
276
  resource,
@@ -336,26 +297,25 @@ export default class AgentConfigService {
336
297
  }
337
298
 
338
299
  /**
339
- * Fetches all teams from all pages for the given orgId
300
+ * Fetches all teams the given user belongs to, from all pages
340
301
  * @ignore
341
302
  * @param {string} orgId - organization ID for which the teams are to be fetched.
342
303
  * @param {number} pageSize - the number of teams to fetch per page.
343
- * @param {string[]} filter - optional filter criteria for the teams.
344
- * @param {string[]} attributes - optional attributes to include in the response.
304
+ * @param {string} userDbId - database ID of the user whose teams are to be fetched.
345
305
  * @returns {Promise<TeamList[]>} - A promise that resolves to the list of teams.
346
306
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
347
307
  * @private
348
308
  */
349
- public async getAllTeams(orgId: string, pageSize: number, filter: string[]): Promise<TeamList[]> {
309
+ public async getAllTeams(orgId: string, pageSize: number, userDbId: string): Promise<TeamList[]> {
350
310
  try {
351
311
  let allTeams: TeamList[] = [];
352
312
  let page = DEFAULT_PAGE;
353
- const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
313
+ const firstResponse = await this.getListOfTeams(orgId, page, pageSize, userDbId);
354
314
  const totalPages = firstResponse.meta.totalPages;
355
315
  allTeams = allTeams.concat(firstResponse.data);
356
316
  const requests = [];
357
317
  for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
358
- requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
318
+ requests.push(this.getListOfTeams(orgId, page, pageSize, userDbId));
359
319
  }
360
320
  const responses = await Promise.all(requests);
361
321
 
@@ -471,205 +431,84 @@ export default class AgentConfigService {
471
431
  }
472
432
 
473
433
  /**
474
- * Fetches the site data for the given orgId and siteId.
475
- * @ignore
476
- * @param {string} orgId - organization ID for which the site info is to be fetched.
477
- * @param {string} siteId - site ID for which the data is to be fetched.
478
- * @returns {Promise<SiteInfo>} - A promise that resolves to the site info response.
479
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
480
- * @private
434
+ * Retrieves the exact system-managed WellbeingBreak idle code.
435
+ * This query intentionally bypasses Desktop Profile filtering so the system code does not
436
+ * need to appear in the normal agent-selectable idle-code list.
437
+ * @param orgId - Organization identifier
438
+ * @returns The normalized WellbeingBreak entity
439
+ * @throws When the request fails or the exact system code is unavailable
440
+ * @internal
481
441
  */
482
- public async getSiteInfo(orgId: string, siteId: string): Promise<SiteInfo> {
483
- LoggerProxy.info('Fetching site information', {
442
+ public async getWellbeingBreakIdleCode(orgId: string): Promise<Entity> {
443
+ LoggerProxy.info('Fetching WellbeingBreak system idle code', {
484
444
  module: CONFIG_FILE_NAME,
485
- method: METHODS.GET_SITE_INFO,
445
+ method: METHODS.GET_WELLBEING_BREAK_IDLE_CODE,
486
446
  });
487
- try {
488
- const resource = endPointMap.siteInfo(orgId, siteId);
489
- const response = await this.webexReq.request({
490
- service: WCC_API_GATEWAY,
491
- resource,
492
- method: HTTP_METHODS.GET,
493
- });
494
-
495
- if (response.statusCode !== 200) {
496
- throw new Error(`API call failed with ${response.statusCode}`);
497
- }
498
-
499
- LoggerProxy.log('getSiteInfo api success.', {
500
- module: CONFIG_FILE_NAME,
501
- method: METHODS.GET_SITE_INFO,
502
- });
503
-
504
- return Promise.resolve(response.body);
505
- } catch (error) {
506
- LoggerProxy.error(`getSiteInfo API call failed with ${error}`, {
507
- module: CONFIG_FILE_NAME,
508
- method: METHODS.GET_SITE_INFO,
509
- });
510
- throw error;
511
- }
512
- }
513
447
 
514
- /**
515
- * Fetches the organization info for the given orgId.
516
- * @ignore
517
- * @param {string} orgId - organization ID for which the organization info is to be fetched.
518
- * @returns {Promise<OrgInfo>} - A promise that resolves to the organization info response.
519
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
520
- * @private
521
- */
522
- public async getOrgInfo(orgId: string): Promise<OrgInfo> {
523
448
  try {
524
- const resource = endPointMap.orgInfo(orgId);
525
- const response = await this.webexReq.request({
526
- service: WCC_API_GATEWAY,
527
- resource,
528
- method: HTTP_METHODS.GET,
529
- });
530
-
531
- if (response.statusCode !== 200) {
532
- throw new Error(`API call failed with ${response.statusCode}`);
533
- }
534
-
535
- LoggerProxy.log('getOrgInfo api success.', {
536
- module: CONFIG_FILE_NAME,
537
- method: METHODS.GET_ORG_INFO,
538
- });
539
-
540
- return Promise.resolve(response.body);
541
- } catch (error) {
542
- LoggerProxy.error(`getOrgInfo API call failed with ${error}`, {
543
- module: CONFIG_FILE_NAME,
544
- method: METHODS.GET_ORG_INFO,
545
- });
546
- throw error;
547
- }
548
- }
549
-
550
- /**
551
- * Fetches the organization settings for the given orgId.
552
- * @ignore
553
- * @param {string} orgId - organization ID for which the organization settings are to be fetched.
554
- * @returns {Promise<OrgSettings>} - A promise that resolves to the organization settings response.
555
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
556
- * @private
557
- */
558
- public async getOrganizationSetting(orgId: string): Promise<OrgSettings> {
559
- try {
560
- const resource = endPointMap.orgSettings(orgId);
561
- const response = await this.webexReq.request({
562
- service: WCC_API_GATEWAY,
563
- resource,
564
- method: HTTP_METHODS.GET,
565
- });
566
-
567
- if (response.statusCode !== 200) {
568
- throw new Error(`API call failed with ${response.statusCode}`);
569
- }
570
-
571
- LoggerProxy.log('getOrganizationSetting api success.', {
572
- module: CONFIG_FILE_NAME,
573
- method: METHODS.GET_ORGANIZATION_SETTING,
574
- });
575
-
576
- return Promise.resolve(response.body.data[0]);
577
- } catch (error) {
578
- LoggerProxy.error(`getOrganizationSetting API call failed with ${error}`, {
579
- module: CONFIG_FILE_NAME,
580
- method: METHODS.GET_ORGANIZATION_SETTING,
581
- });
582
- throw error;
583
- }
584
- }
585
-
586
- /**
587
- * Fetches the tenant data for the given orgId.
588
- * @ignore
589
- * @param {string} orgId - organization ID for which the tenant data is to be fetched.
590
- * @returns {Promise<TenantData>} - A promise that resolves to the tenant data response.
591
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
592
- * @private
593
- */
594
- public async getTenantData(orgId: string): Promise<TenantData> {
595
- try {
596
- const resource = endPointMap.tenantData(orgId);
597
- const response = await this.webexReq.request({
598
- service: WCC_API_GATEWAY,
599
- resource,
600
- method: HTTP_METHODS.GET,
601
- });
602
-
603
- if (response.statusCode !== 200) {
604
- throw new Error(`API call failed with ${response.statusCode}`);
605
- }
606
-
607
- LoggerProxy.log('getTenantData api success.', {
608
- module: CONFIG_FILE_NAME,
609
- method: METHODS.GET_TENANT_DATA,
610
- });
611
-
612
- return Promise.resolve(response.body.data[0]);
613
- } catch (error) {
614
- LoggerProxy.error(`getTenantData API call failed with ${error}`, {
615
- module: CONFIG_FILE_NAME,
616
- method: METHODS.GET_TENANT_DATA,
617
- });
618
- throw error;
619
- }
620
- }
621
-
622
- /**
623
- * Fetches the URL mapping data for the given orgId.
624
- * @ignore
625
- * @param {string} orgId - organization ID for which the URL mapping is to be fetched.
626
- * @returns {Promise<URLMapping[]>} - A promise that resolves to the URL mapping response.
627
- * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
628
- * @private
629
- */
630
- public async getURLMapping(orgId: string): Promise<URLMapping[]> {
631
- try {
632
- const resource = endPointMap.urlMapping(orgId);
633
- const response = await this.webexReq.request({
634
- service: WCC_API_GATEWAY,
635
- resource,
636
- method: HTTP_METHODS.GET,
637
- });
638
-
639
- if (response.statusCode !== 200) {
640
- throw new Error(`API call failed with ${response.statusCode}`);
641
- }
642
-
643
- LoggerProxy.log('getURLMapping api success.', {
644
- module: CONFIG_FILE_NAME,
645
- method: METHODS.GET_URL_MAPPING,
646
- });
647
-
648
- return Promise.resolve(response.body.data);
449
+ let page = DEFAULT_PAGE;
450
+ let totalPages = 1;
451
+
452
+ do {
453
+ // Pagination is intentionally sequential so the lookup can stop as soon as the code is found.
454
+ // eslint-disable-next-line no-await-in-loop
455
+ const response = await this.webexReq.request({
456
+ service: WCC_API_GATEWAY,
457
+ resource: endPointMap.systemIdleCodes(orgId, page, DEFAULT_PAGE_SIZE),
458
+ method: HTTP_METHODS.GET,
459
+ });
460
+
461
+ if (response.statusCode !== 200) {
462
+ throw new Error(`API call failed with ${response.statusCode}`);
463
+ }
464
+
465
+ const result = response.body as ListAuxCodesResponse;
466
+ const wellbeingCode = result.data?.find(
467
+ (code) =>
468
+ code.active === true &&
469
+ code.isSystemCode === true &&
470
+ code.name === WELLBEING_BREAK_IDLE_CODE
471
+ );
472
+
473
+ if (wellbeingCode) {
474
+ return {
475
+ id: wellbeingCode.id,
476
+ name: wellbeingCode.name,
477
+ isSystem: true,
478
+ isDefault: wellbeingCode.defaultCode,
479
+ };
480
+ }
481
+
482
+ totalPages = result.meta?.totalPages ?? 1;
483
+ page += 1;
484
+ } while (page < totalPages);
485
+
486
+ throw new Error('WELLBEING_BREAK_IDLE_CODE_NOT_FOUND');
649
487
  } catch (error) {
650
- LoggerProxy.error(`getURLMapping API call failed with ${error}`, {
488
+ LoggerProxy.error(`getWellbeingBreakIdleCode API call failed with ${error}`, {
651
489
  module: CONFIG_FILE_NAME,
652
- method: METHODS.GET_URL_MAPPING,
490
+ method: METHODS.GET_WELLBEING_BREAK_IDLE_CODE,
653
491
  });
654
492
  throw error;
655
493
  }
656
494
  }
657
495
 
658
496
  /**
659
- * Fetches AI feature resources for the organization.
497
+ * Fetches the site data for the given orgId and siteId.
660
498
  * @ignore
661
- * @param {string} orgId - organization ID for which AI feature resources are to be fetched.
662
- * @returns {Promise<AIFeatureFlagsResponse>} - AI feature resources response.
499
+ * @param {string} orgId - organization ID for which the site info is to be fetched.
500
+ * @param {string} siteId - site ID for which the data is to be fetched.
501
+ * @returns {Promise<SiteInfo>} - A promise that resolves to the site info response.
663
502
  * @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
664
503
  * @private
665
504
  */
666
- public async getAIFeatureFlags(orgId: string): Promise<AIFeatureFlagsResponse> {
667
- LoggerProxy.info('Fetching AI feature resources', {
505
+ public async getSiteInfo(orgId: string, siteId: string): Promise<SiteInfo> {
506
+ LoggerProxy.info('Fetching site information', {
668
507
  module: CONFIG_FILE_NAME,
669
- method: METHODS.GET_AI_FEATURE_FLAGS,
508
+ method: METHODS.GET_SITE_INFO,
670
509
  });
671
510
  try {
672
- const resource = endPointMap.aiFeature(orgId);
511
+ const resource = endPointMap.siteInfo(orgId, siteId);
673
512
  const response = await this.webexReq.request({
674
513
  service: WCC_API_GATEWAY,
675
514
  resource,
@@ -680,16 +519,16 @@ export default class AgentConfigService {
680
519
  throw new Error(`API call failed with ${response.statusCode}`);
681
520
  }
682
521
 
683
- LoggerProxy.log('getAIFeatureFlags api success.', {
522
+ LoggerProxy.log('getSiteInfo api success.', {
684
523
  module: CONFIG_FILE_NAME,
685
- method: METHODS.GET_AI_FEATURE_FLAGS,
524
+ method: METHODS.GET_SITE_INFO,
686
525
  });
687
526
 
688
527
  return Promise.resolve(response.body);
689
528
  } catch (error) {
690
- LoggerProxy.error(`getAIFeatureFlags API call failed with ${error}`, {
529
+ LoggerProxy.error(`getSiteInfo API call failed with ${error}`, {
691
530
  module: CONFIG_FILE_NAME,
692
- method: METHODS.GET_AI_FEATURE_FLAGS,
531
+ method: METHODS.GET_SITE_INFO,
693
532
  });
694
533
  throw error;
695
534
  }