@webex/contact-center 3.12.0-next.13 → 3.12.0-next.130

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 (312) 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 +53 -0
  5. package/ai-docs/GETTING_STARTED.md +168 -0
  6. package/ai-docs/GLOSSARY.md +43 -0
  7. package/ai-docs/README.md +138 -0
  8. package/ai-docs/REVIEW_CHECKLIST.md +41 -0
  9. package/ai-docs/RULES.md +444 -0
  10. package/ai-docs/SECURITY.md +52 -0
  11. package/ai-docs/SERVICE_STATE.md +52 -0
  12. package/ai-docs/SPEC_INDEX.md +65 -0
  13. package/ai-docs/adr/0001-spec-source-policy.md +55 -0
  14. package/ai-docs/adr/README.md +8 -0
  15. package/ai-docs/adr/_adr-template.md +31 -0
  16. package/ai-docs/contact-center-spec.md +382 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/contact-owner-change-refactor.md +78 -0
  19. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  20. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  21. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  22. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  23. package/ai-docs/patterns/testing-patterns.md +480 -0
  24. package/ai-docs/patterns/typescript-patterns.md +365 -0
  25. package/ai-docs/templates/README.md +102 -0
  26. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  27. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  28. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  29. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  30. package/ai-docs/templates/new-method/00-master.md +80 -0
  31. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  32. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  33. package/ai-docs/templates/new-method/03-tests.md +201 -0
  34. package/ai-docs/templates/new-method/04-validation.md +141 -0
  35. package/ai-docs/templates/new-service/00-master.md +109 -0
  36. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  37. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  38. package/ai-docs/templates/new-service/03-integration.md +178 -0
  39. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  40. package/ai-docs/templates/new-service/05-validation.md +145 -0
  41. package/dist/cc.js +971 -42
  42. package/dist/cc.js.map +1 -1
  43. package/dist/config.js +13 -0
  44. package/dist/config.js.map +1 -1
  45. package/dist/constants.js +31 -3
  46. package/dist/constants.js.map +1 -1
  47. package/dist/index.js +45 -15
  48. package/dist/index.js.map +1 -1
  49. package/dist/metrics/MetricsManager.js +16 -0
  50. package/dist/metrics/MetricsManager.js.map +1 -1
  51. package/dist/metrics/behavioral-events.js +205 -0
  52. package/dist/metrics/behavioral-events.js.map +1 -1
  53. package/dist/metrics/constants.js +48 -4
  54. package/dist/metrics/constants.js.map +1 -1
  55. package/dist/services/AddressBook.js +18 -15
  56. package/dist/services/AddressBook.js.map +1 -1
  57. package/dist/services/AnswerCallOnWebexService.js +202 -0
  58. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  59. package/dist/services/ApiAiAssistant.js +269 -9
  60. package/dist/services/ApiAiAssistant.js.map +1 -1
  61. package/dist/services/EntryPoint.js +46 -68
  62. package/dist/services/EntryPoint.js.map +1 -1
  63. package/dist/services/Queue.js +27 -22
  64. package/dist/services/Queue.js.map +1 -1
  65. package/dist/services/UserPreference.js +427 -0
  66. package/dist/services/UserPreference.js.map +1 -0
  67. package/dist/services/WebexCrossClientService.js +222 -0
  68. package/dist/services/WebexCrossClientService.js.map +1 -0
  69. package/dist/services/WxAppTelephonyMercurySync.js +108 -0
  70. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  71. package/dist/services/config/Util.js +11 -4
  72. package/dist/services/config/Util.js.map +1 -1
  73. package/dist/services/config/constants.js +41 -7
  74. package/dist/services/config/constants.js.map +1 -1
  75. package/dist/services/config/index.js +51 -0
  76. package/dist/services/config/index.js.map +1 -1
  77. package/dist/services/config/types.js +57 -12
  78. package/dist/services/config/types.js.map +1 -1
  79. package/dist/services/core/Err.js.map +1 -1
  80. package/dist/services/core/Utils.js +111 -32
  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 +28 -14
  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 +2 -1
  88. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  89. package/dist/services/core/websocket/types.js.map +1 -1
  90. package/dist/services/index.js +1 -1
  91. package/dist/services/index.js.map +1 -1
  92. package/dist/services/task/Task.js +754 -0
  93. package/dist/services/task/Task.js.map +1 -0
  94. package/dist/services/task/TaskFactory.js +49 -0
  95. package/dist/services/task/TaskFactory.js.map +1 -0
  96. package/dist/services/task/TaskManager.js +1172 -521
  97. package/dist/services/task/TaskManager.js.map +1 -1
  98. package/dist/services/task/TaskUtils.js +211 -27
  99. package/dist/services/task/TaskUtils.js.map +1 -1
  100. package/dist/services/task/WebexCallingUtils.js +70 -0
  101. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  102. package/dist/services/task/constants.js +12 -2
  103. package/dist/services/task/constants.js.map +1 -1
  104. package/dist/services/task/contact.js +29 -0
  105. package/dist/services/task/contact.js.map +1 -1
  106. package/dist/services/task/dialer.js +78 -0
  107. package/dist/services/task/dialer.js.map +1 -1
  108. package/dist/services/task/digital/Digital.js +78 -0
  109. package/dist/services/task/digital/Digital.js.map +1 -0
  110. package/dist/services/task/state-machine/TaskStateMachine.js +982 -0
  111. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  112. package/dist/services/task/state-machine/actions.js +572 -0
  113. package/dist/services/task/state-machine/actions.js.map +1 -0
  114. package/dist/services/task/state-machine/constants.js +161 -0
  115. package/dist/services/task/state-machine/constants.js.map +1 -0
  116. package/dist/services/task/state-machine/guards.js +379 -0
  117. package/dist/services/task/state-machine/guards.js.map +1 -0
  118. package/dist/services/task/state-machine/index.js +53 -0
  119. package/dist/services/task/state-machine/index.js.map +1 -0
  120. package/dist/services/task/state-machine/types.js +54 -0
  121. package/dist/services/task/state-machine/types.js.map +1 -0
  122. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  123. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  124. package/dist/services/task/taskDataNormalizer.js +99 -0
  125. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  126. package/dist/services/task/types.js +228 -5
  127. package/dist/services/task/types.js.map +1 -1
  128. package/dist/services/task/voice/Voice.js +1485 -0
  129. package/dist/services/task/voice/Voice.js.map +1 -0
  130. package/dist/services/task/voice/WebRTC.js +152 -0
  131. package/dist/services/task/voice/WebRTC.js.map +1 -0
  132. package/dist/services/task/voice/wxAppVoiceMethods.js +354 -0
  133. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  134. package/dist/services/wxAppDiagnosticLogging.js +122 -0
  135. package/dist/services/wxAppDiagnosticLogging.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 +193 -6
  139. package/dist/types/config.d.ts +13 -0
  140. package/dist/types/constants.d.ts +29 -1
  141. package/dist/types/index.d.ts +35 -8
  142. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  143. package/dist/types/metrics/constants.d.ts +43 -1
  144. package/dist/types/services/AddressBook.d.ts +2 -1
  145. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  146. package/dist/types/services/ApiAiAssistant.d.ts +56 -5
  147. package/dist/types/services/EntryPoint.d.ts +7 -5
  148. package/dist/types/services/Queue.d.ts +5 -3
  149. package/dist/types/services/UserPreference.d.ts +118 -0
  150. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  151. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  152. package/dist/types/services/config/constants.d.ts +34 -5
  153. package/dist/types/services/config/types.d.ts +197 -12
  154. package/dist/types/services/core/Err.d.ts +6 -0
  155. package/dist/types/services/core/Utils.d.ts +35 -13
  156. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  157. package/dist/types/services/core/types.d.ts +2 -0
  158. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  159. package/dist/types/services/core/websocket/types.d.ts +1 -1
  160. package/dist/types/services/index.d.ts +1 -1
  161. package/dist/types/services/task/Task.d.ts +175 -0
  162. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  163. package/dist/types/services/task/TaskUtils.d.ts +48 -2
  164. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  165. package/dist/types/services/task/constants.d.ts +10 -0
  166. package/dist/types/services/task/contact.d.ts +4 -0
  167. package/dist/types/services/task/dialer.d.ts +30 -0
  168. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  169. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -0
  170. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  171. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  172. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  173. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  174. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  175. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  176. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  177. package/dist/types/services/task/types.d.ts +680 -66
  178. package/dist/types/services/task/voice/Voice.d.ts +227 -0
  179. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  180. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +55 -0
  181. package/dist/types/services/wxAppDiagnosticLogging.d.ts +51 -0
  182. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  183. package/dist/types/types.d.ts +205 -9
  184. package/dist/types/utils/PageCache.d.ts +20 -3
  185. package/dist/types/webex.d.ts +1 -0
  186. package/dist/types.js +162 -4
  187. package/dist/types.js.map +1 -1
  188. package/dist/utils/PageCache.js +19 -5
  189. package/dist/utils/PageCache.js.map +1 -1
  190. package/dist/webex.js +22 -2
  191. package/dist/webex.js.map +1 -1
  192. package/package.json +16 -12
  193. package/src/cc.ts +1289 -112
  194. package/src/config.ts +13 -0
  195. package/src/constants.ts +29 -1
  196. package/src/index.ts +36 -5
  197. package/src/metrics/MetricsManager.ts +16 -0
  198. package/src/metrics/ai-docs/AGENTS.md +350 -0
  199. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  200. package/src/metrics/ai-docs/metrics-spec.md +921 -0
  201. package/src/metrics/behavioral-events.ts +212 -0
  202. package/src/metrics/constants.ts +52 -4
  203. package/src/services/AddressBook.ts +17 -6
  204. package/src/services/AnswerCallOnWebexService.ts +239 -0
  205. package/src/services/ApiAiAssistant.ts +356 -9
  206. package/src/services/EntryPoint.ts +59 -60
  207. package/src/services/Queue.ts +29 -12
  208. package/src/services/UserPreference.ts +509 -0
  209. package/src/services/WebexCrossClientService.ts +293 -0
  210. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  211. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  212. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  213. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  214. package/src/services/ai-docs/AGENTS.md +386 -0
  215. package/src/services/ai-docs/services-spec.md +505 -0
  216. package/src/services/config/Util.ts +12 -3
  217. package/src/services/config/ai-docs/AGENTS.md +255 -0
  218. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  219. package/src/services/config/ai-docs/config-spec.md +686 -0
  220. package/src/services/config/constants.ts +46 -6
  221. package/src/services/config/index.ts +65 -0
  222. package/src/services/config/types.ts +197 -13
  223. package/src/services/core/Err.ts +3 -0
  224. package/src/services/core/Utils.ts +127 -37
  225. package/src/services/core/WebexRequest.ts +3 -1
  226. package/src/services/core/ai-docs/AGENTS.md +381 -0
  227. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  228. package/src/services/core/ai-docs/core-spec.md +787 -0
  229. package/src/services/core/aqm-reqs.ts +30 -15
  230. package/src/services/core/types.ts +2 -0
  231. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  232. package/src/services/core/websocket/types.ts +1 -1
  233. package/src/services/index.ts +1 -1
  234. package/src/services/task/Task.ts +908 -0
  235. package/src/services/task/TaskFactory.ts +60 -0
  236. package/src/services/task/TaskManager.ts +1419 -608
  237. package/src/services/task/TaskUtils.ts +303 -25
  238. package/src/services/task/WebexCallingUtils.ts +136 -0
  239. package/src/services/task/ai-docs/AGENTS.md +457 -0
  240. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  241. package/src/services/task/ai-docs/task-spec.md +1474 -0
  242. package/src/services/task/constants.ts +10 -0
  243. package/src/services/task/contact.ts +30 -0
  244. package/src/services/task/dialer.ts +80 -0
  245. package/src/services/task/digital/Digital.ts +97 -0
  246. package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
  247. package/src/services/task/state-machine/actions.ts +741 -0
  248. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  249. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1156 -0
  250. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2247 -0
  251. package/src/services/task/state-machine/constants.ts +172 -0
  252. package/src/services/task/state-machine/guards.ts +442 -0
  253. package/src/services/task/state-machine/index.ts +28 -0
  254. package/src/services/task/state-machine/types.ts +258 -0
  255. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  256. package/src/services/task/taskDataNormalizer.ts +137 -0
  257. package/src/services/task/types.ts +819 -70
  258. package/src/services/task/voice/Voice.ts +1851 -0
  259. package/src/services/task/voice/WebRTC.ts +191 -0
  260. package/src/services/task/voice/wxAppVoiceMethods.ts +516 -0
  261. package/src/services/wxAppDiagnosticLogging.ts +174 -0
  262. package/src/services/wxAppTelephonyUtils.ts +14 -0
  263. package/src/types.ts +262 -11
  264. package/src/utils/AGENTS.md +289 -0
  265. package/src/utils/PageCache.ts +38 -5
  266. package/src/utils/ai-docs/utils-spec.md +391 -0
  267. package/src/webex.js +10 -0
  268. package/test/unit/spec/cc.ts +2210 -119
  269. package/test/unit/spec/logger-proxy.ts +70 -0
  270. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  271. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  272. package/test/unit/spec/services/AddressBook.ts +37 -6
  273. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  274. package/test/unit/spec/services/ApiAiAssistant.ts +311 -21
  275. package/test/unit/spec/services/EntryPoint.ts +87 -40
  276. package/test/unit/spec/services/Queue.ts +123 -12
  277. package/test/unit/spec/services/UserPreference.ts +401 -0
  278. package/test/unit/spec/services/WebCallingService.ts +7 -1
  279. package/test/unit/spec/services/WebexCrossClientService.ts +467 -0
  280. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  281. package/test/unit/spec/services/config/Util.ts +129 -0
  282. package/test/unit/spec/services/config/index.ts +97 -29
  283. package/test/unit/spec/services/core/Utils.ts +425 -8
  284. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  285. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  286. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  287. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  288. package/test/unit/spec/services/task/Task.ts +745 -0
  289. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  290. package/test/unit/spec/services/task/TaskManager.ts +2518 -1494
  291. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  292. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  293. package/test/unit/spec/services/task/contact.ts +33 -0
  294. package/test/unit/spec/services/task/dialer.ts +190 -0
  295. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  296. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
  297. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  298. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  299. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  300. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  301. package/test/unit/spec/services/task/voice/Voice.ts +2061 -0
  302. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  303. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +603 -0
  304. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +143 -0
  305. package/test/unit/spec/wellnessSampleUtils.ts +288 -0
  306. package/umd/contact-center.min.js +2 -2
  307. package/umd/contact-center.min.js.map +1 -1
  308. package/dist/services/task/index.js +0 -1525
  309. package/dist/services/task/index.js.map +0 -1
  310. package/dist/types/services/task/index.d.ts +0 -650
  311. package/src/services/task/index.ts +0 -1801
  312. 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,13 @@ 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
+ Entity,
12
+ Profile,
13
+ CreateUserPreferenceRequest,
14
+ UpdateUserPreferenceRequest,
15
+ } from './services/config/types';
10
16
  import {PaginatedResponse, BaseSearchParams} from './utils/PageCache';
11
17
 
12
18
  /**
@@ -88,12 +94,19 @@ export type WebexRequestPayload = {
88
94
  */
89
95
  type Listener = (e: string, data?: unknown) => void;
90
96
 
97
+ /**
98
+ * Mercury event handler callback.
99
+ * @internal
100
+ * @ignore
101
+ */
102
+ type MercuryEventHandler = (data?: unknown) => void;
103
+
91
104
  /**
92
105
  * Event listener removal function type.
93
106
  * @internal
94
107
  * @ignore
95
108
  */
96
- type ListenerOff = (e: string) => void;
109
+ type ListenerOff = (e: string, handler?: MercuryEventHandler) => void;
97
110
 
98
111
  /**
99
112
  * Service host configuration.
@@ -156,6 +169,10 @@ export interface CCPluginConfig {
156
169
  };
157
170
  /** Configuration for the calling client */
158
171
  callingClientConfig: CallingClientConfig;
172
+ /** Whether to skip Mobius/WebRTC registration for browser login flows */
173
+ disableWebRTCRegistration?: boolean;
174
+ /** Whether wxApp Better Together (telephony REST + usersub) is enabled at init (WXCC-6026) */
175
+ enableWxBetterTogether?: boolean;
159
176
  }
160
177
 
161
178
  /**
@@ -286,6 +303,12 @@ interface IWebexInternal {
286
303
  version: string;
287
304
  /** Calling behavior configuration */
288
305
  callingBehavior: string;
306
+ /** Whether the device is registered with WDM */
307
+ registered?: boolean;
308
+ /** Register the device with WDM */
309
+ register?: () => Promise<void>;
310
+ /** Unregister the device from WDM */
311
+ unregister?: () => Promise<void>;
289
312
  };
290
313
  /** Presence service */
291
314
  presence: unknown;
@@ -397,6 +420,9 @@ export interface IContactCenter {
397
420
  * cc.register().then(profile => { ... });
398
421
  */
399
422
  register(): Promise<Profile>;
423
+
424
+ /** Returns the system-managed WellbeingBreak idle code for the registered session. */
425
+ getWellbeingBreakIdleCode(): Promise<Entity>;
400
426
  }
401
427
 
402
428
  /**
@@ -542,22 +568,22 @@ export type RequestBody =
542
568
  | Contact.cancelCtq
543
569
  | Contact.WrapupPayLoad
544
570
  | Contact.DialerPayload
545
- | Contact.PreviewContactPayload;
571
+ | Contact.PreviewContactPayload
572
+ | CreateUserPreferenceRequest
573
+ | UpdateUserPreferenceRequest;
546
574
 
547
575
  /**
548
576
  * 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.
577
+ * Buddy agents are other agents who can be consulted or transferred to.
550
578
  * @public
551
579
  * @example
552
580
  * const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };
553
- * @ignore
554
581
  */
555
582
  export type BuddyAgents = {
556
583
  /**
557
- * The media type channel to filter buddy agents.
558
- * Determines which channel capability the returned agents must have.
584
+ * The media type channel to filter buddy agents. Defaults to telephony when omitted.
559
585
  */
560
- mediaType: 'telephony' | 'chat' | 'social' | 'email';
586
+ mediaType?: 'telephony' | 'chat' | 'social' | 'email';
561
587
 
562
588
  /**
563
589
  * Optional filter for agent state.
@@ -565,9 +591,37 @@ export type BuddyAgents = {
565
591
  * If omitted, returns both available and idle agents.
566
592
  */
567
593
  state?: 'Available' | 'Idle';
594
+
595
+ /**
596
+ * Applies the default state policy for the operation. An explicit state takes precedence.
597
+ */
598
+ action?: 'Consult' | 'Transfer';
568
599
  };
569
600
 
570
601
  /**
602
+ * Holds the configuration flags for the Agent.
603
+ * These flags determine the availability of certain features in the Agent UI.
604
+ * @internal
605
+ */
606
+ export type ConfigFlags = {
607
+ isEndTaskEnabled: boolean;
608
+ isEndConsultEnabled: boolean;
609
+ webRtcEnabled: boolean;
610
+ autoWrapup: boolean;
611
+ aiFeature?: AIFeatureFlags;
612
+ /** Agent-profile policy used to derive task consult/transfer destination controls. */
613
+ consultTransfer?: Contact.ConsultTransferDestinationConfig;
614
+ /**
615
+ * Optional toggle to globally enable/disable recording controls.
616
+ * Falls back to backend hints when omitted.
617
+ */
618
+ isRecordingEnabled?: boolean;
619
+ /** Whether wxApp thick-client answer controls/APIs are enabled (WXCC-6026) */
620
+ enableWxBetterTogether?: boolean;
621
+ };
622
+
623
+ /**
624
+
571
625
  * Generic error structure for Contact Center SDK errors.
572
626
  * Contains detailed information about the error context.
573
627
  * @public
@@ -653,10 +707,12 @@ export interface AddressBookEntrySearchParams extends BaseSearchParams {
653
707
  export interface EntryPointRecord {
654
708
  id: string;
655
709
  name: string;
710
+ /** Dialled number mapped to this entry point when included in the list response. */
711
+ number?: string;
656
712
  description?: string;
657
- type: string;
658
- isActive: boolean;
659
- orgId: string;
713
+ type?: string;
714
+ isActive?: boolean;
715
+ orgId?: string;
660
716
  createdAt?: string;
661
717
  updatedAt?: string;
662
718
  settings?: Record<string, any>;
@@ -821,38 +877,233 @@ export type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;
821
877
  */
822
878
  export type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;
823
879
 
880
+ /**
881
+ * Supported transcript control actions for AI Assistant events.
882
+ * @public
883
+ * @example
884
+ * const action: TranscriptAction = 'START';
885
+ * @ignore
886
+ */
824
887
  export type TranscriptAction = 'START' | 'STOP';
825
888
 
889
+ /**
890
+ * Parameters used to request AI Assistant real-time assistance.
891
+ * @public
892
+ * @example
893
+ * const params: RealTimeAssistanceParams = {
894
+ * interactionId: 'interaction-123',
895
+ * context: 'Need help with credit card payment due date',
896
+ * };
897
+ */
898
+ export type RealTimeAssistanceParams = {
899
+ /** Agent identifier */
900
+ agentId: string;
901
+ /** Interaction identifier for which assistance should be generated */
902
+ interactionId: string;
903
+ /** Optional additional context that should refine the assistance */
904
+ context?: string;
905
+ /** Optional language code for assistance (for example, 'en'). Defaults to 'en'. */
906
+ languageCode?: string;
907
+ };
908
+
909
+ /**
910
+ * Supported user actions on an AI Assistant real-time assistance adaptive card.
911
+ * @public
912
+ */
913
+ export const RealTimeAssistanceUserActionId = {
914
+ /** User liked the real-time assistance response */
915
+ LIKE: 'likeButton',
916
+ /** User disliked the real-time assistance response */
917
+ DISLIKE: 'dislikeButton',
918
+ /** User copied the real-time assistance response */
919
+ COPY: 'copyButton',
920
+ } as const;
921
+
922
+ /**
923
+ * Union type of supported real-time assistance user actions.
924
+ * @public
925
+ */
926
+ export type RealTimeAssistanceUserActionId = Enum<typeof RealTimeAssistanceUserActionId>;
927
+
928
+ /**
929
+ * Parameters used to send user action feedback for a real-time assistance adaptive card.
930
+ * @public
931
+ * @example
932
+ * const params: RealTimeAssistanceUserActionParams = {
933
+ * agentId: 'agent-123',
934
+ * interactionId: 'interaction-123',
935
+ * adaptiveCardId: 'adaptive-card-123',
936
+ * actionId: RealTimeAssistanceUserActionId.LIKE,
937
+ * };
938
+ */
939
+ export type RealTimeAssistanceUserActionParams = {
940
+ /** Agent identifier */
941
+ agentId: string;
942
+ /** Interaction identifier associated with the real-time assistance response */
943
+ interactionId: string;
944
+ /** Adaptive card identifier from the real-time assistance payload */
945
+ adaptiveCardId: string;
946
+ /** User action performed on the adaptive card */
947
+ actionId: RealTimeAssistanceUserActionId;
948
+ /** Optional language code. Defaults to 'en'. */
949
+ languageCode?: string;
950
+ };
951
+
952
+ /**
953
+ * Wellness notification actions delivered by the Contact Center notification service.
954
+ * @public
955
+ */
956
+ export const WELLNESS_BREAK_NOTIFICATION_ACTIONS = {
957
+ PROVIDE_WELLNESS_BREAK: 'PROVIDE_WELLNESS_BREAK',
958
+ SUGGEST_WELLNESS_BREAK: 'SUGGEST_WELLNESS_BREAK',
959
+ WELLNESS_BREAK_NOT_ALLOWED: 'WELLNESS_BREAK_NOT_ALLOWED',
960
+ } as const;
961
+
962
+ /** Union of supported wellness notification actions. @public */
963
+ export type WellnessBreakNotificationAction = Enum<typeof WELLNESS_BREAK_NOTIFICATION_ACTIONS>;
964
+
965
+ /**
966
+ * Agent actions accepted by the wellness action API.
967
+ * @public
968
+ */
969
+ export const WELLNESS_BREAK_USER_ACTIONS = {
970
+ REQUESTED: 'REQUESTED',
971
+ ACCEPTED: 'ACCEPTED',
972
+ REJECTED: 'REJECTED',
973
+ NO_RESPONSE: 'NO_RESPONSE',
974
+ } as const;
975
+
976
+ /** Union of supported wellness action API values. @public */
977
+ export type WellnessBreakUserAction = Enum<typeof WELLNESS_BREAK_USER_ACTIONS>;
978
+
979
+ /**
980
+ * Validated, agent-scoped wellness notification emitted by Contact Center.
981
+ * @public
982
+ */
983
+ export interface WellnessBreakEvent {
984
+ /** Agent identifier */
985
+ agentId: string;
986
+ /** Organization identifier */
987
+ orgId: string;
988
+ /** Session identifier supplied by the notification; it may differ from the consumer's active session */
989
+ agentSessionId: string;
990
+ /** Backend wellness action */
991
+ actionEvent: WellnessBreakNotificationAction;
992
+ /** Optional untrusted plain-text message supplied by the backend */
993
+ actionText?: string;
994
+ /** Optional normalized interaction diagnostic */
995
+ interactionId?: string;
996
+ /** Notification diagnostic only; never an action-request correlation identifier */
997
+ trackingId?: string;
998
+ }
999
+
1000
+ /**
1001
+ * Parameters for responding to a backend-provided wellness offer.
1002
+ * @public
1003
+ */
1004
+ export interface RespondToWellnessBreakParams {
1005
+ /** Agent response; REQUESTED is available only through requestWellnessBreak */
1006
+ action: Exclude<WellnessBreakUserAction, typeof WELLNESS_BREAK_USER_ACTIONS.REQUESTED>;
1007
+ }
1008
+
1009
+ /**
1010
+ * Supported AI Assistant event categories.
1011
+ * @public
1012
+ * @example
1013
+ * const eventType: AIAssistantEventType = AIAssistantEventType.CUSTOM_EVENT;
1014
+ * @ignore
1015
+ */
826
1016
  export const AIAssistantEventType = {
1017
+ /** Custom AI Assistant event */
827
1018
  CUSTOM_EVENT: 'CUSTOM_EVENT',
1019
+ /** CTI-backed AI Assistant event */
828
1020
  CTI_EVENT: 'CTI_EVENT',
829
1021
  } as const;
830
1022
 
1023
+ /**
1024
+ * Union type of AI Assistant event categories.
1025
+ * @public
1026
+ * @example
1027
+ * function send(type: AIAssistantEventType) { ... }
1028
+ * @ignore
1029
+ */
831
1030
  export type AIAssistantEventType = Enum<typeof AIAssistantEventType>;
832
1031
 
1032
+ /**
1033
+ * Supported AI Assistant event names.
1034
+ * @public
1035
+ * @example
1036
+ * const name: AIAssistantEventName = AIAssistantEventName.GET_TRANSCRIPTS;
1037
+ * @ignore
1038
+ */
833
1039
  export const AIAssistantEventName = {
1040
+ /** Request transcript streaming for an interaction */
834
1041
  GET_TRANSCRIPTS: 'GET_TRANSCRIPTS',
1042
+ /** Request a suggested response for an interaction */
1043
+ GET_SUGGESTIONS: 'GET_SUGGESTIONS',
1044
+ /** Add extra context to refine a suggested response */
1045
+ ADD_SUGGESTIONS_EXTRA_CONTEXT: 'ADD_SUGGESTIONS_EXTRA_CONTEXT',
1046
+ /** Request mid-call summary generation */
835
1047
  GET_MID_CALL_SUMMARY: 'GET_MID_CALL_SUMMARY',
1048
+ /** Request post-call summary generation */
836
1049
  GET_POST_CALL_SUMMARY: 'GET_POST_CALL_SUMMARY',
1050
+ /** Mid-call summary response event */
837
1051
  MID_CALL_SUMMARY_RESPONSE: 'MID_CALL_SUMMARY_RESPONSE',
1052
+ /** Post-call summary response event */
838
1053
  POST_CALL_SUMMARY_RESPONSE: 'POST_CALL_SUMMARY_RESPONSE',
1054
+ /** Suggested digital response event */
839
1055
  SUGGESTED_RESPONSES_DIGITAL: 'SUGGESTED_RESPONSES_DIGITAL',
1056
+ /** User action on a suggested response adaptive card */
1057
+ SUGGESTED_RESPONSES_USER_ACTION: 'SUGGESTED_RESPONSES_USER_ACTION',
1058
+ /** Agent Wellness Break request/response action */
1059
+ WELLNESS_BREAK_ACTION: 'WellnessBreakAction',
840
1060
  } as const;
841
1061
 
1062
+ /**
1063
+ * Union type of AI Assistant event names.
1064
+ * @public
1065
+ * @example
1066
+ * function handle(name: AIAssistantEventName) { ... }
1067
+ * @ignore
1068
+ */
842
1069
  export type AIAssistantEventName = Enum<typeof AIAssistantEventName>;
843
1070
 
1071
+ /**
1072
+ * A single transcript message entry returned by AI Assistant APIs.
1073
+ * @public
1074
+ * @example
1075
+ * const message: TranscriptMessage = { role: 'AGENT', content: 'Hello', messageId: '1', publishTimestamp: Date.now() };
1076
+ *
1077
+ */
844
1078
  export type TranscriptMessage = {
1079
+ /** Speaker role for this message */
845
1080
  role: string;
1081
+ /** Transcript chunk content */
846
1082
  content: string;
1083
+ /** Unique message identifier */
847
1084
  messageId: string;
1085
+ /** Message publish timestamp (epoch milliseconds) */
848
1086
  publishTimestamp: number;
849
1087
  };
850
1088
 
1089
+ /**
1090
+ * Response payload for historic transcripts API.
1091
+ * @public
1092
+ * @example
1093
+ * const resp: HistoricTranscriptsResponse = { orgId: 'org', agentId: 'agent', conversationId: null, interactionId: 'int', source: 'AI', data: [] };
1094
+ *
1095
+ */
851
1096
  export type HistoricTranscriptsResponse = {
1097
+ /** Organization identifier */
852
1098
  orgId: string;
1099
+ /** Agent identifier */
853
1100
  agentId: string;
1101
+ /** Conversation identifier when available */
854
1102
  conversationId: string | null;
1103
+ /** Interaction identifier */
855
1104
  interactionId: string;
1105
+ /** Data source identifier */
856
1106
  source: string;
1107
+ /** Transcript messages */
857
1108
  data: TranscriptMessage[];
858
1109
  };