@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 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 (294) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +16 -7
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +29 -14
  11. package/dist/breakouts/events.js.map +1 -1
  12. package/dist/breakouts/index.js +99 -4
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/common/errors/webex-errors.js +49 -5
  15. package/dist/common/errors/webex-errors.js.map +1 -1
  16. package/dist/config.js +8 -3
  17. package/dist/config.js.map +1 -1
  18. package/dist/constants.js +60 -11
  19. package/dist/constants.js.map +1 -1
  20. package/dist/controls-options-manager/constants.js +11 -1
  21. package/dist/controls-options-manager/constants.js.map +1 -1
  22. package/dist/controls-options-manager/index.js +67 -29
  23. package/dist/controls-options-manager/index.js.map +1 -1
  24. package/dist/controls-options-manager/util.js +91 -0
  25. package/dist/controls-options-manager/util.js.map +1 -1
  26. package/dist/hashTree/constants.js +16 -2
  27. package/dist/hashTree/constants.js.map +1 -1
  28. package/dist/hashTree/hashTree.js +18 -0
  29. package/dist/hashTree/hashTree.js.map +1 -1
  30. package/dist/hashTree/hashTreeParser.js +1655 -538
  31. package/dist/hashTree/hashTreeParser.js.map +1 -1
  32. package/dist/hashTree/types.js +4 -2
  33. package/dist/hashTree/types.js.map +1 -1
  34. package/dist/hashTree/utils.js +52 -0
  35. package/dist/hashTree/utils.js.map +1 -1
  36. package/dist/index.js +18 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/interceptors/constant.js +12 -0
  39. package/dist/interceptors/constant.js.map +1 -0
  40. package/dist/interceptors/dataChannelAuthToken.js +350 -0
  41. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  42. package/dist/interceptors/index.js +7 -0
  43. package/dist/interceptors/index.js.map +1 -1
  44. package/dist/interceptors/locusRetry.js +23 -8
  45. package/dist/interceptors/locusRetry.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +9 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +914 -212
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +8 -7
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2347 -1096
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +100 -38
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +466 -174
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +116 -18
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +12 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js.map +1 -1
  114. package/dist/reachability/index.js +121 -83
  115. package/dist/reachability/index.js.map +1 -1
  116. package/dist/reachability/reachability.types.js +2 -0
  117. package/dist/reachability/reachability.types.js.map +1 -1
  118. package/dist/reachability/util.js +45 -0
  119. package/dist/reachability/util.js.map +1 -1
  120. package/dist/reactions/reactions.type.js.map +1 -1
  121. package/dist/reconnection-manager/index.js +0 -1
  122. package/dist/reconnection-manager/index.js.map +1 -1
  123. package/dist/recording-controller/index.js +1 -3
  124. package/dist/recording-controller/index.js.map +1 -1
  125. package/dist/roap/turnDiscovery.js +8 -1
  126. package/dist/roap/turnDiscovery.js.map +1 -1
  127. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  128. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  129. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  130. package/dist/types/config.d.ts +6 -2
  131. package/dist/types/constants.d.ts +35 -1
  132. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  133. package/dist/types/controls-options-manager/index.d.ts +16 -0
  134. package/dist/types/hashTree/constants.d.ts +3 -0
  135. package/dist/types/hashTree/hashTree.d.ts +7 -0
  136. package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
  137. package/dist/types/hashTree/types.d.ts +3 -0
  138. package/dist/types/hashTree/utils.d.ts +24 -0
  139. package/dist/types/index.d.ts +4 -0
  140. package/dist/types/interceptors/constant.d.ts +5 -0
  141. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  142. package/dist/types/interceptors/index.d.ts +2 -1
  143. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  144. package/dist/types/interceptors/utils.d.ts +1 -0
  145. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  146. package/dist/types/locus-info/index.d.ts +126 -15
  147. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  148. package/dist/types/locus-info/types.d.ts +28 -1
  149. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  150. package/dist/types/media/properties.d.ts +8 -3
  151. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  152. package/dist/types/meeting/index.d.ts +253 -16
  153. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  154. package/dist/types/meeting/request.d.ts +17 -1
  155. package/dist/types/meeting/request.type.d.ts +5 -0
  156. package/dist/types/meeting/util.d.ts +40 -0
  157. package/dist/types/meeting-info/meeting-info-v2.d.ts +25 -1
  158. package/dist/types/meetings/index.d.ts +54 -21
  159. package/dist/types/meetings/meetings.types.d.ts +30 -1
  160. package/dist/types/meetings/request.d.ts +14 -0
  161. package/dist/types/member/index.d.ts +2 -0
  162. package/dist/types/member/types.d.ts +1 -0
  163. package/dist/types/member/util.d.ts +14 -0
  164. package/dist/types/members/index.d.ts +15 -2
  165. package/dist/types/members/util.d.ts +1 -5
  166. package/dist/types/metrics/constants.d.ts +11 -0
  167. package/dist/types/multistream/codec/constants.d.ts +7 -0
  168. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  169. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  170. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  171. package/dist/types/reachability/index.d.ts +10 -3
  172. package/dist/types/reachability/reachability.types.d.ts +7 -0
  173. package/dist/types/reachability/util.d.ts +17 -0
  174. package/dist/types/reactions/reactions.type.d.ts +4 -0
  175. package/dist/types/webinar/utils.d.ts +6 -0
  176. package/dist/webinar/index.js +585 -164
  177. package/dist/webinar/index.js.map +1 -1
  178. package/dist/webinar/utils.js +25 -0
  179. package/dist/webinar/utils.js.map +1 -0
  180. package/package.json +24 -23
  181. package/src/aiEnableRequest/README.md +84 -0
  182. package/src/aiEnableRequest/index.ts +186 -0
  183. package/src/aiEnableRequest/utils.ts +25 -0
  184. package/src/annotation/index.ts +32 -10
  185. package/src/breakouts/breakout.ts +3 -1
  186. package/src/breakouts/events.ts +33 -11
  187. package/src/breakouts/index.ts +122 -2
  188. package/src/common/errors/webex-errors.ts +50 -3
  189. package/src/config.ts +6 -2
  190. package/src/constants.ts +49 -3
  191. package/src/controls-options-manager/constants.ts +14 -1
  192. package/src/controls-options-manager/index.ts +87 -28
  193. package/src/controls-options-manager/util.ts +81 -1
  194. package/src/hashTree/constants.ts +17 -0
  195. package/src/hashTree/hashTree.ts +17 -0
  196. package/src/hashTree/hashTreeParser.ts +1482 -361
  197. package/src/hashTree/types.ts +4 -0
  198. package/src/hashTree/utils.ts +45 -0
  199. package/src/index.ts +14 -1
  200. package/src/interceptors/constant.ts +6 -0
  201. package/src/interceptors/dataChannelAuthToken.ts +246 -0
  202. package/src/interceptors/index.ts +2 -1
  203. package/src/interceptors/locusRetry.ts +25 -4
  204. package/src/interceptors/utils.ts +16 -0
  205. package/src/interpretation/index.ts +29 -11
  206. package/src/interpretation/interpretation.types.ts +11 -0
  207. package/src/locus-info/controlsUtils.ts +14 -1
  208. package/src/locus-info/index.ts +976 -203
  209. package/src/locus-info/infoUtils.ts +41 -6
  210. package/src/locus-info/selfUtils.ts +1 -0
  211. package/src/locus-info/types.ts +33 -1
  212. package/src/media/MediaConnectionAwaiter.ts +62 -5
  213. package/src/media/index.ts +10 -1
  214. package/src/media/properties.ts +11 -4
  215. package/src/meeting/in-meeting-actions.ts +20 -0
  216. package/src/meeting/index.ts +1300 -180
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +53 -0
  220. package/src/meeting/request.type.ts +6 -0
  221. package/src/meeting/util.ts +207 -7
  222. package/src/meeting-info/meeting-info-v2.ts +83 -21
  223. package/src/meetings/index.ts +402 -121
  224. package/src/meetings/meetings.types.ts +36 -1
  225. package/src/meetings/request.ts +43 -0
  226. package/src/meetings/util.ts +117 -4
  227. package/src/member/index.ts +20 -0
  228. package/src/member/types.ts +1 -0
  229. package/src/member/util.ts +41 -0
  230. package/src/members/index.ts +70 -7
  231. package/src/members/util.ts +12 -4
  232. package/src/metrics/constants.ts +12 -0
  233. package/src/multistream/codec/constants.ts +58 -0
  234. package/src/multistream/mediaRequestManager.ts +117 -76
  235. package/src/multistream/receiveSlot.ts +18 -0
  236. package/src/multistream/remoteMediaManager.ts +13 -0
  237. package/src/multistream/sendSlotManager.ts +97 -3
  238. package/src/reachability/clusterReachability.ts +3 -2
  239. package/src/reachability/index.ts +47 -16
  240. package/src/reachability/reachability.types.ts +11 -0
  241. package/src/reachability/util.ts +36 -0
  242. package/src/reactions/reactions.type.ts +4 -0
  243. package/src/reconnection-manager/index.ts +0 -1
  244. package/src/recording-controller/index.ts +1 -2
  245. package/src/roap/turnDiscovery.ts +9 -1
  246. package/src/webinar/index.ts +448 -11
  247. package/src/webinar/utils.ts +16 -0
  248. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  249. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  250. package/test/unit/spec/annotation/index.ts +70 -8
  251. package/test/unit/spec/breakouts/breakout.ts +9 -3
  252. package/test/unit/spec/breakouts/events.ts +120 -2
  253. package/test/unit/spec/breakouts/index.ts +223 -3
  254. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  255. package/test/unit/spec/controls-options-manager/index.js +244 -29
  256. package/test/unit/spec/controls-options-manager/util.js +165 -0
  257. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  258. package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
  259. package/test/unit/spec/hashTree/utils.ts +125 -1
  260. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
  261. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  262. package/test/unit/spec/interceptors/utils.ts +75 -0
  263. package/test/unit/spec/interpretation/index.ts +26 -4
  264. package/test/unit/spec/locus-info/controlsUtils.js +200 -56
  265. package/test/unit/spec/locus-info/index.js +1861 -149
  266. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  267. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  268. package/test/unit/spec/media/index.ts +92 -0
  269. package/test/unit/spec/media/properties.ts +35 -26
  270. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  271. package/test/unit/spec/meeting/index.js +3691 -366
  272. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  273. package/test/unit/spec/meeting/muteState.js +81 -0
  274. package/test/unit/spec/meeting/request.js +82 -0
  275. package/test/unit/spec/meeting/utils.js +595 -27
  276. package/test/unit/spec/meeting-info/meetinginfov2.js +286 -10
  277. package/test/unit/spec/meetings/index.js +1400 -78
  278. package/test/unit/spec/meetings/request.js +141 -0
  279. package/test/unit/spec/meetings/utils.js +402 -51
  280. package/test/unit/spec/member/index.js +35 -4
  281. package/test/unit/spec/member/util.js +154 -27
  282. package/test/unit/spec/members/index.js +216 -0
  283. package/test/unit/spec/members/request.js +37 -1
  284. package/test/unit/spec/members/utils.js +63 -0
  285. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  286. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  287. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  288. package/test/unit/spec/reachability/index.ts +128 -46
  289. package/test/unit/spec/reachability/util.ts +31 -0
  290. package/test/unit/spec/reconnection-manager/index.js +4 -8
  291. package/test/unit/spec/recording-controller/index.js +9 -8
  292. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  293. package/test/unit/spec/webinar/index.ts +837 -39
  294. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -10,6 +10,8 @@ export const ObjectType = {
10
10
  fullState: 'fullstate',
11
11
  links: 'links',
12
12
  control: 'controlentry',
13
+ metadata: 'metadata',
14
+ embeddedApp: 'embeddedapp',
13
15
  } as const;
14
16
 
15
17
  export type ObjectType = Enum<typeof ObjectType>;
@@ -23,7 +25,9 @@ export const ObjectTypeToLocusKeyMap = {
23
25
  [ObjectType.participant]: 'participants', // note: each object is a single participant in participants array
24
26
  [ObjectType.mediaShare]: 'mediaShares', // note: each object is a single mediaShare in mediaShares array
25
27
  [ObjectType.control]: 'controls', // note: each object is a single control entry in controls object
28
+ [ObjectType.embeddedApp]: 'embeddedApps', // note: each object is a single embedded app in embeddedApps array
26
29
  };
30
+
27
31
  export interface HtMeta {
28
32
  elementId: {
29
33
  type: ObjectType;
@@ -11,6 +11,15 @@ export function isSelf(object: HashTreeObject) {
11
11
  return object.htMeta.elementId.type.toLowerCase() === ObjectType.self;
12
12
  }
13
13
 
14
+ /**
15
+ * Checks if the given hash tree object is of type "Metadata"
16
+ * @param {HashTreeObject} object object to check
17
+ * @returns {boolean} True if the object is of type "Metadata", false otherwise
18
+ */
19
+ export function isMetadata(object: HashTreeObject) {
20
+ return object.htMeta.elementId.type.toLowerCase() === ObjectType.metadata;
21
+ }
22
+
14
23
  /**
15
24
  * Analyzes given part of Locus DTO recursively and delete any nested objects that have their own htMeta
16
25
  *
@@ -51,3 +60,39 @@ export const deleteNestedObjectsWithHtMeta = (
51
60
  }
52
61
  }
53
62
  };
63
+
64
+ /**
65
+ * Reorders items so that those matching the given priority list come first (in priority order),
66
+ * followed by everything else in their original order.
67
+ *
68
+ * @param {Array<T>} items - The items to reorder
69
+ * @param {string[]} priority - Ordered list of names that should come first
70
+ * @returns {Array<T>} A new array with prioritized items first
71
+ */
72
+ export function sortByInitPriority<T extends {name: string}>(items: T[], priority: string[]): T[] {
73
+ const prioritized = priority
74
+ .map((name) => items.find((item) => item.name === name))
75
+ .filter(Boolean) as T[];
76
+ const rest = items.filter((item) => !priority.includes(item.name));
77
+
78
+ return [...prioritized, ...rest];
79
+ }
80
+
81
+ /**
82
+ * Sleeps for the specified amount of milliseconds
83
+ *
84
+ * @param {number} ms amount of milliseconds to sleep
85
+ * @returns {Promise<void>} A promise that resolves after the specified delay
86
+ */
87
+ export function sleep(ms: number): Promise<void> {
88
+ if (ms <= 0) {
89
+ return Promise.resolve();
90
+ }
91
+
92
+ return new Promise((resolve) => {
93
+ // start a timer that will resolve the promise after the specified delay
94
+ setTimeout(() => {
95
+ resolve();
96
+ }, ms);
97
+ });
98
+ }
package/src/index.ts CHANGED
@@ -3,7 +3,11 @@ import {registerPlugin} from '@webex/webex-core';
3
3
 
4
4
  import Meetings from './meetings';
5
5
  import config from './config';
6
- import {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor} from './interceptors';
6
+ import {
7
+ LocusRetryStatusInterceptor,
8
+ LocusRouteTokenInterceptor,
9
+ DataChannelAuthTokenInterceptor,
10
+ } from './interceptors';
7
11
  import CaptchaError from './common/errors/captcha-error';
8
12
  import IntentToJoinError from './common/errors/intent-to-join';
9
13
  import PasswordError from './common/errors/password-error';
@@ -25,6 +29,7 @@ registerPlugin('meetings', Meetings, {
25
29
  interceptors: {
26
30
  LocusRetryStatusInterceptor: LocusRetryStatusInterceptor.create,
27
31
  LocusRouteTokenInterceptor: LocusRouteTokenInterceptor.create,
32
+ DataChannelAuthTokenInterceptor: DataChannelAuthTokenInterceptor.create,
28
33
  },
29
34
  });
30
35
 
@@ -60,6 +65,12 @@ export * as REACTIONS from './reactions/reactions';
60
65
  export * as sdkAnnotationTypes from './annotation/annotation.types';
61
66
  export * as MeetingInfoV2 from './meeting-info/meeting-info-v2';
62
67
  export {type Reaction} from './reactions/reactions.type';
68
+ export {SitePreferenceSelectOption} from './meetings/meetings.types';
69
+ export type {
70
+ FetchSitePreferencesMeViaSiteOptions,
71
+ SitePreferencesResponse,
72
+ } from './meetings/meetings.types';
73
+ export type {Interpreter, InterpreterUsingResource} from './interpretation/interpretation.types';
63
74
 
64
75
  export {
65
76
  CaptchaError,
@@ -80,3 +91,5 @@ export {
80
91
  export {RemoteMedia} from './multistream/remoteMedia';
81
92
 
82
93
  export {default as TriggerProxy} from './common/events/trigger-proxy';
94
+
95
+ export {getAIEnablementApprover} from './aiEnableRequest/utils';
@@ -0,0 +1,6 @@
1
+ const DATA_CHANNEL_AUTH_HEADER = 'Data-Channel-Auth-Token';
2
+ const MAX_RETRY = 1;
3
+ const RETRY_INTERVAL = 2000;
4
+ const RETRY_KEY = '_dcRetryKey';
5
+
6
+ export {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY};
@@ -0,0 +1,246 @@
1
+ /*!
2
+ * Copyright (c) 2015-2026 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {Interceptor} from '@webex/http-core';
6
+ import LLMChannel from '@webex/internal-plugin-llm';
7
+ import LoggerProxy from '../common/logs/logger-proxy';
8
+ import {DATA_CHANNEL_AUTH_HEADER, MAX_RETRY, RETRY_INTERVAL, RETRY_KEY} from './constant';
9
+ import {isJwtTokenExpired} from './utils';
10
+ import {LLM_DEFAULT_SESSION, LLM_PRACTICE_SESSION, LOCUS_URL} from '../constants';
11
+
12
+ const retryCountMap = new Map();
13
+ interface HttpLikeError extends Error {
14
+ statusCode?: number;
15
+ original?: any;
16
+ }
17
+ /**
18
+ * @class
19
+ */
20
+ export default class DataChannelAuthTokenInterceptor extends Interceptor {
21
+ private _refreshDataChannelToken: (requestUrl?: string) => Promise<string>;
22
+ private _isDataChannelTokenEnabled: () => Promise<boolean>;
23
+ constructor(options) {
24
+ super(options);
25
+
26
+ this._refreshDataChannelToken = options.refreshDataChannelToken;
27
+ this._isDataChannelTokenEnabled = options.isDataChannelTokenEnabled;
28
+ }
29
+
30
+ /**
31
+ * @returns {DataChannelAuthTokenInterceptor}
32
+ */
33
+ static create() {
34
+ // @ts-ignore
35
+ return new DataChannelAuthTokenInterceptor({
36
+ webex: this,
37
+
38
+ isDataChannelTokenEnabled: async () => {
39
+ // @ts-ignore
40
+ return this.internal.llm.isDataChannelTokenEnabled();
41
+ },
42
+
43
+ // Route refresh by request URL in two steps:
44
+ // 1) Match active LLM sessions (supports non-default/multiple sessions)
45
+ // 2) If no session matches, resolve locusUrl and refresh via owning meeting
46
+ // If neither route matches, fall back to the default-session refresh.
47
+ refreshDataChannelToken: async (requestUrl?: string) => {
48
+ let sessionId;
49
+ let meeting;
50
+
51
+ if (typeof requestUrl === 'string') {
52
+ // @ts-ignore
53
+ sessionId = this.internal.llm.getSessionIdByDatachannelUrl?.(requestUrl);
54
+
55
+ if (!sessionId) {
56
+ // @ts-ignore
57
+ const locusUrl = this.internal.llm.getLocusUrlByDatachannelUrl?.(requestUrl);
58
+
59
+ if (locusUrl) {
60
+ // @ts-ignore
61
+ meeting = this.meetings?.getMeetingByType?.(LOCUS_URL, locusUrl);
62
+ }
63
+ }
64
+
65
+ if (!meeting) {
66
+ // Fallback: registerAndConnect() pre-populates datachannelUrl in
67
+ // connections before calling register(), so getSessionIdByDatachannelUrl
68
+ // above should normally resolve. This scan covers any residual gap
69
+ // where connections are not yet populated (e.g. if setRefreshHandler
70
+ // is called on a session that has no connection entry at all).
71
+ // @ts-ignore
72
+ const allMeetings = this.meetings?.getAllMeetings?.() || {};
73
+
74
+ meeting = Object.values(allMeetings).find((activeMeeting: any) => {
75
+ const info = activeMeeting?.locusInfo?.info || {};
76
+
77
+ return (
78
+ (info.practiceSessionDatachannelUrl &&
79
+ LLMChannel.matchesDatachannelRequestUrl(
80
+ requestUrl,
81
+ info.practiceSessionDatachannelUrl
82
+ )) ||
83
+ (info.datachannelUrl &&
84
+ LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl))
85
+ );
86
+ });
87
+
88
+ if (!sessionId) {
89
+ // @ts-ignore
90
+ const info = meeting?.locusInfo?.info || {};
91
+
92
+ if (
93
+ info.practiceSessionDatachannelUrl &&
94
+ LLMChannel.matchesDatachannelRequestUrl(
95
+ requestUrl,
96
+ info.practiceSessionDatachannelUrl
97
+ )
98
+ ) {
99
+ sessionId = LLM_PRACTICE_SESSION;
100
+ } else if (
101
+ info.datachannelUrl &&
102
+ LLMChannel.matchesDatachannelRequestUrl(requestUrl, info.datachannelUrl)
103
+ ) {
104
+ sessionId = LLM_DEFAULT_SESSION;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ let result;
111
+ if (meeting) {
112
+ result = await meeting.refreshDataChannelToken();
113
+ } else {
114
+ // @ts-ignore
115
+ result = await this.internal.llm.refreshDataChannelToken(sessionId);
116
+ }
117
+
118
+ if (!result?.body) {
119
+ throw new Error('DataChannel token refresh returned no payload');
120
+ }
121
+ const {datachannelToken, dataChannelTokenType} = result.body;
122
+ const tokenStoreKey = dataChannelTokenType || sessionId;
123
+ const ownerMeetingId =
124
+ // @ts-ignore
125
+ meeting?.id || this.internal.llm.getOwnerMeetingId?.(tokenStoreKey);
126
+ // @ts-ignore
127
+ this.internal.llm.setDatachannelToken(datachannelToken, tokenStoreKey, ownerMeetingId);
128
+
129
+ return datachannelToken;
130
+ },
131
+ });
132
+ }
133
+
134
+ private getRetryKey(options) {
135
+ if (!options[RETRY_KEY]) {
136
+ options[RETRY_KEY] = `${Date.now()}-${Math.random()}`;
137
+ }
138
+
139
+ return options[RETRY_KEY];
140
+ }
141
+
142
+ // Helper function to get header value case insensitively
143
+ private getHeader(headers: Record<string, string>, name: string) {
144
+ const key = Object.keys(headers).find((k) => k.toLowerCase() === name.toLowerCase());
145
+
146
+ return key ? headers[key] : undefined;
147
+ }
148
+
149
+ /**
150
+ * Intercepts outgoing requests and refreshes the Data-Channel-Auth-Token
151
+ * if the current JWT token is expired before the request is sent.
152
+ *
153
+ * @param {Object} options - The original request options.
154
+ * @returns {Promise<Object>} Updated request options with refreshed token if needed.
155
+ */
156
+ async onRequest(options) {
157
+ const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);
158
+ const enabled = await this._isDataChannelTokenEnabled();
159
+
160
+ if (!token || !enabled) {
161
+ return options;
162
+ }
163
+
164
+ if (isJwtTokenExpired(token)) {
165
+ try {
166
+ const newToken = await this._refreshDataChannelToken(options.uri || options.url);
167
+ options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;
168
+ } catch (e) {
169
+ LoggerProxy.logger.warn(`DataChannelAuthTokenInterceptor: refresh failed: ${e.message}`);
170
+ }
171
+ }
172
+
173
+ return options;
174
+ }
175
+
176
+ /**
177
+ * Intercept responses and, on 401/403 with `Data-Channel-Auth-Token` header,
178
+ * attempt to refresh the data channel token and retry the original request once.
179
+ *
180
+ * @param {Object} options
181
+ * @param {Object} reason
182
+ * @returns {Promise<HttpResponse>}
183
+ */
184
+ async onResponseError(options, reason) {
185
+ const token = this.getHeader(options.headers, DATA_CHANNEL_AUTH_HEADER);
186
+ const enabled = await this._isDataChannelTokenEnabled();
187
+
188
+ if (!token || !enabled) {
189
+ return Promise.reject(reason);
190
+ }
191
+
192
+ if (reason.statusCode !== 401 && reason.statusCode !== 403) {
193
+ return Promise.reject(reason);
194
+ }
195
+
196
+ const key = this.getRetryKey(options);
197
+ const retryCount = retryCountMap.get(key) || 0;
198
+
199
+ if (retryCount >= MAX_RETRY) {
200
+ LoggerProxy.logger.error(`data channel token refresh exceeded max retry (${MAX_RETRY})`);
201
+ retryCountMap.delete(key);
202
+
203
+ return Promise.reject(reason);
204
+ }
205
+
206
+ retryCountMap.set(key, retryCount + 1);
207
+
208
+ return this.refreshTokenAndRetryWithDelay(options);
209
+ }
210
+
211
+ /**
212
+ * Retry the failed data channel request after a delay.
213
+ * Refreshes the Data-Channel-Auth-Token and re-sends the original request.
214
+ *
215
+ * @param {Object} options - Original request options.
216
+ * @returns {Promise<HttpResponse>} - Resolves on successful retry.
217
+ */
218
+ refreshTokenAndRetryWithDelay(options) {
219
+ return new Promise((resolve, reject) => {
220
+ setTimeout(async () => {
221
+ const key = this.getRetryKey(options);
222
+ try {
223
+ const newToken = await this._refreshDataChannelToken(options.uri || options.url);
224
+
225
+ options.headers[DATA_CHANNEL_AUTH_HEADER] = newToken;
226
+
227
+ // @ts-ignore
228
+ const res = await this.webex.request(options);
229
+ retryCountMap.delete(key);
230
+
231
+ resolve(res);
232
+ } catch (e) {
233
+ retryCountMap.delete(key);
234
+
235
+ const msg = e?.message || String(e);
236
+
237
+ const err: HttpLikeError = new Error(`DataChannel token refresh failed: ${msg}`);
238
+ err.statusCode = e?.statusCode;
239
+ err.original = e;
240
+
241
+ reject(err);
242
+ }
243
+ }, RETRY_INTERVAL);
244
+ });
245
+ }
246
+ }
@@ -1,4 +1,5 @@
1
1
  import LocusRetryStatusInterceptor from './locusRetry';
2
2
  import LocusRouteTokenInterceptor from './locusRouteToken';
3
+ import DataChannelAuthTokenInterceptor from './dataChannelAuthToken';
3
4
 
4
- export {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor};
5
+ export {LocusRetryStatusInterceptor, LocusRouteTokenInterceptor, DataChannelAuthTokenInterceptor};
@@ -18,12 +18,33 @@ export default class LocusRetryStatusInterceptor extends Interceptor {
18
18
  }
19
19
 
20
20
  /**
21
- * Handle response errors
22
- * @param {Object} options
23
- * @param {WebexHttpError} reason
24
- * @returns {Promise<WebexHttpError>}
21
+ * Check whether a URI is a Locus /hashtree or /sync endpoint.
22
+ * @param {string} uri
23
+ * @returns {boolean}
25
24
  */
25
+ private static isLocusHashtreeOrSync(uri: string): boolean {
26
+ try {
27
+ const {pathname} = new URL(uri);
28
+
29
+ return (
30
+ pathname.includes('/locus/') &&
31
+ (pathname.endsWith('/hashtree') || pathname.endsWith('/sync'))
32
+ );
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+
26
38
  onResponseError(options, reason) {
39
+ // Don't retry /hashtree or /sync calls for 429 or any 5xx — during a sync storm retries
40
+ // make things worse. The normal sync timers will handle recovery for these endpoints.
41
+ if (
42
+ (reason.statusCode === 429 || reason.statusCode >= 500) &&
43
+ LocusRetryStatusInterceptor.isLocusHashtreeOrSync(options.uri)
44
+ ) {
45
+ return Promise.reject(reason);
46
+ }
47
+
27
48
  if ((reason.statusCode === 503 || reason.statusCode === 429) && options.uri.includes('locus')) {
28
49
  const hasRetriedLocusRequest = rateLimitExpiryTime.get(this);
29
50
  const retryAfterTime = options.headers['retry-after'] || 2000;
@@ -0,0 +1,16 @@
1
+ import * as jose from 'jose';
2
+
3
+ const EXPIRY_BUFFER = 30 * 1000;
4
+
5
+ // eslint-disable-next-line import/prefer-default-export
6
+ export const isJwtTokenExpired = (token: string): boolean => {
7
+ try {
8
+ const payload = jose.decodeJwt(token);
9
+
10
+ if (!payload?.exp) return false;
11
+
12
+ return payload.exp * 1000 < Date.now() + EXPIRY_BUFFER;
13
+ } catch {
14
+ return true;
15
+ }
16
+ };
@@ -3,9 +3,11 @@
3
3
  */
4
4
  import {WebexPlugin} from '@webex/webex-core';
5
5
  import LoggerProxy from '../common/logs/logger-proxy';
6
- import {HTTP_VERBS, INTERPRETATION, MEETINGS} from '../constants';
6
+ import {HTTP_VERBS, INTERPRETATION, LOCUSEVENT, MEETINGS} from '../constants';
7
+ import MeetingUtil from '../meeting/util';
7
8
 
8
9
  import SILanguageCollection from './collection';
10
+ import {Interpreter} from './interpretation.types';
9
11
 
10
12
  /**
11
13
  * @class SimultaneousInterpretation
@@ -182,7 +184,9 @@ const SimultaneousInterpretation = WebexPlugin.extend({
182
184
  * @param {Array} interpreters
183
185
  * @returns {Promise}
184
186
  */
185
- updateInterpreters(interpreters) {
187
+ updateInterpreters(interpreters: Interpreter[]) {
188
+ const meeting = this.webex.meetings.meetingCollection.getByKey('locusUrl', this.locusUrl);
189
+
186
190
  return this.request({
187
191
  method: HTTP_VERBS.PATCH,
188
192
  uri: `${this.locusUrl}/controls`,
@@ -191,10 +195,16 @@ const SimultaneousInterpretation = WebexPlugin.extend({
191
195
  interpreters,
192
196
  },
193
197
  },
194
- }).catch((error) => {
195
- LoggerProxy.logger.error('Meeting:interpretation#updateInterpreters failed', error);
196
- throw error;
197
- });
198
+ })
199
+ .then((response) => {
200
+ MeetingUtil.updateLocusFromApiResponse(meeting, response);
201
+
202
+ return response;
203
+ })
204
+ .catch((error) => {
205
+ LoggerProxy.logger.error('Meeting:interpretation#updateInterpreters failed', error);
206
+ throw error;
207
+ });
198
208
  },
199
209
  /**
200
210
  * Change direction of interpretation for an interpreter participant
@@ -209,6 +219,8 @@ const SimultaneousInterpretation = WebexPlugin.extend({
209
219
  return Promise.reject(new Error('Missing self participant id'));
210
220
  }
211
221
 
222
+ const meeting = this.webex.meetings.meetingCollection.getByKey('locusUrl', this.locusUrl);
223
+
212
224
  return this.request({
213
225
  method: HTTP_VERBS.PATCH,
214
226
  uri: `${this.locusUrl}/participant/${this.selfParticipantId}/controls`,
@@ -220,17 +232,23 @@ const SimultaneousInterpretation = WebexPlugin.extend({
220
232
  order: this.order,
221
233
  },
222
234
  },
223
- }).catch((error) => {
224
- LoggerProxy.logger.error('Meeting:interpretation#changeDirection failed', error);
225
- throw error;
226
- });
235
+ })
236
+ .then((response) => {
237
+ MeetingUtil.updateLocusFromApiResponse(meeting, response);
238
+
239
+ return response;
240
+ })
241
+ .catch((error) => {
242
+ LoggerProxy.logger.error('Meeting:interpretation#changeDirection failed', error);
243
+ throw error;
244
+ });
227
245
  },
228
246
  /**
229
247
  * Sets up a listener for handoff requests from mercury
230
248
  * @returns {void}
231
249
  */
232
250
  listenToHandoffRequests() {
233
- this.listenTo(this.webex.internal.mercury, 'event:locus.approval_request', (event) => {
251
+ this.listenTo(this.webex.internal.mercury, `event:${LOCUSEVENT.APPROVAL_REQUEST}`, (event) => {
234
252
  if (event?.data?.approval?.resourceType === INTERPRETATION.RESOURCE_TYPE) {
235
253
  const {receivers, initiator, actionType, url} = event.data.approval;
236
254
  const receiverId = receivers?.[0]?.participantId;
@@ -0,0 +1,11 @@
1
+ export type InterpreterUsingResource = {
2
+ id: string;
3
+ email?: string;
4
+ };
5
+
6
+ export type Interpreter = {
7
+ order: number;
8
+ sourceLanguage: string;
9
+ targetLanguage: string;
10
+ usingResource: InterpreterUsingResource;
11
+ };
@@ -26,7 +26,9 @@ ControlsUtils.parse = (controls: any) => {
26
26
  modifiedBy: ControlsUtils.getId(controls),
27
27
  paused: controls.record.paused ? controls.record.paused : false,
28
28
  recording: controls.record.recording,
29
- lastModified: controls.record.meta.lastModified,
29
+ lastModified: controls.record.meta?.lastModified,
30
+ modifiedByServiceAppName: controls.record.meta?.modifiedByServiceAppName,
31
+ modifiedByServiceAppId: controls.record.meta?.modifiedByServiceAppId,
30
32
  };
31
33
  }
32
34
 
@@ -42,6 +44,7 @@ ControlsUtils.parse = (controls: any) => {
42
44
  caption: controls.transcribe.caption,
43
45
  spokenLanguage: controls.transcribe.spokenLanguage,
44
46
  hesiodLlmId: controls.transcribe.hesiodLlmId,
47
+ aiSummaryNotification: controls.transcribe.aiSummaryNotification,
45
48
  };
46
49
  }
47
50
 
@@ -208,6 +211,16 @@ ControlsUtils.getControls = (oldControls: any, newControls: any) => {
208
211
  !isEqual(previous?.transcribe?.hesiodLlmId, current?.transcribe?.hesiodLlmId) &&
209
212
  !!(previous?.transcribe?.hesiodLlmId || current?.transcribe?.hesiodLlmId),
210
213
 
214
+ hasAiSummaryNotificationChanged:
215
+ current?.transcribe &&
216
+ !isEqual(
217
+ previous?.transcribe?.aiSummaryNotification,
218
+ current?.transcribe?.aiSummaryNotification
219
+ ) &&
220
+ !!(
221
+ previous?.transcribe?.aiSummaryNotification || current?.transcribe?.aiSummaryNotification
222
+ ),
223
+
211
224
  hasTranscribeSpokenLanguageChanged:
212
225
  current?.transcribe &&
213
226
  !isEqual(previous?.transcribe?.spokenLanguage, current?.transcribe?.spokenLanguage) &&