@webex/contact-center 3.11.0 → 3.12.0-auth-prejoin-fetch.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 (325) hide show
  1. package/.sdd/manifest.json +883 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +50 -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 +48 -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 +359 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  19. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  20. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  21. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  22. package/ai-docs/patterns/testing-patterns.md +480 -0
  23. package/ai-docs/patterns/typescript-patterns.md +365 -0
  24. package/ai-docs/templates/README.md +102 -0
  25. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  26. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  27. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  28. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  29. package/ai-docs/templates/new-method/00-master.md +80 -0
  30. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  31. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  32. package/ai-docs/templates/new-method/03-tests.md +201 -0
  33. package/ai-docs/templates/new-method/04-validation.md +141 -0
  34. package/ai-docs/templates/new-service/00-master.md +109 -0
  35. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  36. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  37. package/ai-docs/templates/new-service/03-integration.md +178 -0
  38. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  39. package/ai-docs/templates/new-service/05-validation.md +145 -0
  40. package/dist/cc.js +818 -59
  41. package/dist/cc.js.map +1 -1
  42. package/dist/config.js +13 -0
  43. package/dist/config.js.map +1 -1
  44. package/dist/constants.js +31 -3
  45. package/dist/constants.js.map +1 -1
  46. package/dist/index.js +27 -5
  47. package/dist/index.js.map +1 -1
  48. package/dist/metrics/behavioral-events.js +127 -0
  49. package/dist/metrics/behavioral-events.js.map +1 -1
  50. package/dist/metrics/constants.js +34 -3
  51. package/dist/metrics/constants.js.map +1 -1
  52. package/dist/services/AddressBook.js +18 -15
  53. package/dist/services/AddressBook.js.map +1 -1
  54. package/dist/services/AnswerCallOnWebexService.js +174 -0
  55. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  56. package/dist/services/ApiAiAssistant.js +318 -0
  57. package/dist/services/ApiAiAssistant.js.map +1 -0
  58. package/dist/services/EntryPoint.js +46 -68
  59. package/dist/services/EntryPoint.js.map +1 -1
  60. package/dist/services/Queue.js +27 -22
  61. package/dist/services/Queue.js.map +1 -1
  62. package/dist/services/UserPreference.js +427 -0
  63. package/dist/services/UserPreference.js.map +1 -0
  64. package/dist/services/WebexCrossClientService.js +171 -0
  65. package/dist/services/WebexCrossClientService.js.map +1 -0
  66. package/dist/services/WxAppTelephonyMercurySync.js +93 -0
  67. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  68. package/dist/services/agent/types.js.map +1 -1
  69. package/dist/services/config/Util.js +11 -4
  70. package/dist/services/config/Util.js.map +1 -1
  71. package/dist/services/config/constants.js +45 -8
  72. package/dist/services/config/constants.js.map +1 -1
  73. package/dist/services/config/index.js +41 -2
  74. package/dist/services/config/index.js.map +1 -1
  75. package/dist/services/config/types.js +70 -8
  76. package/dist/services/config/types.js.map +1 -1
  77. package/dist/services/constants.js +27 -1
  78. package/dist/services/constants.js.map +1 -1
  79. package/dist/services/core/Err.js.map +1 -1
  80. package/dist/services/core/Utils.js +122 -25
  81. package/dist/services/core/Utils.js.map +1 -1
  82. package/dist/services/core/WebexRequest.js +6 -2
  83. package/dist/services/core/WebexRequest.js.map +1 -1
  84. package/dist/services/core/aqm-reqs.js +119 -30
  85. package/dist/services/core/aqm-reqs.js.map +1 -1
  86. package/dist/services/core/types.js.map +1 -1
  87. package/dist/services/core/websocket/WebSocketManager.js +22 -6
  88. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  89. package/dist/services/core/websocket/connection-service.js +3 -1
  90. package/dist/services/core/websocket/connection-service.js.map +1 -1
  91. package/dist/services/core/websocket/types.js.map +1 -1
  92. package/dist/services/index.js +6 -0
  93. package/dist/services/index.js.map +1 -1
  94. package/dist/services/task/Task.js +754 -0
  95. package/dist/services/task/Task.js.map +1 -0
  96. package/dist/services/task/TaskFactory.js +49 -0
  97. package/dist/services/task/TaskFactory.js.map +1 -0
  98. package/dist/services/task/TaskManager.js +1073 -447
  99. package/dist/services/task/TaskManager.js.map +1 -1
  100. package/dist/services/task/TaskUtils.js +220 -23
  101. package/dist/services/task/TaskUtils.js.map +1 -1
  102. package/dist/services/task/WebexCallingUtils.js +70 -0
  103. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  104. package/dist/services/task/constants.js +26 -2
  105. package/dist/services/task/constants.js.map +1 -1
  106. package/dist/services/task/contact.js +29 -0
  107. package/dist/services/task/contact.js.map +1 -1
  108. package/dist/services/task/dialer.js +129 -0
  109. package/dist/services/task/dialer.js.map +1 -1
  110. package/dist/services/task/digital/Digital.js +78 -0
  111. package/dist/services/task/digital/Digital.js.map +1 -0
  112. package/dist/services/task/state-machine/TaskStateMachine.js +971 -0
  113. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  114. package/dist/services/task/state-machine/actions.js +572 -0
  115. package/dist/services/task/state-machine/actions.js.map +1 -0
  116. package/dist/services/task/state-machine/constants.js +161 -0
  117. package/dist/services/task/state-machine/constants.js.map +1 -0
  118. package/dist/services/task/state-machine/guards.js +409 -0
  119. package/dist/services/task/state-machine/guards.js.map +1 -0
  120. package/dist/services/task/state-machine/index.js +53 -0
  121. package/dist/services/task/state-machine/index.js.map +1 -0
  122. package/dist/services/task/state-machine/types.js +54 -0
  123. package/dist/services/task/state-machine/types.js.map +1 -0
  124. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  125. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  126. package/dist/services/task/taskDataNormalizer.js +99 -0
  127. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  128. package/dist/services/task/types.js +243 -5
  129. package/dist/services/task/types.js.map +1 -1
  130. package/dist/services/task/voice/Voice.js +1380 -0
  131. package/dist/services/task/voice/Voice.js.map +1 -0
  132. package/dist/services/task/voice/WebRTC.js +152 -0
  133. package/dist/services/task/voice/WebRTC.js.map +1 -0
  134. package/dist/services/task/voice/wxAppVoiceMethods.js +201 -0
  135. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  136. package/dist/services/wxAppTelephonyUtils.js +19 -0
  137. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  138. package/dist/types/cc.d.ts +967 -0
  139. package/dist/types/config.d.ts +79 -0
  140. package/dist/types/constants.d.ts +74 -0
  141. package/dist/types/index.d.ts +201 -0
  142. package/dist/types/logger-proxy.d.ts +71 -0
  143. package/dist/types/metrics/MetricsManager.d.ts +223 -0
  144. package/dist/types/metrics/behavioral-events.d.ts +29 -0
  145. package/dist/types/metrics/constants.d.ts +183 -0
  146. package/dist/types/services/AddressBook.d.ts +75 -0
  147. package/dist/types/services/AnswerCallOnWebexService.d.ts +37 -0
  148. package/dist/types/services/ApiAiAssistant.d.ts +49 -0
  149. package/dist/types/services/EntryPoint.d.ts +69 -0
  150. package/dist/types/services/Queue.d.ts +78 -0
  151. package/dist/types/services/UserPreference.d.ts +118 -0
  152. package/dist/types/services/WebCallingService.d.ts +1 -0
  153. package/dist/types/services/WebexCrossClientService.d.ts +28 -0
  154. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  155. package/dist/types/services/agent/index.d.ts +46 -0
  156. package/dist/types/services/agent/types.d.ts +413 -0
  157. package/dist/types/services/config/Util.d.ts +20 -0
  158. package/dist/types/services/config/constants.d.ts +273 -0
  159. package/dist/types/services/config/index.d.ts +177 -0
  160. package/dist/types/services/config/types.d.ts +1381 -0
  161. package/dist/types/services/constants.d.ts +110 -0
  162. package/dist/types/services/core/Err.d.ts +127 -0
  163. package/dist/types/services/core/GlobalTypes.d.ts +58 -0
  164. package/dist/types/services/core/Utils.d.ts +121 -0
  165. package/dist/types/services/core/WebexRequest.d.ts +23 -0
  166. package/dist/types/services/core/aqm-reqs.d.ts +65 -0
  167. package/dist/types/services/core/constants.d.ts +99 -0
  168. package/dist/types/services/core/types.d.ts +49 -0
  169. package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
  170. package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
  171. package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
  172. package/dist/types/services/core/websocket/types.d.ts +37 -0
  173. package/dist/types/services/index.d.ts +54 -0
  174. package/dist/types/services/task/AutoWrapup.d.ts +40 -0
  175. package/dist/types/services/task/Task.d.ts +175 -0
  176. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  177. package/dist/types/services/task/TaskManager.d.ts +1 -0
  178. package/dist/types/services/task/TaskUtils.d.ts +138 -0
  179. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  180. package/dist/types/services/task/constants.d.ts +94 -0
  181. package/dist/types/services/task/contact.d.ts +73 -0
  182. package/dist/types/services/task/dialer.d.ts +73 -0
  183. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  184. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1398 -0
  185. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  186. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  187. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  188. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  189. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  190. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  191. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  192. package/dist/types/services/task/types.d.ts +1933 -0
  193. package/dist/types/services/task/voice/Voice.d.ts +223 -0
  194. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  195. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +52 -0
  196. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  197. package/dist/types/types.d.ts +784 -0
  198. package/dist/types/utils/PageCache.d.ts +190 -0
  199. package/dist/types/webex-config.d.ts +53 -0
  200. package/dist/types/webex.d.ts +8 -0
  201. package/dist/types.js +137 -3
  202. package/dist/types.js.map +1 -1
  203. package/dist/utils/PageCache.js +19 -5
  204. package/dist/utils/PageCache.js.map +1 -1
  205. package/dist/webex.js +14 -2
  206. package/dist/webex.js.map +1 -1
  207. package/package.json +16 -12
  208. package/src/cc.ts +983 -60
  209. package/src/config.ts +13 -0
  210. package/src/constants.ts +29 -1
  211. package/src/index.ts +26 -5
  212. package/src/metrics/ai-docs/AGENTS.md +350 -0
  213. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  214. package/src/metrics/ai-docs/metrics-spec.md +860 -0
  215. package/src/metrics/behavioral-events.ts +134 -0
  216. package/src/metrics/constants.ts +39 -3
  217. package/src/services/AddressBook.ts +17 -6
  218. package/src/services/AnswerCallOnWebexService.ts +206 -0
  219. package/src/services/ApiAiAssistant.ts +412 -0
  220. package/src/services/EntryPoint.ts +59 -60
  221. package/src/services/Queue.ts +29 -12
  222. package/src/services/UserPreference.ts +509 -0
  223. package/src/services/WebexCrossClientService.ts +212 -0
  224. package/src/services/WxAppTelephonyMercurySync.ts +115 -0
  225. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  226. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  227. package/src/services/agent/ai-docs/agent-spec.md +504 -0
  228. package/src/services/agent/types.ts +1 -1
  229. package/src/services/ai-docs/AGENTS.md +386 -0
  230. package/src/services/ai-docs/services-spec.md +497 -0
  231. package/src/services/config/Util.ts +13 -2
  232. package/src/services/config/ai-docs/AGENTS.md +255 -0
  233. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  234. package/src/services/config/ai-docs/config-spec.md +675 -0
  235. package/src/services/config/constants.ts +47 -7
  236. package/src/services/config/index.ts +45 -1
  237. package/src/services/config/types.ts +253 -11
  238. package/src/services/constants.ts +29 -0
  239. package/src/services/core/Err.ts +4 -0
  240. package/src/services/core/Utils.ts +143 -30
  241. package/src/services/core/WebexRequest.ts +3 -1
  242. package/src/services/core/ai-docs/AGENTS.md +381 -0
  243. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  244. package/src/services/core/ai-docs/core-spec.md +787 -0
  245. package/src/services/core/aqm-reqs.ts +125 -32
  246. package/src/services/core/types.ts +2 -0
  247. package/src/services/core/websocket/WebSocketManager.ts +23 -6
  248. package/src/services/core/websocket/connection-service.ts +5 -1
  249. package/src/services/core/websocket/types.ts +1 -1
  250. package/src/services/index.ts +4 -0
  251. package/src/services/task/Task.ts +908 -0
  252. package/src/services/task/TaskFactory.ts +60 -0
  253. package/src/services/task/TaskManager.ts +1291 -513
  254. package/src/services/task/TaskUtils.ts +314 -24
  255. package/src/services/task/WebexCallingUtils.ts +136 -0
  256. package/src/services/task/ai-docs/AGENTS.md +457 -0
  257. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  258. package/src/services/task/ai-docs/task-spec.md +1469 -0
  259. package/src/services/task/constants.ts +26 -0
  260. package/src/services/task/contact.ts +30 -0
  261. package/src/services/task/dialer.ts +136 -1
  262. package/src/services/task/digital/Digital.ts +97 -0
  263. package/src/services/task/state-machine/TaskStateMachine.ts +1313 -0
  264. package/src/services/task/state-machine/actions.ts +741 -0
  265. package/src/services/task/state-machine/ai-docs/AGENTS.md +462 -0
  266. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1146 -0
  267. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2209 -0
  268. package/src/services/task/state-machine/constants.ts +172 -0
  269. package/src/services/task/state-machine/guards.ts +498 -0
  270. package/src/services/task/state-machine/index.ts +28 -0
  271. package/src/services/task/state-machine/types.ts +258 -0
  272. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  273. package/src/services/task/taskDataNormalizer.ts +137 -0
  274. package/src/services/task/types.ts +843 -70
  275. package/src/services/task/voice/Voice.ts +1720 -0
  276. package/src/services/task/voice/WebRTC.ts +191 -0
  277. package/src/services/task/voice/wxAppVoiceMethods.ts +307 -0
  278. package/src/services/wxAppTelephonyUtils.ts +14 -0
  279. package/src/types.ts +238 -11
  280. package/src/utils/AGENTS.md +289 -0
  281. package/src/utils/PageCache.ts +38 -5
  282. package/src/utils/ai-docs/utils-spec.md +391 -0
  283. package/src/webex.js +2 -0
  284. package/test/unit/spec/cc.ts +1856 -122
  285. package/test/unit/spec/logger-proxy.ts +70 -0
  286. package/test/unit/spec/metrics/behavioral-events.ts +18 -0
  287. package/test/unit/spec/services/AddressBook.ts +37 -6
  288. package/test/unit/spec/services/AnswerCallOnWebexService.ts +223 -0
  289. package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
  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 +7 -1
  294. package/test/unit/spec/services/WebexCrossClientService.ts +261 -0
  295. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +113 -0
  296. package/test/unit/spec/services/config/Util.ts +85 -0
  297. package/test/unit/spec/services/config/index.ts +85 -29
  298. package/test/unit/spec/services/core/Utils.ts +481 -2
  299. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  300. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  301. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
  302. package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
  303. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  304. package/test/unit/spec/services/task/Task.ts +677 -0
  305. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  306. package/test/unit/spec/services/task/TaskManager.ts +2209 -918
  307. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  308. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  309. package/test/unit/spec/services/task/contact.ts +33 -0
  310. package/test/unit/spec/services/task/dialer.ts +372 -96
  311. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  312. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3433 -0
  313. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  314. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  315. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  316. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  317. package/test/unit/spec/services/task/voice/Voice.ts +1523 -0
  318. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  319. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +459 -0
  320. package/umd/contact-center.min.js +2 -2
  321. package/umd/contact-center.min.js.map +1 -1
  322. package/dist/services/task/index.js +0 -1525
  323. package/dist/services/task/index.js.map +0 -1
  324. package/src/services/task/index.ts +0 -1801
  325. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,967 @@
1
+ /**
2
+ * @module CCPlugin
3
+ * @packageDocumentation
4
+ * Contact Center Plugin module that provides functionality for managing contact center agents,
5
+ * handling tasks, and interacting with contact center services. This module enables integration
6
+ * with Webex Contact Center features through the WebexSDK.
7
+ */
8
+ import { WebexPlugin } from '@webex/webex-core';
9
+ import { SetStateResponse, IContactCenter, AgentLogin, AgentProfileUpdate, StationLoginResponse, StationLogoutResponse, BuddyAgentsResponse, BuddyAgents, UploadLogsResponse, UpdateDeviceTypeResponse } from './types';
10
+ import LoggerProxy from './logger-proxy';
11
+ import { StateChange, Logout } from './services/agent/types';
12
+ import { Profile, OutdialAniEntriesResponse, OutdialAniParams } from './services/config/types';
13
+ import { TaskResponse, PreviewContactPayload } from './services/task/types';
14
+ import { AddressBook } from './services/AddressBook';
15
+ import { Queue } from './services/Queue';
16
+ import { ApiAIAssistant } from './services/ApiAiAssistant';
17
+ import { UserPreference } from './services/UserPreference';
18
+ import type { EntryPointListResponse, EntryPointSearchParams, ContactServiceQueuesResponse, ContactServiceQueueSearchParams } from './types';
19
+ /**
20
+ * The main Contact Center plugin class that enables integration with Webex Contact Center.
21
+ *
22
+ * @class ContactCenter
23
+ * @extends WebexPlugin
24
+ * @implements IContactCenter
25
+ * @description
26
+ * Features:
27
+ *
28
+ * 1. Session Management:
29
+ * - {@link register} - Initialize and register SDK with contact center
30
+ * - {@link deregister} - Cleanup and disconnect SDK resources
31
+ *
32
+ * 2. Agent Login/Logout:
33
+ * - {@link stationLogin} - Login with browser or desk phone
34
+ * - {@link stationLogout} - Logout from current station
35
+ * - {@link updateAgentProfile} - Update device type and settings
36
+ *
37
+ * 3. Agent State Control:
38
+ * - {@link setAgentState} - Change agent state (Available/Idle)
39
+ *
40
+ * 4. Task Management:
41
+ * - Inbound task handling via events
42
+ * - {@link startOutdial} - Make outbound calls
43
+ *
44
+ * 5. Routing & Distribution:
45
+ * - {@link getQueues} - Get available queues for routing
46
+ * - {@link getBuddyAgents} - Get available buddy agents
47
+ *
48
+ * 6. Diagnostics:
49
+ * - {@link uploadLogs} - Upload logs for troubleshooting
50
+ *
51
+ * * Key Events:
52
+ * - Agent State Events:
53
+ * - `agent:stateChange` - Agent's state has changed (Available, Idle, etc.)
54
+ * - `agent:stateChangeSuccess` - Agent state change was successful
55
+ * - `agent:stateChangeFailed` - Agent state change failed
56
+ *
57
+ * - Session Events:
58
+ * - `agent:stationLoginSuccess` - Agent login was successful
59
+ * - `agent:stationLoginFailed` - Agent login failed
60
+ * - `agent:logoutSuccess` - Agent logout was successful
61
+ * - `agent:logoutFailed` - Agent logout failed
62
+ *
63
+ * - Task Events:
64
+ * - `task:incoming` - New task is being offered
65
+ * - `task:hydrate` - Task data has been updated
66
+ * - `task:established` - Task/call has been connected
67
+ * - `task:ended` - Task/call has ended
68
+ * - `task:error` - An error occurred during task handling
69
+ * - `task:campaignPreviewReservation` - Campaign preview contact offered to agent
70
+ *
71
+ * @public
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * import Webex from 'webex';
76
+ *
77
+ * // Initialize SDK with access token
78
+ * const webex = new Webex({
79
+ * credentials: 'YOUR_ACCESS_TOKEN'
80
+ * });
81
+ *
82
+ * // Get Contact Center plugin instance
83
+ * const cc = webex.cc;
84
+ *
85
+ * // Setup event handlers
86
+ * cc.on('agent:stateChange', (event) => {
87
+ * console.log('Agent state changed:', event.state);
88
+ * });
89
+ *
90
+ * cc.on('task:incoming', (task) => {
91
+ * console.log('New task received:', task.interactionId);
92
+ * });
93
+ *
94
+ * // Initialize agent session
95
+ * async function initializeAgent() {
96
+ * try {
97
+ * // Register with contact center
98
+ * const profile = await cc.register();
99
+ *
100
+ * // Login with browser-based calling
101
+ * await cc.stationLogin({
102
+ * teamId: profile.teams[0].teamId,
103
+ * loginOption: 'BROWSER'
104
+ * });
105
+ *
106
+ * // Set agent to Available state
107
+ * await cc.setAgentState({
108
+ * state: 'Available',
109
+ * auxCodeId: '0'
110
+ * });
111
+ *
112
+ * console.log('Agent initialized and ready');
113
+ * } catch (error) {
114
+ * console.error('Initialization failed:', error);
115
+ * await cc.uploadLogs(); // Upload logs for troubleshooting
116
+ * }
117
+ * }
118
+ *
119
+ * initializeAgent();
120
+ * ```
121
+ *
122
+ * @public
123
+ */
124
+ export default class ContactCenter extends WebexPlugin implements IContactCenter {
125
+ /**
126
+ * The plugin's unique namespace identifier in the Webex SDK.
127
+ * Used to access the plugin via webex.cc
128
+ * @type {string}
129
+ * @public
130
+ */
131
+ namespace: string;
132
+ /**
133
+ * Plugin configuration settings including connection and authentication options
134
+ * @type {CCPluginConfig}
135
+ * @private
136
+ */
137
+ private $config;
138
+ /**
139
+ * Reference to the parent Webex SDK instance
140
+ * Used to access core Webex functionality and credentials
141
+ * @type {WebexSDK}
142
+ * @private
143
+ */
144
+ private $webex;
145
+ /**
146
+ * Event emitter for handling internal plugin events
147
+ * Manages event subscriptions and notifications
148
+ * @type {EventEmitter}
149
+ * @private
150
+ */
151
+ private eventEmitter;
152
+ /**
153
+ * Agent's profile and configuration data
154
+ * Includes capabilities, teams, settings, and current state
155
+ * @type {Profile}
156
+ * @private
157
+ */
158
+ private agentConfig;
159
+ /**
160
+ * Service for managing browser-based calling (WebRTC)
161
+ * Handles audio/video streaming and device management
162
+ * @type {WebCallingService}
163
+ * @private
164
+ */
165
+ private webCallingService;
166
+ /**
167
+ * REST telephony for wxApp thick-client answer (WXCC-6026)
168
+ * @private
169
+ */
170
+ private answerCallOnWebexService;
171
+ /**
172
+ * usersub cross-client state for Webex App toast suppression
173
+ * @private
174
+ */
175
+ private webexCrossClientService;
176
+ /**
177
+ * Mercury telephony mute sync for wxApp thick-client answer
178
+ * @private
179
+ */
180
+ private wxAppTelephonyMercurySync;
181
+ /** True when wxApp mute sync opened Mercury (Extension/DN-only profiles). */
182
+ private wxAppMercuryConnectedByCc;
183
+ /** True when wxApp mute sync registered the Webex device. */
184
+ private wxAppDeviceRegisteredByCc;
185
+ private static readonly WXAPP_FALSE_PUBLISH_RETRY_DELAY_MS;
186
+ private static readonly WXAPP_FALSE_PUBLISH_MAX_RETRIES;
187
+ private wxAppFalsePublishRetryTimer?;
188
+ /**
189
+ * Core service managers for Contact Center operations
190
+ * Includes agent, connection, and configuration services
191
+ * @type {Services}
192
+ * @private
193
+ */
194
+ private services;
195
+ /**
196
+ * Service for making authenticated HTTP requests to Webex APIs
197
+ * Handles request/response lifecycle and error handling
198
+ * @type {WebexRequest}
199
+ * @private
200
+ */
201
+ private webexRequest;
202
+ /**
203
+ * Manager for handling contact center tasks (calls, chats, etc.)
204
+ * Coordinates task lifecycle events and state
205
+ * @type {TaskManager}
206
+ * @private
207
+ */
208
+ private taskManager;
209
+ /**
210
+ * Manager for tracking and reporting SDK metrics and analytics
211
+ * Monitors performance, errors, and usage patterns
212
+ * @type {MetricsManager}
213
+ * @private
214
+ */
215
+ private metricsManager;
216
+ /**
217
+ * API instance for managing Webex Contact Center entry points
218
+ * Provides functionality to fetch entry points with caching support
219
+ * @type {EntryPoint}
220
+ * @public
221
+ * @example
222
+ * ```typescript
223
+ * const cc = webex.cc;
224
+ * await cc.register();
225
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
226
+ *
227
+ * // Access EntryPointRecord
228
+ * const response = await cc.entryPoint.getEntryPoints({
229
+ * page: 0,
230
+ * pageSize: 50
231
+ * });
232
+ * ```
233
+ */
234
+ private entryPoint;
235
+ /**
236
+ * API instance for managing Webex Contact Center address book contacts
237
+ * Provides functionality to fetch address book entries with caching support
238
+ * @type {AddressBook}
239
+ * @public
240
+ * @example
241
+ * ```typescript
242
+ * const cc = webex.cc;
243
+ * await cc.register();
244
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
245
+ *
246
+ * // Access AddressBook API
247
+ * const response = await cc.addressBook.getEntries({
248
+ * page: 0,
249
+ * pageSize: 25
250
+ * });
251
+ * ```
252
+ */
253
+ addressBook: AddressBook;
254
+ /**
255
+ * API instance for managing Webex Contact Center queues
256
+ * Provides functionality to fetch queues with caching support
257
+ * @type {Queue}
258
+ * @public
259
+ * @example
260
+ * ```typescript
261
+ * const cc = webex.cc;
262
+ * await cc.register();
263
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
264
+ *
265
+ * // Access Queue API
266
+ * const response = await cc.queue.getQueues({
267
+ * page: 0,
268
+ * pageSize: 50
269
+ * });
270
+ *
271
+ * // Filter queues by specific criteria
272
+ * const filteredQueues = await cc.queue.getQueues({
273
+ * filter: 'id=="queue-id-123"'
274
+ * });
275
+ * ```
276
+ */
277
+ queue: Queue;
278
+ /**
279
+ * API instance for managing Webex Contact Center user preferences
280
+ * Provides functionality to get, create, update, and delete user preferences
281
+ * @type {UserPreference}
282
+ * @public
283
+ * @example
284
+ * ```typescript
285
+ * const cc = webex.cc;
286
+ * await cc.register();
287
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
288
+ *
289
+ * // Get user preferences for current user
290
+ * const preferences = await cc.userPreference.getUserPreference();
291
+ *
292
+ * // Create new user preferences
293
+ * const newPrefs = await cc.userPreference.createUserPreference({
294
+ * userId: 'user123',
295
+ * preferences: { e911Reminder: true }
296
+ * });
297
+ *
298
+ * // Update user preferences
299
+ * const updatedPrefs = await cc.userPreference.updateUserPreference('user123', {
300
+ * preferences: { e911Reminder: false }
301
+ * });
302
+ *
303
+ * // Delete user preferences
304
+ * await cc.userPreference.deleteUserPreference('user123');
305
+ * ```
306
+ */
307
+ userPreference: UserPreference;
308
+ /**
309
+ * API instance for AI Assistant operations such as transcript controls.
310
+ * @type {ApiAIAssistant}
311
+ * @public
312
+ */
313
+ apiAIAssistant: ApiAIAssistant;
314
+ /**
315
+ * Logger utility for Contact Center plugin
316
+ * Provides consistent logging across the plugin
317
+ * @type {LoggerProxy}
318
+ * @public
319
+ */
320
+ LoggerProxy: typeof LoggerProxy;
321
+ /**
322
+ * @ignore
323
+ * Creates an instance of ContactCenter plugin
324
+ * @param {any[]} args Arguments passed to plugin constructor
325
+ */
326
+ constructor(...args: any[]);
327
+ /**
328
+ * Handles incoming task events and triggers appropriate notifications
329
+ * @private
330
+ * @param {ITask} task The incoming task object containing task details
331
+ */
332
+ private handleIncomingTask;
333
+ /**
334
+ * Handles task hydration events for updating task data
335
+ * @private
336
+ * @param {ITask} task The task object to be hydrated with additional data
337
+ */
338
+ private handleTaskHydrate;
339
+ /**
340
+ * Handles multi-login hydrate events for SDK instances without Mobius registration
341
+ * @private
342
+ * @param {ITask} task The task object associated with the multi-login hydrate
343
+ */
344
+ private handleTaskMultiLoginHydrate;
345
+ /**
346
+ * Handles task merged events when tasks are combined eg: EPDN merge/transfer
347
+ * @private
348
+ * @param {ITask} task The task object that has been merged
349
+ */
350
+ private handleTaskMerged;
351
+ /**
352
+ * Handles campaign preview reservation events when a contact is offered to the agent
353
+ * @private
354
+ * @param {ITask} task The campaign reservation task
355
+ */
356
+ private handleCampaignPreviewReservation;
357
+ private handleRTDWebsocketMessage;
358
+ /**
359
+ * Sets up event listeners for incoming tasks and task hydration
360
+ * Subscribes to task events from the task manager
361
+ * @private
362
+ */
363
+ private incomingTaskListener;
364
+ /**
365
+ * Initializes the Contact Center SDK by setting up the web socket connections.
366
+ * This method must be called before performing any agent operations such as login, state change, or handling tasks.
367
+ *
368
+ * @returns {Promise<Profile>} Agent profile information after successful registration.
369
+ * The returned `Profile` object contains details such as:
370
+ * - `agentId`: The unique identifier for the agent.
371
+ * - `defaultDn`: The default dial number associated with the agent.
372
+ * - `teams`: Array of teams the agent belongs to.
373
+ * - `webRtcEnabled`: Indicates if WebRTC (browser calling) is enabled.
374
+ * - `loginVoiceOptions`: Supported login options for the agent (e.g., BROWSER, EXTENSION).
375
+ * - ...and other agent configuration details.
376
+ *
377
+ * @throws {Error} If registration fails.
378
+ *
379
+ * @public
380
+ * @example
381
+ * ```typescript
382
+ * import Webex from 'webex';
383
+ *
384
+ * const webex = Webex.init({ credentials: 'YOUR_ACCESS_TOKEN' });
385
+ * const cc = webex.cc;
386
+ *
387
+ * // Register the SDK and fetch agent profile
388
+ * const profile = await cc.register();
389
+ *
390
+ * console.log('Agent ID:', profile.agentId);
391
+ * console.log('Default DN:', profile.defaultDn);
392
+ * console.log('Teams:', profile.teams.map(t => t.teamId));
393
+ * console.log('WebRTC Enabled:', profile.webRtcEnabled);
394
+ * console.log('Supported Login Options:', profile.loginVoiceOptions);
395
+ *
396
+ * // Now you can proceed with station login, state changes, etc.
397
+ * await cc.stationLogin({ teamId: profile.teams[0].teamId, loginOption: 'BROWSER' });
398
+ * ```
399
+ */
400
+ register(): Promise<Profile>;
401
+ /**
402
+ * Unregisters the Contact Center SDK by closing all web socket connections, removing event listeners,
403
+ * and cleaning up internal state.
404
+ *
405
+ * @remarks
406
+ * This method only disconnects the SDK from the backend and cleans up resources. It does NOT perform a station logout
407
+ * (i.e., the agent remains logged in to the contact center unless you explicitly call {@link stationLogout}).
408
+ * Use this when you want to fully tear down the SDK instance, such as during application shutdown or user sign-out.
409
+ *
410
+ * @returns {Promise<void>} Resolves when deregistration and cleanup are complete.
411
+ * @throws {Error} If deregistration fails.
412
+ *
413
+ * @public
414
+ * @example
415
+ * // Typical usage: clean up SDK before application exit or user logout
416
+ * import Webex from 'webex';
417
+ *
418
+ * const webex = Webex.init({ credentials: 'YOUR_ACCESS_TOKEN' });
419
+ * const cc = webex.cc;
420
+ *
421
+ * await cc.register();
422
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
423
+ * // ... perform agent operations ...
424
+ *
425
+ * // If you want to log out the agent as well, call:
426
+ * // await cc.stationLogout({ logoutReason: 'User signed out' });
427
+ * // On application shutdown or user sign-out:
428
+ * await cc.deregister();
429
+ *
430
+
431
+ */
432
+ deregister(): Promise<void>;
433
+ /**
434
+ * Returns the list of buddy agents who are in the given user state and media type based on their agent profile settings
435
+ * @param {BuddyAgents} data The data required to fetch buddy agents
436
+ * @returns {Promise<BuddyAgentsResponse>} A promise resolving to the buddy agents information
437
+ * @throws {Error} If fetching buddy agents fails
438
+ * @example
439
+ * ```typescript
440
+ * // Get list of available agents for consultation or transfer
441
+ * const cc = webex.cc;
442
+ *
443
+ * // First ensure you're registered and logged in
444
+ * await cc.register();
445
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
446
+ *
447
+ * // Get buddy agents filtered by state and media type
448
+ * const response = await cc.getBuddyAgents({
449
+ * state: 'Available', // Filter by agent state ('Available', 'Idle', etc.)
450
+ * mediaType: 'telephony' // Filter by media type ('telephony', 'chat', 'email', 'social')
451
+ * });
452
+ *
453
+ * // Process the buddy agents list
454
+ * if (response.data.agentList.length > 0) {
455
+ * const buddyAgents = response.data.agentList;
456
+ * console.log(`Found ${buddyAgents.length} available agents`);
457
+ *
458
+ * // Access agent details
459
+ * buddyAgents.forEach(agent => {
460
+ * console.log(`Agent ID: ${agent.agentId}`);
461
+ * console.log(`Name: ${agent.firstName} ${agent.lastName}`);
462
+ * console.log(`State: ${agent.state}`);
463
+ * console.log(`Team: ${agent.teamName}`);
464
+ * });
465
+ * }
466
+ * ```
467
+ */
468
+ getBuddyAgents(data: BuddyAgents): Promise<BuddyAgentsResponse>;
469
+ /**
470
+ * Connects to the websocket and fetches the agent profile
471
+ * @returns {Promise<Profile>} Agent profile information
472
+ * @throws {Error} If connection fails or profile cannot be fetched
473
+ * @private
474
+ */
475
+ private connectWebsocket;
476
+ /**
477
+ * Performs agent login with specified credentials and device type
478
+ * @param {AgentLogin} data Login parameters including teamId, loginOption and dialNumber
479
+ * @returns {Promise<StationLoginResponse>} Response containing login status and profile
480
+ * @throws {Error} If login fails
481
+ * @public
482
+ * @example
483
+ * ```typescript
484
+ * const cc = webex.cc;
485
+ * await cc.register();
486
+ *
487
+ * // Primary usage: using Promise response
488
+ * try {
489
+ * const response = await cc.stationLogin({
490
+ * teamId: 'team123',
491
+ * loginOption: 'EXTENSION',
492
+ * dialNumber: '1002'
493
+ * });
494
+ * console.log('Login successful:', response);
495
+ * } catch (error) {
496
+ * console.error('Login failed:', error);
497
+ * }
498
+ *
499
+ * // Optional: Also listen for events elsewhere in your application
500
+ * // cc.on('agent:stationLoginSuccess', (data) => { ... });
501
+ * // cc.on('agent:stationLoginFailed', (error) => { ... });
502
+ * ```
503
+ */
504
+ stationLogin(data: AgentLogin): Promise<StationLoginResponse>;
505
+ /**
506
+ * Performs a station logout operation for the agent
507
+ * @remarks
508
+ * A logout operation cannot happen if the agent is in an interaction or haven't logged in yet.
509
+ * @param {Logout} data Logout parameters with logoutReason - a string explaining why the agent is logging out
510
+ * @returns {Promise<StationLogoutResponse>} Response indicating logout status
511
+ * @throws {Error} If logout fails
512
+ * @public
513
+ * @example
514
+ * ```typescript
515
+ * // Basic logout
516
+ * try {
517
+ * await cc.stationLogout({
518
+ * logoutReason: 'End of shift'
519
+ * });
520
+ * console.log('Logged out successfully');
521
+ * } catch (error) {
522
+ * console.error('Logout failed:', error);
523
+ * }
524
+ * ```
525
+ */
526
+ stationLogout(data: Logout): Promise<StationLogoutResponse>;
527
+ /**
528
+ * Gets the device ID based on login option and dial number
529
+ * @param {string} loginOption The login option (BROWSER, EXTENSION, etc)
530
+ * @param {string} dialNumber The dial number if applicable
531
+ * @returns {string} The device ID
532
+ * @private
533
+ */
534
+ private getDeviceId;
535
+ /**
536
+ * Sets the state of the agent to Available or any of the Idle states.
537
+ * After a state change attempt, one of the following events will be emitted:
538
+ * - agent:stateChange: Emitted when agent's state changes (triggered for both local and remote changes)
539
+ * - agent:stateChangeSuccess: Emitted when agent state change is successful
540
+ * - agent:stateChangeFailed: Emitted when agent state change attempt fails
541
+ *
542
+ * @param {StateChange} data State change parameters including the new state
543
+ * @returns {Promise<SetStateResponse>} Response with updated state information
544
+ * @throws {Error} If state change fails
545
+ * @public
546
+ * @example
547
+ * ```typescript
548
+ * const cc = webex.cc;
549
+ * await cc.register();
550
+ * await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });
551
+ *
552
+ * // Using promise-based approach
553
+ * try {
554
+ * await cc.setAgentState({
555
+ * state: 'Available',
556
+ * auxCodeId: '12345',
557
+ * lastStateChangeReason: 'Manual state change',
558
+ * agentId: 'agent123',
559
+ * });
560
+ * } catch (error) {
561
+ * console.error('State change failed:', error);
562
+ * }
563
+ *
564
+ * // Optionally, listen for events
565
+ * cc.on('agent:stateChange', (eventData) => {
566
+ * // Triggered for both local and remote state changes
567
+ * console.log('State changed:', eventData);
568
+ * });
569
+ *
570
+ * cc.on('agent:stateChangeSuccess', (eventData) => {
571
+ * console.log('State change succeeded:', eventData);
572
+ * });
573
+ *
574
+ * cc.on('agent:stateChangeFailed', (error) => {
575
+ * console.error('State change failed:', error);
576
+ * });
577
+ * ```
578
+ */
579
+ setAgentState(data: StateChange): Promise<SetStateResponse>;
580
+ /**
581
+ * Processes incoming websocket messages and emits corresponding events
582
+ * Handles various event types including agent state changes, login events,
583
+ * and other agent-related notifications
584
+ * @private
585
+ * @param {string} event The raw websocket event message
586
+ */
587
+ private handleWebsocketMessage;
588
+ /**
589
+ * Checks whether Mobius/WebRTC registration should be skipped by config
590
+ * @returns {boolean} True when browser WebRTC registration is disabled
591
+ * @private
592
+ */
593
+ private isWebRTCRegistrationDisabled;
594
+ /**
595
+ * Validates contact-center plugin configuration before service initialization
596
+ * @private
597
+ */
598
+ private validatePluginConfig;
599
+ /**
600
+ * Whether wxApp thick-client answer is enabled for this SDK instance.
601
+ * @public
602
+ */
603
+ isWxBetterTogetherEnabled(): boolean;
604
+ /**
605
+ * Current station login option (Extension, Dial Number, or Browser/Desktop).
606
+ * Prefer webCallingService — updated on every stationLogin before wxApp hooks run.
607
+ * @private
608
+ */
609
+ private getCurrentStationLoginOption;
610
+ /**
611
+ * wxApp thick-client answer is supported for Extension and Dial Number station login only —
612
+ * not Browser/Desktop (WebRTC) login.
613
+ * @private
614
+ */
615
+ private assertWxAppStationLoginSupportedForEnable;
616
+ /**
617
+ * Clears runtime wxApp config after logout/deregister so stale flags do not apply on relogin.
618
+ * @private
619
+ */
620
+ private resetEnableWxBetterTogetherConfig;
621
+ private ensureWxAppPostStationLogin;
622
+ private clearWxAppFalsePublishRetryTimer;
623
+ private scheduleForcedFalsePublishRetry;
624
+ /**
625
+ * Retries compensating false publish after rollback failure, regardless of enabled flag.
626
+ * @private
627
+ */
628
+ private scheduleCompensatingFalsePublishRetry;
629
+ private scheduleFalsePublishRetry;
630
+ /**
631
+ * Best-effort rollback when usersub true was published but wxApp setup did not complete.
632
+ * @private
633
+ */
634
+ private revertWxAppCrossClientPublish;
635
+ private ensureWxAppDeviceRegistered;
636
+ private ensureWxAppMercuryConnected;
637
+ /**
638
+ * Disconnects Mercury and unregisters the device when wxApp mute sync opened them.
639
+ * @private
640
+ */
641
+ private releaseWxAppMercuryResources;
642
+ /**
643
+ * Clears wxApp runtime state and feature-owned resources. Publish failures are logged;
644
+ * optional rethrow for deregister when callers need to surface usersub errors.
645
+ * @private
646
+ */
647
+ private teardownWxAppLocalState;
648
+ private ensureWxAppMercuryAndSubscribe;
649
+ private publishAnswerOnWebexCrossClientState;
650
+ /**
651
+ * Initializes event listeners for the Contact Center service
652
+ * Sets up handlers for connection state changes and other core events
653
+ * @private
654
+ */
655
+ private setupEventListeners;
656
+ /**
657
+ * Returns the connection configuration
658
+ * @returns {SubscribeRequest} Connection configuration
659
+ * @private
660
+ */
661
+ private getConnectionConfig;
662
+ /**
663
+ * Handles connection lost events and reconnection attempts
664
+ * @param {ConnectionLostDetails} msg Connection lost details
665
+ * @private
666
+ */
667
+ private handleConnectionLost;
668
+ /**
669
+ * Handles silent relogin after registration completion
670
+ * @private
671
+ */
672
+ private silentRelogin;
673
+ /**
674
+ * Handles device type specific configuration and setup
675
+ * Configures services and settings based on the login device type
676
+ * @param {LoginOption} deviceType The type of device being used for login
677
+ * @param {string} dn The dial number associated with the device
678
+ * @returns {Promise<void>}
679
+ * @private
680
+ */
681
+ private handleDeviceType;
682
+ /**
683
+ * Makes an outbound call to a specified phone number.
684
+ *
685
+ * @param {string} destination - The phone number to dial (e.g., '+1234567890').
686
+ * @param {string} origin - The contact center number that will be used while making a call to the customer.
687
+ * Should include country code and be in E.164 format.
688
+ * @returns {Promise<TaskResponse>} Resolves with the task response containing:
689
+ * - interactionId: Unique identifier for the outbound call
690
+ * - taskId: Identifier for the task instance
691
+ * - data: Task details including state, queue info, and media properties
692
+ * @throws {Error} If the outdial operation fails:
693
+ * - "Agent not configured for outbound calls" if isOutboundEnabledForAgent is false
694
+ * - "Invalid phone number format" if destination is not in E.164 format
695
+ * - "Agent not in Available state" if agent's state is not Available
696
+ * @public
697
+ * @example
698
+ * ```typescript
699
+ * // Initialize and prepare agent
700
+ * const cc = webex.cc;
701
+ * await cc.register();
702
+ * await cc.stationLogin({
703
+ * teamId: 'team123',
704
+ * loginOption: 'BROWSER'
705
+ * });
706
+ *
707
+ * // Set Available state before outbound call
708
+ * await cc.setAgentState({
709
+ * state: 'Available',
710
+ * auxCodeId: '0'
711
+ * });
712
+ *
713
+ * // Make outbound call with full error handling
714
+ * try {
715
+ * // Verify agent is properly configured for outdial
716
+ * if (!cc.agentConfig.isOutboundEnabledForAgent) {
717
+ * throw new Error('Agent not configured for outbound calls');
718
+ * }
719
+ *
720
+ * // Start the outbound call
721
+ * const destination = '+1234567890';
722
+ * const task = await cc.startOutdial(destination, origin);
723
+ *
724
+ * // Listen for all relevant task events
725
+ * task.on('task:ringing', () => {
726
+ * console.log('Call is ringing');
727
+ * updateCallStatus('Ringing...');
728
+ * });
729
+ *
730
+ * task.on('task:established', () => {
731
+ * console.log('Call connected');
732
+ * updateCallStatus('Connected');
733
+ * enableCallControls(); // Show mute, hold, transfer buttons
734
+ * });
735
+ *
736
+ * task.on('task:hold', () => {
737
+ * console.log('Call placed on hold');
738
+ * updateCallStatus('On Hold');
739
+ * });
740
+ *
741
+ * task.on('task:error', (error) => {
742
+ * console.error('Call error:', error);
743
+ * updateCallStatus('Error');
744
+ * showErrorDialog(error.message);
745
+ * });
746
+ *
747
+ * task.on('task:ended', () => {
748
+ * console.log('Call ended');
749
+ * updateCallStatus('Call Ended');
750
+ * resetCallControls();
751
+ *
752
+ * // Handle wrap-up if required
753
+ * if (task.data.wrapUpRequired) {
754
+ * showWrapupForm();
755
+ * }
756
+ * });
757
+ *
758
+ * // Example call control usage
759
+ * function handleMuteToggle() {
760
+ * await task.toggleMute();
761
+ * }
762
+ *
763
+ * function handleHoldToggle() {
764
+ * if (task.data.isOnHold) {
765
+ * await task.resume();
766
+ * } else {
767
+ * await task.hold();
768
+ * }
769
+ * }
770
+ *
771
+ * async function handleTransfer() {
772
+ * // Get available queues for transfer
773
+ * const queues = await cc.getQueues();
774
+ *
775
+ * // Transfer to first available queue
776
+ * if (queues.length > 0) {
777
+ * await task.transfer({
778
+ * to: queues[0].queueId,
779
+ * destinationType: 'QUEUE'
780
+ * });
781
+ * }
782
+ * }
783
+ *
784
+ * } catch (error) {
785
+ * console.error('Outdial failed:', error);
786
+ * showErrorNotification('Failed to place call: ' + error.message);
787
+ * }
788
+ * ```
789
+ */
790
+ startOutdial(destination: string, origin: string): Promise<TaskResponse>;
791
+ /**
792
+ * Accepts a campaign preview contact, initiating the outbound call.
793
+ *
794
+ * When a campaign manager reserves a contact for an agent, the agent receives an
795
+ * `AgentOfferCampaignReservation` event. The agent can then accept the preview contact
796
+ * to initiate the outbound call.
797
+ *
798
+ * @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
799
+ * @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
800
+ * @throws {Error} If the operation fails (network error, customer unavailable, etc.)
801
+ *
802
+ * @example
803
+ * ```typescript
804
+ * webex.cc.on('task:campaignPreviewReservation', async (task) => {
805
+ * const { interactionId } = task.data;
806
+ * // campaignId is the campaign name (e.g. "MyCampaign"), not a UUID
807
+ * const campaignId = task.data.interaction.callProcessingDetails.campaignId;
808
+ *
809
+ * const result = await webex.cc.acceptPreviewContact({ interactionId, campaignId });
810
+ * });
811
+ * ```
812
+ */
813
+ acceptPreviewContact(payload: PreviewContactPayload): Promise<TaskResponse>;
814
+ /**
815
+ * Skips a campaign preview contact, requesting the next contact from the campaign.
816
+ *
817
+ * When a campaign manager reserves a contact for an agent, the agent receives an
818
+ * `AgentOfferCampaignReservation` event. Instead of accepting, the agent can skip the
819
+ * preview contact to move to the next contact in the campaign.
820
+ *
821
+ * @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
822
+ * @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
823
+ * @throws {Error} If the operation fails (network error, etc.)
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * webex.cc.on('task:campaignPreviewReservation', async (task) => {
828
+ * const { interactionId } = task.data;
829
+ * const campaignId = task.data.interaction.callProcessingDetails.campaignId;
830
+ *
831
+ * const result = await webex.cc.skipPreviewContact({ interactionId, campaignId });
832
+ * });
833
+ * ```
834
+ */
835
+ skipPreviewContact(payload: PreviewContactPayload): Promise<TaskResponse>;
836
+ /**
837
+ * Removes a campaign preview contact from the campaign list entirely.
838
+ *
839
+ * When a campaign manager reserves a contact for an agent, the agent receives an
840
+ * `AgentOfferCampaignReservation` event. Instead of accepting or skipping, the agent can
841
+ * remove the preview contact to permanently take it out of the campaign contact list.
842
+ *
843
+ * @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
844
+ * @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
845
+ * @throws {Error} If the operation fails (network error, etc.)
846
+ *
847
+ * @example
848
+ * ```typescript
849
+ * webex.cc.on('task:campaignPreviewReservation', async (task) => {
850
+ * const { interactionId } = task.data;
851
+ * const campaignId = task.data.interaction.callProcessingDetails.campaignId;
852
+ *
853
+ * const result = await webex.cc.removePreviewContact({ interactionId, campaignId });
854
+ * });
855
+ * ```
856
+ */
857
+ removePreviewContact(payload: PreviewContactPayload): Promise<TaskResponse>;
858
+ /**
859
+ * Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
860
+ *
861
+ * This method retrieves the list of phone numbers that can be used as caller ID when making
862
+ * outbound calls. The ANI data is associated with an outdial ANI ID and can be filtered
863
+ * and paginated as needed.
864
+ *
865
+ * @param {string} outdialANI - The outdial ANI ID to fetch ANI data for
866
+ * @param {number} [page] - Optional page number for pagination (0-based)
867
+ * @param {number} [pageSize] - Optional number of items per page
868
+ * @param {string} [search] - Optional search term to filter results by name or number
869
+ * @param {string} [filter] - Optional filter string
870
+ * @param {string} [attributes] - Optional attributes to include in response
871
+ * @returns {Promise<OutdialAniEntriesResponse>} Promise resolving to outdial ANI response containing:
872
+ * - data: Array of ANI entries with number and name
873
+ * - meta: Pagination metadata
874
+ * @throws {Error} If the operation fails or agent is not registered
875
+ * @public
876
+ * @example
877
+ * ```typescript
878
+ * const cc = webex.cc;
879
+ * await cc.register();
880
+ *
881
+ * // Get agent profile to obtain outdial ANI ID
882
+ * const agentProfile = cc.agentConfig;
883
+ * const outdialANI = agentProfile.outdialANIId;
884
+ *
885
+ * // Basic usage - get all ANI data for an outdial ANI ID
886
+ * const aniData = await cc.getOutdialAniEntries({ outdialANI });
887
+ *
888
+ * // With pagination and search
889
+ * const paginatedAni = await cc.getOutdialAniEntries({
890
+ * outdialANI,
891
+ * page: 0,
892
+ * pageSize: 50,
893
+ * search: '555' // search for numbers containing '555'
894
+ * });
895
+ *
896
+ * // Process the results
897
+ * paginatedAni.forEach(ani => {
898
+ * console.log(`ANI: ${ani.number} - ${ani.name}`);
899
+ * });
900
+ * ```
901
+ */
902
+ getOutdialAniEntries(params: OutdialAniParams): Promise<OutdialAniEntriesResponse>;
903
+ /**
904
+ * Uploads logs to help troubleshoot SDK issues.
905
+ *
906
+ * This method collects the current SDK logs including network requests, WebSocket
907
+ * messages, and client-side events, then securely submits them to Webex's diagnostics
908
+ * service. The returned tracking ID, feedbackID can be provided to Webex support for faster
909
+ * issue resolution.
910
+ * @returns Promise<UploadLogsResponse> Resolves with the upload logs response
911
+ * @throws Error If the upload fails
912
+ * @public
913
+ * @example
914
+ * ```typescript
915
+ * const cc = webex.cc;
916
+ * try {
917
+ * await cc.register();
918
+ * } catch (error) {
919
+ * console.error('Error:', error);
920
+ * const result = await cc.uploadLogs();
921
+ * console.log('Logs uploaded. Tracking ID:', result.trackingId);
922
+ * }
923
+ * ```
924
+ */
925
+ uploadLogs(): Promise<UploadLogsResponse>;
926
+ /**
927
+ * Updates the agent device type and login configuration.
928
+ * Use this method to change how an agent connects to the contact center system (e.g., switching from browser-based calling to a desk phone extension).
929
+ * Change to any field of the profile is allowed;
930
+ *
931
+ * @param {AgentDeviceUpdate} data Configuration containing:
932
+ * - loginOption: New device type ('BROWSER', 'EXTENSION', 'AGENT_DN')
933
+ * - dialNumber: Required phone number when using EXTENSION or AGENT_DN
934
+ * - teamId: Optional team ID (defaults to current team if not specified)
935
+ * @returns Promise<UpdateDeviceTypeResponse> Resolves with the device type update response
936
+ * @throws Error If the update fails
937
+ * @example
938
+ * ```typescript
939
+ * const cc = webex.cc;
940
+ *
941
+ * // Switch from browser to extension
942
+ * try {
943
+ * await cc.updateAgentProfile({
944
+ * loginOption: 'EXTENSION',
945
+ * dialNumber: '1234', // Required for EXTENSION
946
+ * teamId: 'currentTeam' // Optional: uses current team if not specified
947
+ * });
948
+ * } catch (error) {
949
+ * console.error('Failed to update device:', error.message);
950
+ * }
951
+ * ```
952
+ * @public
953
+ */
954
+ updateAgentProfile(data: AgentProfileUpdate): Promise<UpdateDeviceTypeResponse>;
955
+ /**
956
+ * Returns paginated entry points using the EntryPoint service defaults.
957
+ * Existing request parameters can override those defaults.
958
+ * @public
959
+ */
960
+ getEntryPoints(params?: EntryPointSearchParams): Promise<EntryPointListResponse>;
961
+ /**
962
+ * Returns paginated contact service queues using the Queue service defaults.
963
+ * Existing request parameters can override those defaults.
964
+ * @public
965
+ */
966
+ getQueues(params?: ContactServiceQueueSearchParams): Promise<ContactServiceQueuesResponse>;
967
+ }