@webex/contact-center 3.12.0-next.12 → 3.12.0-next.121

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 (307) hide show
  1. package/.sdd/manifest.json +884 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +51 -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 +808 -40
  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 +27 -3
  45. package/dist/constants.js.map +1 -1
  46. package/dist/index.js +20 -5
  47. package/dist/index.js.map +1 -1
  48. package/dist/metrics/MetricsManager.js +16 -0
  49. package/dist/metrics/MetricsManager.js.map +1 -1
  50. package/dist/metrics/behavioral-events.js +205 -0
  51. package/dist/metrics/behavioral-events.js.map +1 -1
  52. package/dist/metrics/constants.js +43 -4
  53. package/dist/metrics/constants.js.map +1 -1
  54. package/dist/services/AddressBook.js +18 -15
  55. package/dist/services/AddressBook.js.map +1 -1
  56. package/dist/services/AnswerCallOnWebexService.js +202 -0
  57. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  58. package/dist/services/ApiAiAssistant.js +153 -8
  59. package/dist/services/ApiAiAssistant.js.map +1 -1
  60. package/dist/services/EntryPoint.js +46 -68
  61. package/dist/services/EntryPoint.js.map +1 -1
  62. package/dist/services/Queue.js +27 -22
  63. package/dist/services/Queue.js.map +1 -1
  64. package/dist/services/UserPreference.js +427 -0
  65. package/dist/services/UserPreference.js.map +1 -0
  66. package/dist/services/WebexCrossClientService.js +222 -0
  67. package/dist/services/WebexCrossClientService.js.map +1 -0
  68. package/dist/services/WxAppTelephonyMercurySync.js +108 -0
  69. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  70. package/dist/services/config/Util.js +6 -3
  71. package/dist/services/config/Util.js.map +1 -1
  72. package/dist/services/config/constants.js +33 -8
  73. package/dist/services/config/constants.js.map +1 -1
  74. package/dist/services/config/types.js +53 -9
  75. package/dist/services/config/types.js.map +1 -1
  76. package/dist/services/core/Err.js.map +1 -1
  77. package/dist/services/core/Utils.js +107 -32
  78. package/dist/services/core/Utils.js.map +1 -1
  79. package/dist/services/core/WebexRequest.js +6 -2
  80. package/dist/services/core/WebexRequest.js.map +1 -1
  81. package/dist/services/core/aqm-reqs.js +28 -14
  82. package/dist/services/core/aqm-reqs.js.map +1 -1
  83. package/dist/services/core/types.js.map +1 -1
  84. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  85. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  86. package/dist/services/core/websocket/types.js.map +1 -1
  87. package/dist/services/index.js +1 -1
  88. package/dist/services/index.js.map +1 -1
  89. package/dist/services/task/Task.js +754 -0
  90. package/dist/services/task/Task.js.map +1 -0
  91. package/dist/services/task/TaskFactory.js +49 -0
  92. package/dist/services/task/TaskFactory.js.map +1 -0
  93. package/dist/services/task/TaskManager.js +1053 -520
  94. package/dist/services/task/TaskManager.js.map +1 -1
  95. package/dist/services/task/TaskUtils.js +211 -27
  96. package/dist/services/task/TaskUtils.js.map +1 -1
  97. package/dist/services/task/WebexCallingUtils.js +70 -0
  98. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  99. package/dist/services/task/constants.js +12 -2
  100. package/dist/services/task/constants.js.map +1 -1
  101. package/dist/services/task/contact.js +29 -0
  102. package/dist/services/task/contact.js.map +1 -1
  103. package/dist/services/task/dialer.js +78 -0
  104. package/dist/services/task/dialer.js.map +1 -1
  105. package/dist/services/task/digital/Digital.js +78 -0
  106. package/dist/services/task/digital/Digital.js.map +1 -0
  107. package/dist/services/task/state-machine/TaskStateMachine.js +954 -0
  108. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  109. package/dist/services/task/state-machine/actions.js +572 -0
  110. package/dist/services/task/state-machine/actions.js.map +1 -0
  111. package/dist/services/task/state-machine/constants.js +161 -0
  112. package/dist/services/task/state-machine/constants.js.map +1 -0
  113. package/dist/services/task/state-machine/guards.js +379 -0
  114. package/dist/services/task/state-machine/guards.js.map +1 -0
  115. package/dist/services/task/state-machine/index.js +53 -0
  116. package/dist/services/task/state-machine/index.js.map +1 -0
  117. package/dist/services/task/state-machine/types.js +54 -0
  118. package/dist/services/task/state-machine/types.js.map +1 -0
  119. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  120. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  121. package/dist/services/task/taskDataNormalizer.js +99 -0
  122. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  123. package/dist/services/task/types.js +228 -5
  124. package/dist/services/task/types.js.map +1 -1
  125. package/dist/services/task/voice/Voice.js +1447 -0
  126. package/dist/services/task/voice/Voice.js.map +1 -0
  127. package/dist/services/task/voice/WebRTC.js +152 -0
  128. package/dist/services/task/voice/WebRTC.js.map +1 -0
  129. package/dist/services/task/voice/wxAppVoiceMethods.js +354 -0
  130. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  131. package/dist/services/wxAppDiagnosticLogging.js +122 -0
  132. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  133. package/dist/services/wxAppTelephonyUtils.js +19 -0
  134. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  135. package/dist/types/cc.d.ts +172 -5
  136. package/dist/types/config.d.ts +13 -0
  137. package/dist/types/constants.d.ts +25 -1
  138. package/dist/types/index.d.ts +24 -7
  139. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  140. package/dist/types/metrics/constants.d.ts +38 -1
  141. package/dist/types/services/AddressBook.d.ts +2 -1
  142. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  143. package/dist/types/services/ApiAiAssistant.d.ts +22 -4
  144. package/dist/types/services/EntryPoint.d.ts +7 -5
  145. package/dist/types/services/Queue.d.ts +5 -3
  146. package/dist/types/services/UserPreference.d.ts +118 -0
  147. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  148. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  149. package/dist/types/services/config/constants.d.ts +29 -5
  150. package/dist/types/services/config/types.d.ts +184 -10
  151. package/dist/types/services/core/Err.d.ts +6 -0
  152. package/dist/types/services/core/Utils.d.ts +33 -13
  153. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  154. package/dist/types/services/core/types.d.ts +2 -0
  155. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  156. package/dist/types/services/core/websocket/types.d.ts +1 -1
  157. package/dist/types/services/index.d.ts +1 -1
  158. package/dist/types/services/task/Task.d.ts +175 -0
  159. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  160. package/dist/types/services/task/TaskUtils.d.ts +48 -2
  161. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  162. package/dist/types/services/task/constants.d.ts +10 -0
  163. package/dist/types/services/task/contact.d.ts +4 -0
  164. package/dist/types/services/task/dialer.d.ts +30 -0
  165. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  166. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1356 -0
  167. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  168. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  169. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  170. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  171. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  172. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  173. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  174. package/dist/types/services/task/types.d.ts +680 -66
  175. package/dist/types/services/task/voice/Voice.d.ts +227 -0
  176. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  177. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +55 -0
  178. package/dist/types/services/wxAppDiagnosticLogging.d.ts +51 -0
  179. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  180. package/dist/types/types.d.ts +149 -8
  181. package/dist/types/utils/PageCache.d.ts +20 -3
  182. package/dist/types/webex.d.ts +1 -0
  183. package/dist/types.js +125 -4
  184. package/dist/types.js.map +1 -1
  185. package/dist/utils/PageCache.js +19 -5
  186. package/dist/utils/PageCache.js.map +1 -1
  187. package/dist/webex.js +14 -2
  188. package/dist/webex.js.map +1 -1
  189. package/package.json +16 -12
  190. package/src/cc.ts +986 -42
  191. package/src/config.ts +13 -0
  192. package/src/constants.ts +25 -1
  193. package/src/index.ts +25 -5
  194. package/src/metrics/MetricsManager.ts +16 -0
  195. package/src/metrics/ai-docs/AGENTS.md +350 -0
  196. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  197. package/src/metrics/ai-docs/metrics-spec.md +922 -0
  198. package/src/metrics/behavioral-events.ts +212 -0
  199. package/src/metrics/constants.ts +47 -4
  200. package/src/services/AddressBook.ts +17 -6
  201. package/src/services/AnswerCallOnWebexService.ts +239 -0
  202. package/src/services/ApiAiAssistant.ts +203 -8
  203. package/src/services/EntryPoint.ts +59 -60
  204. package/src/services/Queue.ts +29 -12
  205. package/src/services/UserPreference.ts +509 -0
  206. package/src/services/WebexCrossClientService.ts +293 -0
  207. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  208. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  209. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  210. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  211. package/src/services/ai-docs/AGENTS.md +386 -0
  212. package/src/services/ai-docs/services-spec.md +497 -0
  213. package/src/services/config/Util.ts +6 -3
  214. package/src/services/config/ai-docs/AGENTS.md +255 -0
  215. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  216. package/src/services/config/ai-docs/config-spec.md +675 -0
  217. package/src/services/config/constants.ts +35 -7
  218. package/src/services/config/types.ts +186 -11
  219. package/src/services/core/Err.ts +3 -0
  220. package/src/services/core/Utils.ts +123 -37
  221. package/src/services/core/WebexRequest.ts +3 -1
  222. package/src/services/core/ai-docs/AGENTS.md +381 -0
  223. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  224. package/src/services/core/ai-docs/core-spec.md +787 -0
  225. package/src/services/core/aqm-reqs.ts +30 -15
  226. package/src/services/core/types.ts +2 -0
  227. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  228. package/src/services/core/websocket/types.ts +1 -1
  229. package/src/services/index.ts +1 -1
  230. package/src/services/task/Task.ts +908 -0
  231. package/src/services/task/TaskFactory.ts +60 -0
  232. package/src/services/task/TaskManager.ts +1239 -608
  233. package/src/services/task/TaskUtils.ts +303 -25
  234. package/src/services/task/WebexCallingUtils.ts +136 -0
  235. package/src/services/task/ai-docs/AGENTS.md +457 -0
  236. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  237. package/src/services/task/ai-docs/task-spec.md +1470 -0
  238. package/src/services/task/constants.ts +10 -0
  239. package/src/services/task/contact.ts +30 -0
  240. package/src/services/task/dialer.ts +80 -0
  241. package/src/services/task/digital/Digital.ts +97 -0
  242. package/src/services/task/state-machine/TaskStateMachine.ts +1293 -0
  243. package/src/services/task/state-machine/actions.ts +741 -0
  244. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  245. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1145 -0
  246. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2207 -0
  247. package/src/services/task/state-machine/constants.ts +172 -0
  248. package/src/services/task/state-machine/guards.ts +442 -0
  249. package/src/services/task/state-machine/index.ts +28 -0
  250. package/src/services/task/state-machine/types.ts +258 -0
  251. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  252. package/src/services/task/taskDataNormalizer.ts +137 -0
  253. package/src/services/task/types.ts +819 -70
  254. package/src/services/task/voice/Voice.ts +1809 -0
  255. package/src/services/task/voice/WebRTC.ts +191 -0
  256. package/src/services/task/voice/wxAppVoiceMethods.ts +516 -0
  257. package/src/services/wxAppDiagnosticLogging.ts +174 -0
  258. package/src/services/wxAppTelephonyUtils.ts +14 -0
  259. package/src/types.ts +199 -11
  260. package/src/utils/AGENTS.md +289 -0
  261. package/src/utils/PageCache.ts +38 -5
  262. package/src/utils/ai-docs/utils-spec.md +391 -0
  263. package/src/webex.js +2 -0
  264. package/test/unit/spec/cc.ts +1947 -124
  265. package/test/unit/spec/logger-proxy.ts +70 -0
  266. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  267. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  268. package/test/unit/spec/services/AddressBook.ts +37 -6
  269. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  270. package/test/unit/spec/services/ApiAiAssistant.ts +178 -20
  271. package/test/unit/spec/services/EntryPoint.ts +87 -40
  272. package/test/unit/spec/services/Queue.ts +123 -12
  273. package/test/unit/spec/services/UserPreference.ts +401 -0
  274. package/test/unit/spec/services/WebCallingService.ts +7 -1
  275. package/test/unit/spec/services/WebexCrossClientService.ts +467 -0
  276. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  277. package/test/unit/spec/services/config/Util.ts +85 -0
  278. package/test/unit/spec/services/config/index.ts +30 -30
  279. package/test/unit/spec/services/core/Utils.ts +425 -8
  280. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  281. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  282. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  283. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  284. package/test/unit/spec/services/task/Task.ts +677 -0
  285. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  286. package/test/unit/spec/services/task/TaskManager.ts +1972 -1549
  287. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  288. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  289. package/test/unit/spec/services/task/contact.ts +33 -0
  290. package/test/unit/spec/services/task/dialer.ts +190 -0
  291. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  292. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3459 -0
  293. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  294. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  295. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  296. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  297. package/test/unit/spec/services/task/voice/Voice.ts +1903 -0
  298. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  299. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +603 -0
  300. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +143 -0
  301. package/umd/contact-center.min.js +2 -2
  302. package/umd/contact-center.min.js.map +1 -1
  303. package/dist/services/task/index.js +0 -1525
  304. package/dist/services/task/index.js.map +0 -1
  305. package/dist/types/services/task/index.d.ts +0 -650
  306. package/src/services/task/index.ts +0 -1801
  307. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,174 @@
1
+ import LoggerProxy from '../logger-proxy';
2
+
3
+ export const WXAPP_LOG_FEATURE = 'wxApp';
4
+ export const WXAPP_LOG_PREFIX = '[CC wxApp]';
5
+
6
+ export type WxAppAcceptReason =
7
+ | 'wxApp_offer_ready'
8
+ | 'wxApp_answer_pending'
9
+ | 'wxApp_accept_in_flight'
10
+ | 'extension_non_wxApp_offer'
11
+ | 'browser_webrtc_offer'
12
+ | 'outdial_auto_answer';
13
+
14
+ export type WxAppSessionSkipReason =
15
+ | 'unsupported_browser_login'
16
+ | 'flag_disabled'
17
+ | 'mercury_subscribe_failed'
18
+ | 'publish_failed';
19
+
20
+ export type WxAppTelephonyAction = 'accept' | 'decline' | 'mute' | 'dtmf';
21
+ export type WxAppTelephonyPhase = 'started' | 'success' | 'failed';
22
+
23
+ type WxAppLogData = Record<string, string | boolean | number | undefined>;
24
+
25
+ /** Last 8 chars of callId for correlation without logging full id. */
26
+ export function callIdSuffix(callId: string | null | undefined): string | undefined {
27
+ if (!callId) {
28
+ return undefined;
29
+ }
30
+
31
+ return callId.length <= 8 ? callId : callId.slice(-8);
32
+ }
33
+
34
+ function logWxApp(message: string, method: string, data: WxAppLogData): void {
35
+ LoggerProxy.info(`${WXAPP_LOG_PREFIX} ${message}`, {
36
+ module: 'wxAppDiagnosticLogging',
37
+ method,
38
+ data: {feature: WXAPP_LOG_FEATURE, ...data},
39
+ });
40
+ }
41
+
42
+ function logWxAppError(message: string, method: string, data: WxAppLogData): void {
43
+ LoggerProxy.error(`${WXAPP_LOG_PREFIX} ${message}`, {
44
+ module: 'wxAppDiagnosticLogging',
45
+ method,
46
+ data: {feature: WXAPP_LOG_FEATURE, ...data},
47
+ });
48
+ }
49
+
50
+ export function logWxAppSessionReadiness(params: {
51
+ enableWxBetterTogether: boolean;
52
+ loginOption: string | undefined;
53
+ wxAppHooksApplied: boolean;
54
+ usersubPublished: boolean;
55
+ mercurySubscribed: boolean;
56
+ telephonyTaskType: 'Voice' | 'WebRTC' | 'unknown';
57
+ skipReason?: WxAppSessionSkipReason;
58
+ }): void {
59
+ logWxApp('session readiness', 'logWxAppSessionReadiness', {
60
+ event: 'session_readiness',
61
+ enableWxBetterTogether: params.enableWxBetterTogether,
62
+ loginOption: params.loginOption,
63
+ wxAppHooksApplied: params.wxAppHooksApplied,
64
+ usersubPublished: params.usersubPublished,
65
+ mercurySubscribed: params.mercurySubscribed,
66
+ telephonyTaskType: params.telephonyTaskType,
67
+ skipReason: params.skipReason,
68
+ });
69
+ }
70
+
71
+ export function deriveWxAppAcceptReason(params: {
72
+ isWxAppInboundOffer: boolean;
73
+ isWxAppOutdialOffer: boolean;
74
+ isWebrtc: boolean;
75
+ isOutdial: boolean;
76
+ wxAppAcceptInFlight: boolean;
77
+ wxAppAnswerPending: boolean;
78
+ enableWxBetterTogether: boolean;
79
+ hasDeviceCallId: boolean;
80
+ }): WxAppAcceptReason {
81
+ if (params.isWxAppInboundOffer || params.isWxAppOutdialOffer) {
82
+ if (params.wxAppAcceptInFlight) {
83
+ return 'wxApp_accept_in_flight';
84
+ }
85
+ if (params.wxAppAnswerPending) {
86
+ return 'wxApp_answer_pending';
87
+ }
88
+
89
+ return 'wxApp_offer_ready';
90
+ }
91
+
92
+ if (params.isWebrtc && !params.isOutdial) {
93
+ return 'browser_webrtc_offer';
94
+ }
95
+
96
+ if (params.isOutdial) {
97
+ return 'outdial_auto_answer';
98
+ }
99
+
100
+ if (params.enableWxBetterTogether && !params.hasDeviceCallId) {
101
+ return 'extension_non_wxApp_offer';
102
+ }
103
+
104
+ return 'extension_non_wxApp_offer';
105
+ }
106
+
107
+ export function logWxAppOfferDecision(params: {
108
+ interactionId: string;
109
+ acceptVisible: boolean;
110
+ acceptEnabled: boolean;
111
+ acceptReason: WxAppAcceptReason;
112
+ wxAppParticipantDeviceType?: string;
113
+ hasDeviceCallId: boolean;
114
+ }): void {
115
+ logWxApp('offer decision', 'logWxAppOfferDecision', {
116
+ event: 'offer_decision',
117
+ interactionId: params.interactionId,
118
+ acceptVisible: params.acceptVisible,
119
+ acceptEnabled: params.acceptEnabled,
120
+ acceptReason: params.acceptReason,
121
+ wxAppParticipantDeviceType: params.wxAppParticipantDeviceType,
122
+ hasDeviceCallId: params.hasDeviceCallId,
123
+ });
124
+ }
125
+
126
+ export function logWxAppTelephonyAction(params: {
127
+ action: WxAppTelephonyAction;
128
+ phase: WxAppTelephonyPhase;
129
+ interactionId?: string;
130
+ trackingId?: string;
131
+ httpStatus?: number | string;
132
+ failureReason?: string;
133
+ }): void {
134
+ const payload: WxAppLogData = {
135
+ event: 'telephony_action',
136
+ action: params.action,
137
+ phase: params.phase,
138
+ interactionId: params.interactionId,
139
+ trackingId: params.trackingId,
140
+ httpStatus: params.httpStatus,
141
+ failureReason: params.failureReason,
142
+ };
143
+
144
+ if (params.phase === 'failed') {
145
+ logWxAppError(`telephony ${params.action} ${params.phase}`, 'logWxAppTelephonyAction', payload);
146
+ } else {
147
+ logWxApp(`telephony ${params.action} ${params.phase}`, 'logWxAppTelephonyAction', payload);
148
+ }
149
+ }
150
+
151
+ export function logWxAppValidationFailure(reason: string, interactionId?: string): void {
152
+ logWxAppError('validation failed', 'logWxAppValidationFailure', {
153
+ event: 'validation_failed',
154
+ reason,
155
+ interactionId,
156
+ });
157
+ }
158
+
159
+ export function logWxAppMercuryMuteSync(params: {
160
+ phase: 'received' | 'applied' | 'dropped';
161
+ muted?: boolean;
162
+ callIdSuffix?: string;
163
+ interactionId?: string;
164
+ dropReason?: string;
165
+ }): void {
166
+ logWxApp(`mercury mute sync ${params.phase}`, 'logWxAppMercuryMuteSync', {
167
+ event: 'mercury_mute_sync',
168
+ phase: params.phase,
169
+ muted: params.muted,
170
+ callIdSuffix: params.callIdSuffix,
171
+ interactionId: params.interactionId,
172
+ dropReason: params.dropReason,
173
+ });
174
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Expected Hydra responses when mute backfill races call creation (WXCC-6026).
3
+ * These must not be logged as errors — see task-spec wxApp mute backfill guard.
4
+ */
5
+ export function isWxAppCallNotFoundError(error: unknown): boolean {
6
+ const err = error as {status?: number | string; message?: string};
7
+ if (err?.status === 400 || err?.status === '400') {
8
+ return true;
9
+ }
10
+
11
+ const message = String(err?.message ?? error ?? '');
12
+
13
+ return message.includes('Call not found') || message.includes('101002');
14
+ }
package/src/types.ts CHANGED
@@ -6,7 +6,12 @@ import {
6
6
  } from '@webex/internal-plugin-metrics/src/metrics.types';
7
7
  import * as Agent from './services/agent/types';
8
8
  import * as Contact from './services/task/types';
9
- import {Profile} from './services/config/types';
9
+ import {
10
+ AIFeatureFlags,
11
+ Profile,
12
+ CreateUserPreferenceRequest,
13
+ UpdateUserPreferenceRequest,
14
+ } from './services/config/types';
10
15
  import {PaginatedResponse, BaseSearchParams} from './utils/PageCache';
11
16
 
12
17
  /**
@@ -88,12 +93,19 @@ export type WebexRequestPayload = {
88
93
  */
89
94
  type Listener = (e: string, data?: unknown) => void;
90
95
 
96
+ /**
97
+ * Mercury event handler callback.
98
+ * @internal
99
+ * @ignore
100
+ */
101
+ type MercuryEventHandler = (data?: unknown) => void;
102
+
91
103
  /**
92
104
  * Event listener removal function type.
93
105
  * @internal
94
106
  * @ignore
95
107
  */
96
- type ListenerOff = (e: string) => void;
108
+ type ListenerOff = (e: string, handler?: MercuryEventHandler) => void;
97
109
 
98
110
  /**
99
111
  * Service host configuration.
@@ -156,6 +168,10 @@ export interface CCPluginConfig {
156
168
  };
157
169
  /** Configuration for the calling client */
158
170
  callingClientConfig: CallingClientConfig;
171
+ /** Whether to skip Mobius/WebRTC registration for browser login flows */
172
+ disableWebRTCRegistration?: boolean;
173
+ /** Whether wxApp Better Together (telephony REST + usersub) is enabled at init (WXCC-6026) */
174
+ enableWxBetterTogether?: boolean;
159
175
  }
160
176
 
161
177
  /**
@@ -286,6 +302,12 @@ interface IWebexInternal {
286
302
  version: string;
287
303
  /** Calling behavior configuration */
288
304
  callingBehavior: string;
305
+ /** Whether the device is registered with WDM */
306
+ registered?: boolean;
307
+ /** Register the device with WDM */
308
+ register?: () => Promise<void>;
309
+ /** Unregister the device from WDM */
310
+ unregister?: () => Promise<void>;
289
311
  };
290
312
  /** Presence service */
291
313
  presence: unknown;
@@ -542,22 +564,22 @@ export type RequestBody =
542
564
  | Contact.cancelCtq
543
565
  | Contact.WrapupPayLoad
544
566
  | Contact.DialerPayload
545
- | Contact.PreviewContactPayload;
567
+ | Contact.PreviewContactPayload
568
+ | CreateUserPreferenceRequest
569
+ | UpdateUserPreferenceRequest;
546
570
 
547
571
  /**
548
572
  * Represents the options to fetch buddy agents for the logged in agent.
549
- * Buddy agents are other agents who can be consulted or transfered to.
573
+ * Buddy agents are other agents who can be consulted or transferred to.
550
574
  * @public
551
575
  * @example
552
576
  * const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };
553
- * @ignore
554
577
  */
555
578
  export type BuddyAgents = {
556
579
  /**
557
- * The media type channel to filter buddy agents.
558
- * Determines which channel capability the returned agents must have.
580
+ * The media type channel to filter buddy agents. Defaults to telephony when omitted.
559
581
  */
560
- mediaType: 'telephony' | 'chat' | 'social' | 'email';
582
+ mediaType?: 'telephony' | 'chat' | 'social' | 'email';
561
583
 
562
584
  /**
563
585
  * Optional filter for agent state.
@@ -565,9 +587,37 @@ export type BuddyAgents = {
565
587
  * If omitted, returns both available and idle agents.
566
588
  */
567
589
  state?: 'Available' | 'Idle';
590
+
591
+ /**
592
+ * Applies the default state policy for the operation. An explicit state takes precedence.
593
+ */
594
+ action?: 'Consult' | 'Transfer';
568
595
  };
569
596
 
570
597
  /**
598
+ * Holds the configuration flags for the Agent.
599
+ * These flags determine the availability of certain features in the Agent UI.
600
+ * @internal
601
+ */
602
+ export type ConfigFlags = {
603
+ isEndTaskEnabled: boolean;
604
+ isEndConsultEnabled: boolean;
605
+ webRtcEnabled: boolean;
606
+ autoWrapup: boolean;
607
+ aiFeature?: AIFeatureFlags;
608
+ /** Agent-profile policy used to derive task consult/transfer destination controls. */
609
+ consultTransfer?: Contact.ConsultTransferDestinationConfig;
610
+ /**
611
+ * Optional toggle to globally enable/disable recording controls.
612
+ * Falls back to backend hints when omitted.
613
+ */
614
+ isRecordingEnabled?: boolean;
615
+ /** Whether wxApp thick-client answer controls/APIs are enabled (WXCC-6026) */
616
+ enableWxBetterTogether?: boolean;
617
+ };
618
+
619
+ /**
620
+
571
621
  * Generic error structure for Contact Center SDK errors.
572
622
  * Contains detailed information about the error context.
573
623
  * @public
@@ -653,10 +703,12 @@ export interface AddressBookEntrySearchParams extends BaseSearchParams {
653
703
  export interface EntryPointRecord {
654
704
  id: string;
655
705
  name: string;
706
+ /** Dialled number mapped to this entry point when included in the list response. */
707
+ number?: string;
656
708
  description?: string;
657
- type: string;
658
- isActive: boolean;
659
- orgId: string;
709
+ type?: string;
710
+ isActive?: boolean;
711
+ orgId?: string;
660
712
  createdAt?: string;
661
713
  updatedAt?: string;
662
714
  settings?: Record<string, any>;
@@ -821,38 +873,174 @@ export type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;
821
873
  */
822
874
  export type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;
823
875
 
876
+ /**
877
+ * Supported transcript control actions for AI Assistant events.
878
+ * @public
879
+ * @example
880
+ * const action: TranscriptAction = 'START';
881
+ * @ignore
882
+ */
824
883
  export type TranscriptAction = 'START' | 'STOP';
825
884
 
885
+ /**
886
+ * Parameters used to request AI Assistant real-time assistance.
887
+ * @public
888
+ * @example
889
+ * const params: RealTimeAssistanceParams = {
890
+ * interactionId: 'interaction-123',
891
+ * context: 'Need help with credit card payment due date',
892
+ * };
893
+ */
894
+ export type RealTimeAssistanceParams = {
895
+ /** Agent identifier */
896
+ agentId: string;
897
+ /** Interaction identifier for which assistance should be generated */
898
+ interactionId: string;
899
+ /** Optional additional context that should refine the assistance */
900
+ context?: string;
901
+ /** Optional language code for assistance (for example, 'en'). Defaults to 'en'. */
902
+ languageCode?: string;
903
+ };
904
+
905
+ /**
906
+ * Supported user actions on an AI Assistant real-time assistance adaptive card.
907
+ * @public
908
+ */
909
+ export const RealTimeAssistanceUserActionId = {
910
+ /** User liked the real-time assistance response */
911
+ LIKE: 'likeButton',
912
+ /** User disliked the real-time assistance response */
913
+ DISLIKE: 'dislikeButton',
914
+ /** User copied the real-time assistance response */
915
+ COPY: 'copyButton',
916
+ } as const;
917
+
918
+ /**
919
+ * Union type of supported real-time assistance user actions.
920
+ * @public
921
+ */
922
+ export type RealTimeAssistanceUserActionId = Enum<typeof RealTimeAssistanceUserActionId>;
923
+
924
+ /**
925
+ * Parameters used to send user action feedback for a real-time assistance adaptive card.
926
+ * @public
927
+ * @example
928
+ * const params: RealTimeAssistanceUserActionParams = {
929
+ * agentId: 'agent-123',
930
+ * interactionId: 'interaction-123',
931
+ * adaptiveCardId: 'adaptive-card-123',
932
+ * actionId: RealTimeAssistanceUserActionId.LIKE,
933
+ * };
934
+ */
935
+ export type RealTimeAssistanceUserActionParams = {
936
+ /** Agent identifier */
937
+ agentId: string;
938
+ /** Interaction identifier associated with the real-time assistance response */
939
+ interactionId: string;
940
+ /** Adaptive card identifier from the real-time assistance payload */
941
+ adaptiveCardId: string;
942
+ /** User action performed on the adaptive card */
943
+ actionId: RealTimeAssistanceUserActionId;
944
+ /** Optional language code. Defaults to 'en'. */
945
+ languageCode?: string;
946
+ };
947
+
948
+ /**
949
+ * Supported AI Assistant event categories.
950
+ * @public
951
+ * @example
952
+ * const eventType: AIAssistantEventType = AIAssistantEventType.CUSTOM_EVENT;
953
+ * @ignore
954
+ */
826
955
  export const AIAssistantEventType = {
956
+ /** Custom AI Assistant event */
827
957
  CUSTOM_EVENT: 'CUSTOM_EVENT',
958
+ /** CTI-backed AI Assistant event */
828
959
  CTI_EVENT: 'CTI_EVENT',
829
960
  } as const;
830
961
 
962
+ /**
963
+ * Union type of AI Assistant event categories.
964
+ * @public
965
+ * @example
966
+ * function send(type: AIAssistantEventType) { ... }
967
+ * @ignore
968
+ */
831
969
  export type AIAssistantEventType = Enum<typeof AIAssistantEventType>;
832
970
 
971
+ /**
972
+ * Supported AI Assistant event names.
973
+ * @public
974
+ * @example
975
+ * const name: AIAssistantEventName = AIAssistantEventName.GET_TRANSCRIPTS;
976
+ * @ignore
977
+ */
833
978
  export const AIAssistantEventName = {
979
+ /** Request transcript streaming for an interaction */
834
980
  GET_TRANSCRIPTS: 'GET_TRANSCRIPTS',
981
+ /** Request a suggested response for an interaction */
982
+ GET_SUGGESTIONS: 'GET_SUGGESTIONS',
983
+ /** Add extra context to refine a suggested response */
984
+ ADD_SUGGESTIONS_EXTRA_CONTEXT: 'ADD_SUGGESTIONS_EXTRA_CONTEXT',
985
+ /** Request mid-call summary generation */
835
986
  GET_MID_CALL_SUMMARY: 'GET_MID_CALL_SUMMARY',
987
+ /** Request post-call summary generation */
836
988
  GET_POST_CALL_SUMMARY: 'GET_POST_CALL_SUMMARY',
989
+ /** Mid-call summary response event */
837
990
  MID_CALL_SUMMARY_RESPONSE: 'MID_CALL_SUMMARY_RESPONSE',
991
+ /** Post-call summary response event */
838
992
  POST_CALL_SUMMARY_RESPONSE: 'POST_CALL_SUMMARY_RESPONSE',
993
+ /** Suggested digital response event */
839
994
  SUGGESTED_RESPONSES_DIGITAL: 'SUGGESTED_RESPONSES_DIGITAL',
995
+ /** User action on a suggested response adaptive card */
996
+ SUGGESTED_RESPONSES_USER_ACTION: 'SUGGESTED_RESPONSES_USER_ACTION',
840
997
  } as const;
841
998
 
999
+ /**
1000
+ * Union type of AI Assistant event names.
1001
+ * @public
1002
+ * @example
1003
+ * function handle(name: AIAssistantEventName) { ... }
1004
+ * @ignore
1005
+ */
842
1006
  export type AIAssistantEventName = Enum<typeof AIAssistantEventName>;
843
1007
 
1008
+ /**
1009
+ * A single transcript message entry returned by AI Assistant APIs.
1010
+ * @public
1011
+ * @example
1012
+ * const message: TranscriptMessage = { role: 'AGENT', content: 'Hello', messageId: '1', publishTimestamp: Date.now() };
1013
+ *
1014
+ */
844
1015
  export type TranscriptMessage = {
1016
+ /** Speaker role for this message */
845
1017
  role: string;
1018
+ /** Transcript chunk content */
846
1019
  content: string;
1020
+ /** Unique message identifier */
847
1021
  messageId: string;
1022
+ /** Message publish timestamp (epoch milliseconds) */
848
1023
  publishTimestamp: number;
849
1024
  };
850
1025
 
1026
+ /**
1027
+ * Response payload for historic transcripts API.
1028
+ * @public
1029
+ * @example
1030
+ * const resp: HistoricTranscriptsResponse = { orgId: 'org', agentId: 'agent', conversationId: null, interactionId: 'int', source: 'AI', data: [] };
1031
+ *
1032
+ */
851
1033
  export type HistoricTranscriptsResponse = {
1034
+ /** Organization identifier */
852
1035
  orgId: string;
1036
+ /** Agent identifier */
853
1037
  agentId: string;
1038
+ /** Conversation identifier when available */
854
1039
  conversationId: string | null;
1040
+ /** Interaction identifier */
855
1041
  interactionId: string;
1042
+ /** Data source identifier */
856
1043
  source: string;
1044
+ /** Transcript messages */
857
1045
  data: TranscriptMessage[];
858
1046
  };