@webex/plugin-meetings 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 (227) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +15 -2
  3. package/dist/aiEnableRequest/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +8 -3
  5. package/dist/breakouts/breakout.js.map +1 -1
  6. package/dist/breakouts/events.js +29 -14
  7. package/dist/breakouts/events.js.map +1 -1
  8. package/dist/breakouts/index.js +90 -3
  9. package/dist/breakouts/index.js.map +1 -1
  10. package/dist/common/errors/webex-errors.js +49 -5
  11. package/dist/common/errors/webex-errors.js.map +1 -1
  12. package/dist/config.js +2 -2
  13. package/dist/config.js.map +1 -1
  14. package/dist/constants.js +37 -10
  15. package/dist/constants.js.map +1 -1
  16. package/dist/controls-options-manager/index.js +46 -10
  17. package/dist/controls-options-manager/index.js.map +1 -1
  18. package/dist/hashTree/constants.js +4 -1
  19. package/dist/hashTree/constants.js.map +1 -1
  20. package/dist/hashTree/hashTreeParser.js +1045 -393
  21. package/dist/hashTree/hashTreeParser.js.map +1 -1
  22. package/dist/hashTree/utils.js +20 -0
  23. package/dist/hashTree/utils.js.map +1 -1
  24. package/dist/index.js +7 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  27. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  28. package/dist/interceptors/locusRetry.js +23 -8
  29. package/dist/interceptors/locusRetry.js.map +1 -1
  30. package/dist/interpretation/index.js +10 -1
  31. package/dist/interpretation/index.js.map +1 -1
  32. package/dist/interpretation/interpretation.types.js +7 -0
  33. package/dist/interpretation/interpretation.types.js.map +1 -0
  34. package/dist/interpretation/siLanguage.js +1 -1
  35. package/dist/locus-info/controlsUtils.js +4 -1
  36. package/dist/locus-info/controlsUtils.js.map +1 -1
  37. package/dist/locus-info/index.js +406 -121
  38. package/dist/locus-info/index.js.map +1 -1
  39. package/dist/locus-info/infoUtils.js +36 -5
  40. package/dist/locus-info/infoUtils.js.map +1 -1
  41. package/dist/locus-info/types.js +19 -0
  42. package/dist/locus-info/types.js.map +1 -1
  43. package/dist/media/MediaConnectionAwaiter.js +15 -2
  44. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  45. package/dist/media/index.js +8 -2
  46. package/dist/media/index.js.map +1 -1
  47. package/dist/media/properties.js +4 -5
  48. package/dist/media/properties.js.map +1 -1
  49. package/dist/meeting/in-meeting-actions.js +5 -1
  50. package/dist/meeting/in-meeting-actions.js.map +1 -1
  51. package/dist/meeting/index.js +1667 -834
  52. package/dist/meeting/index.js.map +1 -1
  53. package/dist/meeting/locusMediaRequest.js +229 -82
  54. package/dist/meeting/locusMediaRequest.js.map +1 -1
  55. package/dist/meeting/muteState.js +10 -1
  56. package/dist/meeting/muteState.js.map +1 -1
  57. package/dist/meeting/request.js +5 -2
  58. package/dist/meeting/request.js.map +1 -1
  59. package/dist/meeting/util.js +34 -2
  60. package/dist/meeting/util.js.map +1 -1
  61. package/dist/meeting-info/meeting-info-v2.js +2 -2
  62. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  63. package/dist/meetings/index.js +256 -118
  64. package/dist/meetings/index.js.map +1 -1
  65. package/dist/meetings/meetings.types.js +6 -1
  66. package/dist/meetings/meetings.types.js.map +1 -1
  67. package/dist/meetings/request.js +39 -0
  68. package/dist/meetings/request.js.map +1 -1
  69. package/dist/meetings/util.js +116 -18
  70. package/dist/meetings/util.js.map +1 -1
  71. package/dist/member/index.js +10 -0
  72. package/dist/member/index.js.map +1 -1
  73. package/dist/member/types.js.map +1 -1
  74. package/dist/member/util.js +30 -0
  75. package/dist/member/util.js.map +1 -1
  76. package/dist/members/index.js +101 -43
  77. package/dist/members/index.js.map +1 -1
  78. package/dist/members/util.js +8 -1
  79. package/dist/members/util.js.map +1 -1
  80. package/dist/metrics/constants.js +7 -1
  81. package/dist/metrics/constants.js.map +1 -1
  82. package/dist/multistream/codec/constants.js +63 -0
  83. package/dist/multistream/codec/constants.js.map +1 -0
  84. package/dist/multistream/mediaRequestManager.js +62 -15
  85. package/dist/multistream/mediaRequestManager.js.map +1 -1
  86. package/dist/multistream/receiveSlot.js +9 -0
  87. package/dist/multistream/receiveSlot.js.map +1 -1
  88. package/dist/reachability/clusterReachability.js.map +1 -1
  89. package/dist/reachability/index.js +121 -83
  90. package/dist/reachability/index.js.map +1 -1
  91. package/dist/reachability/reachability.types.js +2 -0
  92. package/dist/reachability/reachability.types.js.map +1 -1
  93. package/dist/reachability/util.js +45 -0
  94. package/dist/reachability/util.js.map +1 -1
  95. package/dist/reactions/reactions.type.js.map +1 -1
  96. package/dist/recording-controller/index.js +1 -3
  97. package/dist/recording-controller/index.js.map +1 -1
  98. package/dist/roap/turnDiscovery.js +8 -1
  99. package/dist/roap/turnDiscovery.js.map +1 -1
  100. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  101. package/dist/types/config.d.ts +2 -2
  102. package/dist/types/constants.d.ts +13 -1
  103. package/dist/types/controls-options-manager/index.d.ts +16 -0
  104. package/dist/types/hashTree/constants.d.ts +1 -0
  105. package/dist/types/hashTree/hashTreeParser.d.ts +189 -22
  106. package/dist/types/hashTree/utils.d.ts +7 -0
  107. package/dist/types/index.d.ts +3 -0
  108. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  109. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  110. package/dist/types/locus-info/index.d.ts +61 -7
  111. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  112. package/dist/types/locus-info/types.d.ts +21 -1
  113. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  114. package/dist/types/media/properties.d.ts +6 -2
  115. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  116. package/dist/types/meeting/index.d.ts +175 -11
  117. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  118. package/dist/types/meeting/request.d.ts +1 -0
  119. package/dist/types/meeting/util.d.ts +9 -0
  120. package/dist/types/meetings/index.d.ts +38 -18
  121. package/dist/types/meetings/meetings.types.d.ts +15 -0
  122. package/dist/types/meetings/request.d.ts +14 -0
  123. package/dist/types/member/index.d.ts +1 -0
  124. package/dist/types/member/types.d.ts +1 -0
  125. package/dist/types/member/util.d.ts +9 -0
  126. package/dist/types/members/index.d.ts +15 -2
  127. package/dist/types/members/util.d.ts +1 -5
  128. package/dist/types/metrics/constants.d.ts +6 -0
  129. package/dist/types/multistream/codec/constants.d.ts +7 -0
  130. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  131. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  132. package/dist/types/reachability/index.d.ts +10 -3
  133. package/dist/types/reachability/reachability.types.d.ts +7 -0
  134. package/dist/types/reachability/util.d.ts +17 -0
  135. package/dist/types/reactions/reactions.type.d.ts +3 -0
  136. package/dist/webinar/index.js +307 -161
  137. package/dist/webinar/index.js.map +1 -1
  138. package/package.json +23 -23
  139. package/src/aiEnableRequest/index.ts +16 -0
  140. package/src/breakouts/breakout.ts +3 -1
  141. package/src/breakouts/events.ts +33 -11
  142. package/src/breakouts/index.ts +110 -1
  143. package/src/common/errors/webex-errors.ts +50 -3
  144. package/src/config.ts +2 -2
  145. package/src/constants.ts +21 -3
  146. package/src/controls-options-manager/index.ts +62 -10
  147. package/src/hashTree/constants.ts +7 -0
  148. package/src/hashTree/hashTreeParser.ts +796 -192
  149. package/src/hashTree/utils.ts +19 -0
  150. package/src/index.ts +6 -0
  151. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  152. package/src/interceptors/locusRetry.ts +25 -4
  153. package/src/interpretation/index.ts +27 -9
  154. package/src/interpretation/interpretation.types.ts +11 -0
  155. package/src/locus-info/controlsUtils.ts +3 -1
  156. package/src/locus-info/index.ts +412 -130
  157. package/src/locus-info/infoUtils.ts +41 -6
  158. package/src/locus-info/types.ts +25 -1
  159. package/src/media/MediaConnectionAwaiter.ts +21 -4
  160. package/src/media/index.ts +10 -1
  161. package/src/media/properties.ts +8 -3
  162. package/src/meeting/in-meeting-actions.ts +8 -0
  163. package/src/meeting/index.ts +922 -116
  164. package/src/meeting/locusMediaRequest.ts +106 -6
  165. package/src/meeting/muteState.ts +10 -1
  166. package/src/meeting/request.ts +11 -0
  167. package/src/meeting/util.ts +46 -5
  168. package/src/meeting-info/meeting-info-v2.ts +4 -2
  169. package/src/meetings/index.ts +168 -79
  170. package/src/meetings/meetings.types.ts +19 -0
  171. package/src/meetings/request.ts +43 -0
  172. package/src/meetings/util.ts +117 -4
  173. package/src/member/index.ts +10 -0
  174. package/src/member/types.ts +1 -0
  175. package/src/member/util.ts +29 -0
  176. package/src/members/index.ts +70 -7
  177. package/src/members/util.ts +12 -4
  178. package/src/metrics/constants.ts +6 -0
  179. package/src/multistream/codec/constants.ts +58 -0
  180. package/src/multistream/mediaRequestManager.ts +119 -28
  181. package/src/multistream/receiveSlot.ts +18 -0
  182. package/src/reachability/clusterReachability.ts +3 -2
  183. package/src/reachability/index.ts +47 -16
  184. package/src/reachability/reachability.types.ts +11 -0
  185. package/src/reachability/util.ts +36 -0
  186. package/src/reactions/reactions.type.ts +3 -0
  187. package/src/recording-controller/index.ts +1 -2
  188. package/src/roap/turnDiscovery.ts +9 -1
  189. package/src/webinar/index.ts +216 -38
  190. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  191. package/test/unit/spec/breakouts/breakout.ts +9 -3
  192. package/test/unit/spec/breakouts/events.ts +120 -2
  193. package/test/unit/spec/breakouts/index.ts +191 -2
  194. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  195. package/test/unit/spec/controls-options-manager/index.js +139 -32
  196. package/test/unit/spec/hashTree/hashTreeParser.ts +2299 -243
  197. package/test/unit/spec/hashTree/utils.ts +37 -0
  198. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  199. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  200. package/test/unit/spec/interpretation/index.ts +26 -4
  201. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  202. package/test/unit/spec/locus-info/index.js +643 -63
  203. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  204. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  205. package/test/unit/spec/media/index.ts +92 -0
  206. package/test/unit/spec/media/properties.ts +23 -23
  207. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  208. package/test/unit/spec/meeting/index.js +2704 -135
  209. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  210. package/test/unit/spec/meeting/muteState.js +81 -0
  211. package/test/unit/spec/meeting/request.js +12 -0
  212. package/test/unit/spec/meeting/utils.js +153 -1
  213. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  214. package/test/unit/spec/meetings/index.js +479 -48
  215. package/test/unit/spec/meetings/request.js +141 -0
  216. package/test/unit/spec/meetings/utils.js +402 -51
  217. package/test/unit/spec/member/index.js +7 -0
  218. package/test/unit/spec/member/util.js +89 -0
  219. package/test/unit/spec/members/index.js +216 -0
  220. package/test/unit/spec/members/request.js +37 -1
  221. package/test/unit/spec/members/utils.js +63 -0
  222. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  223. package/test/unit/spec/reachability/index.ts +128 -46
  224. package/test/unit/spec/reachability/util.ts +31 -0
  225. package/test/unit/spec/recording-controller/index.js +9 -8
  226. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  227. package/test/unit/spec/webinar/index.ts +332 -31
@@ -3,6 +3,7 @@ import sinon from 'sinon';
3
3
  import {cloneDeep, forEach} from 'lodash';
4
4
  import {assert} from '@webex/test-helper-chai';
5
5
  import MockWebex from '@webex/test-helper-mock-webex';
6
+ import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
6
7
  import testUtils from '../../../utils/testUtils';
7
8
  import Meetings from '@webex/plugin-meetings';
8
9
  import LocusInfo, {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '@webex/plugin-meetings/src/locus-info';
@@ -13,6 +14,7 @@ import MediaSharesUtils from '@webex/plugin-meetings/src/locus-info//mediaShares
13
14
  import LocusDeltaParser from '@webex/plugin-meetings/src/locus-info/parser';
14
15
  import Metrics from '@webex/plugin-meetings/src/metrics';
15
16
  import * as HashTreeParserModule from '@webex/plugin-meetings/src/hashTree/hashTreeParser';
17
+ import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
16
18
 
17
19
  import {
18
20
  LOCUSINFO,
@@ -30,6 +32,7 @@ import {
30
32
 
31
33
  import {self, selfWithInactivity} from './selfConstant';
32
34
  import {MEETING_REMOVED_REASON} from '@webex/plugin-meetings/src/constants';
35
+ import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
33
36
  import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
34
37
 
35
38
  describe('plugin-meetings', () => {
@@ -55,7 +58,7 @@ describe('plugin-meetings', () => {
55
58
 
56
59
  beforeEach(() => {
57
60
  mockMeeting = {};
58
- locusInfo = new LocusInfo(updateMeeting, webex, meetingId);
61
+ locusInfo = new LocusInfo({updateMeeting}, webex, meetingId);
59
62
 
60
63
  locusInfo.init(locus);
61
64
 
@@ -147,7 +150,9 @@ describe('plugin-meetings', () => {
147
150
  visibleDataSets,
148
151
  },
149
152
  webexRequest: sinon.match.func,
150
- locusInfoUpdateCallback: sinon.match.func,
153
+ callbacks: sinon.match({
154
+ locusInfoUpdateCallback: sinon.match.func,
155
+ }),
151
156
  debugId: sinon.match.string,
152
157
  })
153
158
  );
@@ -157,6 +162,39 @@ describe('plugin-meetings', () => {
157
162
  assert.isTrue(locusInfo.emitChange);
158
163
  });
159
164
 
165
+ it('passes a generateTrackingId callback that reuses the tracking-id interceptor sequence', async () => {
166
+ webex.sessionId = 'test-session';
167
+ const hashTreeMessage = createHashTreeMessage(['dataset1']);
168
+
169
+ await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
170
+
171
+ const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
172
+
173
+ // The interceptor for this webex is present in the exposed map -> reuse its sequence.
174
+ const fakeInterceptor = {webex, sequence: 7};
175
+ webexTrackingIdSequenceNumbers.set(fakeInterceptor, 0);
176
+
177
+ try {
178
+ assert.equal(generateTrackingId(), 'test-session_7');
179
+ } finally {
180
+ webexTrackingIdSequenceNumbers.delete(fakeInterceptor);
181
+ }
182
+ });
183
+
184
+ it('passes a generateTrackingId callback that falls back to a uuid when no interceptor is registered', async () => {
185
+ webex.sessionId = 'test-session';
186
+ const hashTreeMessage = createHashTreeMessage(['dataset1']);
187
+
188
+ await locusInfo.initialSetup({trigger: 'locus-message', hashTreeMessage});
189
+
190
+ const {generateTrackingId} = HashTreeParserStub.firstCall.args[0].callbacks;
191
+
192
+ assert.match(
193
+ generateTrackingId(),
194
+ /^test-session_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
195
+ );
196
+ });
197
+
160
198
  it('should not initialize the hash tree when triggered from a non-hash tree locus message', async () => {
161
199
  const locus = {url: 'http://locus-url.com', participants: []};
162
200
 
@@ -197,7 +235,9 @@ describe('plugin-meetings', () => {
197
235
  },
198
236
  metadata,
199
237
  webexRequest: sinon.match.func,
200
- locusInfoUpdateCallback: sinon.match.func,
238
+ callbacks: sinon.match({
239
+ locusInfoUpdateCallback: sinon.match.func,
240
+ }),
201
241
  debugId: sinon.match.string,
202
242
  })
203
243
  );
@@ -220,6 +260,47 @@ describe('plugin-meetings', () => {
220
260
  assert.isTrue(locusInfo.emitChange);
221
261
  });
222
262
 
263
+ it('calls onLocusSynced callback passed as second argument with full locus from join response', async () => {
264
+ const syncedLocus = {url: 'http://locus-url.com', participants: []};
265
+ const onLocusSynced = sinon.stub();
266
+
267
+ await locusInfo.initialSetup(
268
+ {
269
+ trigger: 'join-response',
270
+ locus: syncedLocus,
271
+ },
272
+ onLocusSynced
273
+ );
274
+
275
+ assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
276
+ });
277
+
278
+ it('swallows onLocusSynced callback errors and logs warn', async () => {
279
+ const syncedLocus = {url: 'http://locus-url.com', participants: []};
280
+ const callbackError = new Error('onLocusSynced failed');
281
+ const onLocusSynced = sinon.stub().throws(callbackError);
282
+ const loggerWarnStub = LoggerProxy.logger.warn?.isSinonProxy
283
+ ? LoggerProxy.logger.warn
284
+ : sinon.stub(LoggerProxy.logger, 'warn');
285
+
286
+ loggerWarnStub.resetHistory();
287
+
288
+ await locusInfo.initialSetup(
289
+ {
290
+ trigger: 'join-response',
291
+ locus: syncedLocus,
292
+ },
293
+ onLocusSynced
294
+ );
295
+
296
+ assert.calledOnceWithExactly(onLocusSynced, syncedLocus);
297
+ assert.calledOnce(loggerWarnStub);
298
+ assert.match(
299
+ loggerWarnStub.firstCall.args[0],
300
+ /Locus-info:index#initialSetup --> onLocusSynced callback failed/
301
+ );
302
+ });
303
+
223
304
  it('should initialize the hash tree parser correctly when triggered from a get loci response containing visible datasets', async () => {
224
305
  const visibleDataSets = ['dataset1', 'dataset2'];
225
306
  const locus = createLocusWithVisibleDataSets(visibleDataSets);
@@ -237,7 +318,9 @@ describe('plugin-meetings', () => {
237
318
  dataSets: [],
238
319
  },
239
320
  webexRequest: sinon.match.func,
240
- locusInfoUpdateCallback: sinon.match.func,
321
+ callbacks: sinon.match({
322
+ locusInfoUpdateCallback: sinon.match.func,
323
+ }),
241
324
  debugId: sinon.match.string,
242
325
  metadata: null,
243
326
  })
@@ -290,6 +373,7 @@ describe('plugin-meetings', () => {
290
373
  describe('should setup correct locusInfoUpdateCallback when creating HashTreeParser', () => {
291
374
  const OBJECTS_UPDATED = HashTreeParserModule.LocusInfoUpdateType.OBJECTS_UPDATED;
292
375
  const MEETING_ENDED = HashTreeParserModule.LocusInfoUpdateType.MEETING_ENDED;
376
+ const LOCUS_NOT_FOUND = HashTreeParserModule.LocusInfoUpdateType.LOCUS_NOT_FOUND;
293
377
 
294
378
  let locusInfoUpdateCallback;
295
379
  let onDeltaLocusStub;
@@ -312,7 +396,7 @@ describe('plugin-meetings', () => {
312
396
  },
313
397
  });
314
398
 
315
- locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].locusInfoUpdateCallback;
399
+ locusInfoUpdateCallback = HashTreeParserStub.firstCall.args[0].callbacks.locusInfoUpdateCallback;
316
400
 
317
401
  assert.isDefined(locusInfoUpdateCallback);
318
402
 
@@ -959,6 +1043,37 @@ describe('plugin-meetings', () => {
959
1043
  assert.notCalled(destroyStub);
960
1044
  });
961
1045
 
1046
+ it('should handle LOCUS_NOT_FOUND by calling syncMeetings with skipHashTreeSync', () => {
1047
+ const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').resolves();
1048
+
1049
+ locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
1050
+
1051
+ assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
1052
+ });
1053
+
1054
+ it('should handle LOCUS_NOT_FOUND and log error if syncMeetings fails', async () => {
1055
+ const syncError = new Error('sync failed');
1056
+ const syncMeetingsStub = sinon.stub(locusInfo.webex.meetings, 'syncMeetings').rejects(syncError);
1057
+ const logErrorStub = LoggerProxy.logger.error?.isSinonProxy
1058
+ ? LoggerProxy.logger.error
1059
+ : sinon.stub(LoggerProxy.logger, 'error');
1060
+
1061
+ logErrorStub.resetHistory();
1062
+
1063
+ locusInfoUpdateCallback({updateType: LOCUS_NOT_FOUND});
1064
+
1065
+ assert.calledOnceWithExactly(syncMeetingsStub, {keepOnlyLocusMeetings: false, skipHashTreeSync: true});
1066
+
1067
+ // wait for the promise rejection to be handled
1068
+ await testUtils.flushPromises();
1069
+
1070
+ assert.calledOnce(logErrorStub);
1071
+ assert.match(
1072
+ logErrorStub.firstCall.args[0],
1073
+ /syncMeetings failed after LOCUS_NOT_FOUND/
1074
+ );
1075
+ });
1076
+
962
1077
  it('should set forceReplaceMembers to true on the first update for a locusUrl (initializedFromHashTree is false)', () => {
963
1078
  const createdHashTreeParser = locusInfo.hashTreeParsers.get('fake-locus-url');
964
1079
  createdHashTreeParser.initializedFromHashTree = false;
@@ -1289,6 +1404,8 @@ describe('plugin-meetings', () => {
1289
1404
  state: RECORDING_STATE.IDLE,
1290
1405
  modifiedBy: 'George Kittle',
1291
1406
  lastModified: 'TODAY',
1407
+ modifiedByServiceAppName: undefined,
1408
+ modifiedByServiceAppId: undefined,
1292
1409
  }
1293
1410
  );
1294
1411
  });
@@ -1323,6 +1440,8 @@ describe('plugin-meetings', () => {
1323
1440
  state: RECORDING_STATE.RECORDING,
1324
1441
  modifiedBy: 'George Kittle',
1325
1442
  lastModified: 'TODAY',
1443
+ modifiedByServiceAppName: undefined,
1444
+ modifiedByServiceAppId: undefined,
1326
1445
  }
1327
1446
  );
1328
1447
  });
@@ -1358,6 +1477,8 @@ describe('plugin-meetings', () => {
1358
1477
  state: RECORDING_STATE.PAUSED,
1359
1478
  modifiedBy: 'George Kittle',
1360
1479
  lastModified: 'TODAY',
1480
+ modifiedByServiceAppName: undefined,
1481
+ modifiedByServiceAppId: undefined,
1361
1482
  }
1362
1483
  );
1363
1484
  });
@@ -1394,6 +1515,8 @@ describe('plugin-meetings', () => {
1394
1515
  state: RECORDING_STATE.RESUMED,
1395
1516
  modifiedBy: 'George Kittle',
1396
1517
  lastModified: 'TODAY',
1518
+ modifiedByServiceAppName: undefined,
1519
+ modifiedByServiceAppId: undefined,
1397
1520
  }
1398
1521
  );
1399
1522
  });
@@ -1429,6 +1552,44 @@ describe('plugin-meetings', () => {
1429
1552
  state: RECORDING_STATE.IDLE,
1430
1553
  modifiedBy: 'George Kittle',
1431
1554
  lastModified: 'TODAY',
1555
+ modifiedByServiceAppName: undefined,
1556
+ modifiedByServiceAppId: undefined,
1557
+ }
1558
+ );
1559
+ });
1560
+
1561
+ it('should include service app fields in the recording event when present', () => {
1562
+ locusInfo.controls = {
1563
+ record: {
1564
+ recording: false,
1565
+ paused: false,
1566
+ meta: {
1567
+ lastModified: 'TODAY',
1568
+ modifiedBy: 'George Kittle',
1569
+ },
1570
+ },
1571
+ shareControl: {},
1572
+ transcribe: {},
1573
+ };
1574
+ newControls.record.recording = true;
1575
+ newControls.record.meta.modifiedByServiceAppName = 'My Bot';
1576
+ newControls.record.meta.modifiedByServiceAppId = 'app-id-123';
1577
+ locusInfo.emitScoped = sinon.stub();
1578
+ locusInfo.updateControls(newControls);
1579
+
1580
+ assert.calledWith(
1581
+ locusInfo.emitScoped,
1582
+ {
1583
+ file: 'locus-info',
1584
+ function: 'updateControls',
1585
+ },
1586
+ LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
1587
+ {
1588
+ state: RECORDING_STATE.RECORDING,
1589
+ modifiedBy: 'George Kittle',
1590
+ lastModified: 'TODAY',
1591
+ modifiedByServiceAppName: 'My Bot',
1592
+ modifiedByServiceAppId: 'app-id-123',
1432
1593
  }
1433
1594
  );
1434
1595
  });
@@ -2024,7 +2185,7 @@ describe('plugin-meetings', () => {
2024
2185
  function: 'updateSelf',
2025
2186
  },
2026
2187
  LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2027
- {muted: true, unmuteAllowed: true}
2188
+ {muted: true, unmuteAllowed: true, modifiedBy: null}
2028
2189
  );
2029
2190
 
2030
2191
  // but sometimes "previous self" is defined, but without controls.audio.muted, so we test this here:
@@ -2039,7 +2200,7 @@ describe('plugin-meetings', () => {
2039
2200
  function: 'updateSelf',
2040
2201
  },
2041
2202
  LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2042
- {muted: true, unmuteAllowed: true}
2203
+ {muted: true, unmuteAllowed: true, modifiedBy: null}
2043
2204
  );
2044
2205
  });
2045
2206
 
@@ -2098,7 +2259,7 @@ describe('plugin-meetings', () => {
2098
2259
  function: 'updateSelf',
2099
2260
  },
2100
2261
  LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2101
- {muted: true, unmuteAllowed: true}
2262
+ {muted: true, unmuteAllowed: true, modifiedBy: null}
2102
2263
  );
2103
2264
  });
2104
2265
 
@@ -2237,7 +2398,7 @@ describe('plugin-meetings', () => {
2237
2398
  function: 'updateSelf',
2238
2399
  },
2239
2400
  LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2240
- {muted: true, unmuteAllowed: false}
2401
+ {muted: true, unmuteAllowed: false, modifiedBy: null}
2241
2402
  );
2242
2403
 
2243
2404
  // now change only disallowUnmute
@@ -2255,7 +2416,28 @@ describe('plugin-meetings', () => {
2255
2416
  function: 'updateSelf',
2256
2417
  },
2257
2418
  LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2258
- {muted: true, unmuteAllowed: true}
2419
+ {muted: true, unmuteAllowed: true, modifiedBy: null}
2420
+ );
2421
+ });
2422
+
2423
+ it('should include modifiedBy in payload when muted by host', () => {
2424
+ locusInfo.webex.internal.device.url = self.deviceUrl;
2425
+ locusInfo.updateSelf(self);
2426
+ const newSelf = cloneDeep(self);
2427
+ newSelf.controls.audio.muted = true;
2428
+ newSelf.controls.audio.meta = {modifiedBy: 'host-uuid-123'};
2429
+
2430
+ locusInfo.emitScoped = sinon.stub();
2431
+ locusInfo.updateSelf(newSelf);
2432
+
2433
+ assert.calledWith(
2434
+ locusInfo.emitScoped,
2435
+ {
2436
+ file: 'locus-info',
2437
+ function: 'updateSelf',
2438
+ },
2439
+ LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED,
2440
+ {muted: true, unmuteAllowed: true, modifiedBy: 'host-uuid-123'}
2259
2441
  );
2260
2442
  });
2261
2443
 
@@ -2705,6 +2887,10 @@ describe('plugin-meetings', () => {
2705
2887
 
2706
2888
  let expectedMeeting;
2707
2889
 
2890
+ // simulate that updateSelf has been called previously (as happens in production)
2891
+ // so that parsedLocus.self reflects the joined state
2892
+ locusInfo.parsedLocus.self = {state: 'JOINED'};
2893
+
2708
2894
  /*
2709
2895
  When the event is triggered, it is required that the meeting has already
2710
2896
  been updated. This is why the meeting is being checked within the stubbed event emitter
@@ -2715,6 +2901,7 @@ describe('plugin-meetings', () => {
2715
2901
 
2716
2902
  // set the info initially as locusInfo.info starts as undefined
2717
2903
  expectedMeeting = {
2904
+ attendee: {},
2718
2905
  coHost: {
2719
2906
  LOWER_SOMEONE_ELSES_HAND: true,
2720
2907
  },
@@ -2723,10 +2910,12 @@ describe('plugin-meetings', () => {
2723
2910
  moderator: {
2724
2911
  LOWER_SOMEONE_ELSES_HAND: true,
2725
2912
  },
2913
+ panelist: {},
2726
2914
  policy: {
2727
2915
  LOCK_STATUS_UNLOCKED: true,
2728
2916
  ROSTER_IN_MEETING: true,
2729
2917
  },
2918
+ presenter: {},
2730
2919
  userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
2731
2920
  };
2732
2921
  locusInfo.updateMeetingInfo(initialInfo, self);
@@ -2741,6 +2930,7 @@ describe('plugin-meetings', () => {
2741
2930
 
2742
2931
  // Updating with different info should trigger the event
2743
2932
  expectedMeeting = {
2933
+ attendee: {},
2744
2934
  coHost: {
2745
2935
  LOWER_SOMEONE_ELSES_HAND: true,
2746
2936
  LOCK_CONTROL_LOCK: true,
@@ -2750,10 +2940,12 @@ describe('plugin-meetings', () => {
2750
2940
  moderator: {
2751
2941
  LOWER_SOMEONE_ELSES_HAND: true,
2752
2942
  },
2943
+ panelist: {},
2753
2944
  policy: {
2754
2945
  LOCK_STATUS_UNLOCKED: true,
2755
2946
  ROSTER_IN_MEETING: true,
2756
2947
  },
2948
+ presenter: {},
2757
2949
  userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
2758
2950
  };
2759
2951
  locusInfo.updateMeetingInfo(newInfo, self);
@@ -2762,6 +2954,7 @@ describe('plugin-meetings', () => {
2762
2954
 
2763
2955
  // update it with the same info
2764
2956
  expectedMeeting = {
2957
+ attendee: {},
2765
2958
  coHost: {
2766
2959
  LOWER_SOMEONE_ELSES_HAND: true,
2767
2960
  LOCK_CONTROL_LOCK: true,
@@ -2771,10 +2964,12 @@ describe('plugin-meetings', () => {
2771
2964
  moderator: {
2772
2965
  LOWER_SOMEONE_ELSES_HAND: true,
2773
2966
  },
2967
+ panelist: {},
2774
2968
  policy: {
2775
2969
  LOCK_STATUS_UNLOCKED: true,
2776
2970
  ROSTER_IN_MEETING: true,
2777
2971
  },
2972
+ presenter: {},
2778
2973
  userDisplayHints: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED'],
2779
2974
  };
2780
2975
  locusInfo.updateMeetingInfo(newInfo, self);
@@ -2789,6 +2984,7 @@ describe('plugin-meetings', () => {
2789
2984
  hasRole: true,
2790
2985
  });
2791
2986
  expectedMeeting = {
2987
+ attendee: {},
2792
2988
  coHost: {
2793
2989
  LOWER_SOMEONE_ELSES_HAND: true,
2794
2990
  LOCK_CONTROL_LOCK: true,
@@ -2798,10 +2994,12 @@ describe('plugin-meetings', () => {
2798
2994
  moderator: {
2799
2995
  LOWER_SOMEONE_ELSES_HAND: true,
2800
2996
  },
2997
+ panelist: {},
2801
2998
  policy: {
2802
2999
  LOCK_STATUS_UNLOCKED: true,
2803
3000
  ROSTER_IN_MEETING: true,
2804
3001
  },
3002
+ presenter: {},
2805
3003
  userDisplayHints: [
2806
3004
  'ROSTER_IN_MEETING',
2807
3005
  'LOCK_STATUS_UNLOCKED',
@@ -2844,6 +3042,46 @@ describe('plugin-meetings', () => {
2844
3042
  // since self is not passed to updateMeetingInfo, MEETING_INFO_UPDATED should be triggered with isIntializing: true
2845
3043
  checkMeetingInfoUpdatedCalledForRoles(true, {isInitializing: true});
2846
3044
  });
3045
+
3046
+ // joined-section hints (like ROSTER_IN_MEETING) are filtered out while not joined, so they
3047
+ // are a good proxy for verifying that userDisplayHints get recomputed on a join transition
3048
+ [
3049
+ {
3050
+ name: 'the JOINED delta carries the info section',
3051
+ getSecondInfo: (info) => info,
3052
+ },
3053
+ {
3054
+ name: 'the JOINED delta omits the info section (falls back to stored info)',
3055
+ getSecondInfo: () => undefined,
3056
+ },
3057
+ ].forEach(({name, getSecondInfo}) => {
3058
+ it(`recomputes userDisplayHints when self transitions to JOINED with unchanged roles and ${name}`, () => {
3059
+ const info = cloneDeep(meetingInfo); // joined: ['ROSTER_IN_MEETING', 'LOCK_STATUS_UNLOCKED']
3060
+
3061
+ const notJoinedSelf = cloneDeep(self);
3062
+ notJoinedSelf.state = 'IDLE';
3063
+ notJoinedSelf.controls.role.roles = [];
3064
+
3065
+ const joinedSelf = cloneDeep(self);
3066
+ joinedSelf.state = 'JOINED';
3067
+ joinedSelf.controls.role.roles = [];
3068
+
3069
+ sinon.stub(locusInfo, 'emitScoped');
3070
+
3071
+ // first update while not joined: joined-section hints are filtered out
3072
+ locusInfo.updateMeetingInfo(info, notJoinedSelf);
3073
+ assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
3074
+ assert.notInclude(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
3075
+
3076
+ // self transitions to JOINED - info and roles are unchanged
3077
+ locusInfo.updateMeetingInfo(getSecondInfo(info), joinedSelf);
3078
+
3079
+ // the hints must be recomputed with the new joined state
3080
+ assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'ROSTER_IN_MEETING');
3081
+ assert.include(locusInfo.parsedLocus.info.userDisplayHints, 'LOCK_STATUS_UNLOCKED');
3082
+ checkMeetingInfoUpdatedCalled(true, {isInitializing: false});
3083
+ });
3084
+ });
2847
3085
  });
2848
3086
 
2849
3087
  describe('#updateMediaShares', () => {
@@ -3154,13 +3392,14 @@ describe('plugin-meetings', () => {
3154
3392
  const createMockParser = (state = 'active') => ({
3155
3393
  state,
3156
3394
  stop: sinon.stub(),
3157
- resume: sinon.stub(),
3395
+ resumeFromMessage: sinon.stub(),
3158
3396
  handleMessage: sinon.stub(),
3159
3397
  });
3160
3398
 
3161
3399
  const createSelfElementWithReplaces = (replacedLocusUrl, replacedAt) => ({
3162
3400
  htMeta: {elementId: {type: 'Self'}},
3163
3401
  data: {
3402
+ deviceUrl,
3164
3403
  devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
3165
3404
  },
3166
3405
  });
@@ -3236,7 +3475,7 @@ describe('plugin-meetings', () => {
3236
3475
  stateElementsMessage: message,
3237
3476
  });
3238
3477
 
3239
- assert.calledOnce(parserA.resume);
3478
+ assert.calledOnce(parserA.resumeFromMessage);
3240
3479
  assert.calledOnce(parserB.stop);
3241
3480
  });
3242
3481
 
@@ -3259,7 +3498,7 @@ describe('plugin-meetings', () => {
3259
3498
  stateElementsMessage: message,
3260
3499
  });
3261
3500
 
3262
- assert.notCalled(parserA.resume);
3501
+ assert.notCalled(parserA.resumeFromMessage);
3263
3502
  assert.notCalled(parserB.stop);
3264
3503
  });
3265
3504
 
@@ -3278,7 +3517,7 @@ describe('plugin-meetings', () => {
3278
3517
  stateElementsMessage: message,
3279
3518
  });
3280
3519
 
3281
- assert.notCalled(parserA.resume);
3520
+ assert.notCalled(parserA.resumeFromMessage);
3282
3521
  assert.notCalled(parserA.handleMessage);
3283
3522
  });
3284
3523
 
@@ -3362,6 +3601,51 @@ describe('plugin-meetings', () => {
3362
3601
 
3363
3602
  assert.calledOnceWithExactly(parserA.handleMessage, message);
3364
3603
  });
3604
+
3605
+ it('should send mismatch metric when eventType is not HASH_TREE_DATA_UPDATED', () => {
3606
+ const locusUrlA = 'http://locus-url-A.com';
3607
+ const parserA = {state: 'active', handleMessage: sinon.stub()};
3608
+ locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
3609
+
3610
+ locusInfo.parse(mockMeeting, {
3611
+ eventType: LOCUSEVENT.SELF_CHANGED,
3612
+ stateElementsMessage: {locusUrl: locusUrlA, locusStateElements: [], dataSets: []},
3613
+ });
3614
+
3615
+ assert.calledOnceWithExactly(
3616
+ sendBehavioralMetricStub,
3617
+ 'js_sdk_locus_classic_vs_hash_tree_mismatch',
3618
+ {
3619
+ correlationId: mockMeeting.correlationId,
3620
+ message: `got ${LOCUSEVENT.SELF_CHANGED}, expected ${LOCUSEVENT.HASH_TREE_DATA_UPDATED}`,
3621
+ }
3622
+ );
3623
+ assert.notCalled(parserA.handleMessage);
3624
+ });
3625
+ });
3626
+
3627
+ describe('#sendClassicVsHashTreeMismatchMetric', () => {
3628
+ it('should send the metric when called for the first time', () => {
3629
+ locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, 'some mismatch');
3630
+
3631
+ assert.calledOnceWithExactly(
3632
+ sendBehavioralMetricStub,
3633
+ 'js_sdk_locus_classic_vs_hash_tree_mismatch',
3634
+ {
3635
+ correlationId: mockMeeting.correlationId,
3636
+ message: 'some mismatch',
3637
+ }
3638
+ );
3639
+ });
3640
+
3641
+ it('should send the metric up to 5 times and stop after that', () => {
3642
+ for (let i = 0; i < 7; i += 1) {
3643
+ locusInfo.sendClassicVsHashTreeMismatchMetric(mockMeeting, `mismatch ${i}`);
3644
+ }
3645
+
3646
+ assert.callCount(sendBehavioralMetricStub, 5);
3647
+ assert.equal(locusInfo.classicVsHashTreeMismatchMetricCounter, 5);
3648
+ });
3365
3649
  });
3366
3650
 
3367
3651
  describe('#handleLocusAPIResponse', () => {
@@ -3417,19 +3701,186 @@ describe('plugin-meetings', () => {
3417
3701
  assert.calledOnceWithExactly(locusInfo.handleLocusDelta, fakeLocus, mockMeeting);
3418
3702
  });
3419
3703
 
3420
- it('should send mismatch metric when hash tree parser exists but dataSets are missing in wrapped response', () => {
3704
+ it('should send mismatch metric in classic mode when wrapped response has dataSets', () => {
3421
3705
  const fakeLocus = {url: 'http://locus-url.com'};
3422
- const mockHashTreeParser = {handleLocusUpdate: sinon.stub()};
3423
- locusInfo.hashTreeParsers.set(fakeLocus.url, {
3424
- parser: mockHashTreeParser,
3425
- initializedFromHashTree: true,
3706
+ sinon.stub(locusInfo, 'handleLocusDelta');
3707
+
3708
+ locusInfo.handleLocusAPIResponse(mockMeeting, {
3709
+ locus: fakeLocus,
3710
+ dataSets: [{name: 'dataset1', url: 'test-url'}],
3426
3711
  });
3427
- sinon.stub(locusInfo, 'sendClassicVsHashTreeMismatchMetric');
3428
3712
 
3429
- locusInfo.handleLocusAPIResponse(mockMeeting, {locus: fakeLocus});
3713
+ assert.calledOnceWithExactly(
3714
+ sendBehavioralMetricStub,
3715
+ 'js_sdk_locus_classic_vs_hash_tree_mismatch',
3716
+ {
3717
+ correlationId: mockMeeting.correlationId,
3718
+ message: 'unexpected hash tree dataSets in API response',
3719
+ }
3720
+ );
3721
+ assert.calledOnce(locusInfo.handleLocusDelta);
3722
+ });
3430
3723
 
3431
- assert.calledOnce(locusInfo.sendClassicVsHashTreeMismatchMetric);
3432
- assert.calledOnce(mockHashTreeParser.handleLocusUpdate);
3724
+ describe('parser switch via API response', () => {
3725
+ const deviceUrl = 'http://device-url.com';
3726
+ const locusUrlA = 'http://locus-url-A.com';
3727
+ const locusUrlB = 'http://locus-url-B.com';
3728
+
3729
+ let HashTreeParserStub;
3730
+
3731
+ const createMockApiParser = (state = 'active') => ({
3732
+ state,
3733
+ stop: sinon.stub(),
3734
+ resumeFromApiResponse: sinon.stub(),
3735
+ handleLocusUpdate: sinon.stub(),
3736
+ initializeFromGetLociResponse: sinon.stub(),
3737
+ });
3738
+
3739
+ const createLocusWithReplaces = (url, replacedLocusUrl, replacedAt) => ({
3740
+ url,
3741
+ self: {
3742
+ devices: [{url: deviceUrl, replaces: [{locusUrl: replacedLocusUrl, replacedAt}]}],
3743
+ },
3744
+ });
3745
+
3746
+ const createLocusWithoutReplaces = (url) => ({
3747
+ url,
3748
+ self: {devices: [{url: deviceUrl}]},
3749
+ });
3750
+
3751
+ beforeEach(() => {
3752
+ locusInfo.webex.internal.device.url = deviceUrl;
3753
+ HashTreeParserStub = sinon
3754
+ .stub(HashTreeParserModule, 'default')
3755
+ .returns(createMockApiParser());
3756
+ });
3757
+
3758
+ it('should create a new parser and initialize it when no entry exists for the locusUrl', () => {
3759
+ // existing parser for a different url so hashTreeParsers.size > 0
3760
+ locusInfo.hashTreeParsers.set(locusUrlA, {parser: createMockApiParser(), initializedFromHashTree: true});
3761
+
3762
+ const locus = createLocusWithReplaces(locusUrlB, locusUrlA, '2026-01-01T00:00:00Z');
3763
+ sinon.stub(locusInfo, 'handleLocusDelta');
3764
+
3765
+ locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
3766
+
3767
+ assert.isTrue(locusInfo.hashTreeParsers.has(locusUrlB));
3768
+ const newEntry = locusInfo.hashTreeParsers.get(locusUrlB);
3769
+ assert.isFalse(newEntry.initializedFromHashTree);
3770
+
3771
+ // the stub returns the mock, so initializeFromGetLociResponse should be called on it
3772
+ const createdParser = HashTreeParserStub.returnValues[0];
3773
+ assert.calledOnceWithExactly(createdParser.initializeFromGetLociResponse, locus);
3774
+ assert.notCalled(locusInfo.handleLocusDelta);
3775
+ });
3776
+
3777
+ it('should reactivate a stopped parser when replaces info is newer', () => {
3778
+ const parserA = createMockApiParser('stopped');
3779
+ const parserB = createMockApiParser('active');
3780
+ locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-01-01T00:00:00Z', initializedFromHashTree: true});
3781
+ locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
3782
+
3783
+ const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-02-01T00:00:00Z');
3784
+
3785
+ locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
3786
+
3787
+ assert.calledOnce(parserA.resumeFromApiResponse);
3788
+ assert.calledWithExactly(parserA.resumeFromApiResponse, locus);
3789
+ assert.calledOnce(parserB.stop);
3790
+ assert.equal(locusInfo.hashTreeParsers.get(locusUrlB).replacedAt, '2026-02-01T00:00:00Z');
3791
+ assert.isFalse(locusInfo.hashTreeParsers.get(locusUrlA).initializedFromHashTree);
3792
+ });
3793
+
3794
+ it('should not reactivate a stopped parser when replaces info is not newer', () => {
3795
+ const parserA = createMockApiParser('stopped');
3796
+ const parserB = createMockApiParser('active');
3797
+ locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, replacedAt: '2026-03-01T00:00:00Z', initializedFromHashTree: true});
3798
+ locusInfo.hashTreeParsers.set(locusUrlB, {parser: parserB, initializedFromHashTree: true});
3799
+
3800
+ const locus = createLocusWithReplaces(locusUrlA, locusUrlB, '2026-01-01T00:00:00Z');
3801
+
3802
+ locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
3803
+
3804
+ assert.notCalled(parserA.resumeFromApiResponse);
3805
+ assert.notCalled(parserB.stop);
3806
+ });
3807
+
3808
+ it('should not reactivate a stopped parser when no replaces info is available', () => {
3809
+ const parserA = createMockApiParser('stopped');
3810
+ locusInfo.hashTreeParsers.set(locusUrlA, {parser: parserA, initializedFromHashTree: true});
3811
+
3812
+ const locus = createLocusWithoutReplaces(locusUrlA);
3813
+
3814
+ locusInfo.handleLocusAPIResponse(mockMeeting, {locus});
3815
+
3816
+ assert.notCalled(parserA.resumeFromApiResponse);
3817
+ });
3818
+ });
3819
+ });
3820
+
3821
+ describe('#syncAllHashTreeDatasets', () => {
3822
+ it('should call syncAllDatasets on each parser that has an entry', async () => {
3823
+ const parser1 = {syncAllDatasets: sinon.stub().resolves()};
3824
+ const parser2 = {syncAllDatasets: sinon.stub().resolves()};
3825
+ locusInfo.hashTreeParsers.set('url1', {parser: parser1});
3826
+ locusInfo.hashTreeParsers.set('url2', {parser: parser2});
3827
+
3828
+ await locusInfo.syncAllHashTreeDatasets();
3829
+
3830
+ assert.calledOnce(parser1.syncAllDatasets);
3831
+ assert.calledOnce(parser2.syncAllDatasets);
3832
+ });
3833
+
3834
+ it('should skip parser entries without a parser object', async () => {
3835
+ const parser1 = {syncAllDatasets: sinon.stub().resolves()};
3836
+ locusInfo.hashTreeParsers.set('url1', {parser: parser1});
3837
+ locusInfo.hashTreeParsers.set('url2', {parser: undefined});
3838
+
3839
+ await locusInfo.syncAllHashTreeDatasets();
3840
+
3841
+ assert.calledOnce(parser1.syncAllDatasets);
3842
+ });
3843
+
3844
+ it('should forward options to each parser syncAllDatasets', async () => {
3845
+ const parser1 = {syncAllDatasets: sinon.stub().resolves()};
3846
+ const parser2 = {syncAllDatasets: sinon.stub().resolves()};
3847
+ locusInfo.hashTreeParsers.set('url1', {parser: parser1});
3848
+ locusInfo.hashTreeParsers.set('url2', {parser: parser2});
3849
+
3850
+ await locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
3851
+
3852
+ assert.calledOnceWithExactly(parser1.syncAllDatasets, {onlyLLM: true});
3853
+ assert.calledOnceWithExactly(parser2.syncAllDatasets, {onlyLLM: true});
3854
+ });
3855
+
3856
+ it('should await each parsers syncAllDatasets sequentially', async () => {
3857
+ const callOrder = [];
3858
+ const parser1 = {syncAllDatasets: sinon.stub().callsFake(() => {
3859
+ callOrder.push('start1');
3860
+ return new Promise((resolve) => {
3861
+ setTimeout(() => {
3862
+ callOrder.push('end1');
3863
+ resolve();
3864
+ }, 100);
3865
+ });
3866
+ })};
3867
+ const parser2 = {syncAllDatasets: sinon.stub().callsFake(() => {
3868
+ callOrder.push('start2');
3869
+ return Promise.resolve();
3870
+ })};
3871
+ locusInfo.hashTreeParsers.set('url1', {parser: parser1});
3872
+ locusInfo.hashTreeParsers.set('url2', {parser: parser2});
3873
+
3874
+ const clock = sinon.useFakeTimers();
3875
+ const promise = locusInfo.syncAllHashTreeDatasets();
3876
+ // parser1 started but parser2 not yet
3877
+ assert.deepEqual(callOrder, ['start1']);
3878
+
3879
+ await clock.tickAsync(100);
3880
+ await promise;
3881
+ // parser1 finished, then parser2 started and finished
3882
+ assert.deepEqual(callOrder, ['start1', 'end1', 'start2']);
3883
+ clock.restore();
3433
3884
  });
3434
3885
  });
3435
3886
 
@@ -3521,49 +3972,23 @@ describe('plugin-meetings', () => {
3521
3972
  assert.deepEqual(callOrder, ['updateLocusUrl', 'updateMeetingInfo']);
3522
3973
  });
3523
3974
 
3524
- it('#updateLocusInfo ignores breakout LEFT message', () => {
3525
- const newLocus = {
3526
- self: {
3527
- reason: 'MOVED',
3528
- state: 'LEFT',
3529
- },
3530
- };
3975
+ it('#updateLocusInfo ignores locus when isSelfMovedOrBreakoutEnded returns true', () => {
3976
+ const newLocus = {self: {state: 'JOINED'}};
3977
+
3978
+ sinon.stub(MeetingsUtil, 'isSelfMovedOrBreakoutEnded').returns(true);
3531
3979
 
3532
3980
  locusInfo.updateControls = sinon.stub();
3533
- locusInfo.updateConversationUrl = sinon.stub();
3534
- locusInfo.updateCreated = sinon.stub();
3535
3981
  locusInfo.updateFullState = sinon.stub();
3536
- locusInfo.updateHostInfo = sinon.stub();
3537
- locusInfo.updateMeetingInfo = sinon.stub();
3538
- locusInfo.updateMediaShares = sinon.stub();
3539
- locusInfo.updateReplaces = sinon.stub();
3540
3982
  locusInfo.updateSelf = sinon.stub();
3541
- locusInfo.updateLocusUrl = sinon.stub();
3542
- locusInfo.updateAclUrl = sinon.stub();
3543
- locusInfo.updateBasequence = sinon.stub();
3544
- locusInfo.updateSequence = sinon.stub();
3545
- locusInfo.updateEmbeddedApps = sinon.stub();
3546
- locusInfo.updateLinks = sinon.stub();
3547
- locusInfo.compareAndUpdate = sinon.stub();
3548
3983
 
3549
3984
  locusInfo.updateLocusInfo(newLocus);
3550
3985
 
3986
+ assert.calledOnceWithExactly(MeetingsUtil.isSelfMovedOrBreakoutEnded, newLocus);
3551
3987
  assert.notCalled(locusInfo.updateControls);
3552
- assert.notCalled(locusInfo.updateConversationUrl);
3553
- assert.notCalled(locusInfo.updateCreated);
3554
3988
  assert.notCalled(locusInfo.updateFullState);
3555
- assert.notCalled(locusInfo.updateHostInfo);
3556
- assert.notCalled(locusInfo.updateMeetingInfo);
3557
- assert.notCalled(locusInfo.updateMediaShares);
3558
- assert.notCalled(locusInfo.updateReplaces);
3559
3989
  assert.notCalled(locusInfo.updateSelf);
3560
- assert.notCalled(locusInfo.updateLocusUrl);
3561
- assert.notCalled(locusInfo.updateAclUrl);
3562
- assert.notCalled(locusInfo.updateBasequence);
3563
- assert.notCalled(locusInfo.updateSequence);
3564
- assert.notCalled(locusInfo.updateEmbeddedApps);
3565
- assert.notCalled(locusInfo.updateLinks);
3566
- assert.notCalled(locusInfo.compareAndUpdate);
3990
+
3991
+ MeetingsUtil.isSelfMovedOrBreakoutEnded.restore();
3567
3992
  });
3568
3993
 
3569
3994
  it('#updateLocusInfo puts the Locus DTO top level properties at the right place in LocusInfo class', () => {
@@ -4480,6 +4905,9 @@ describe('plugin-meetings', () => {
4480
4905
  });
4481
4906
 
4482
4907
  describe('#isMeetingActive', () => {
4908
+ beforeEach(() => {
4909
+ webex.internal.newMetrics.submitClientEvent.resetHistory();
4910
+ });
4483
4911
  forEach([_CALL_, _SIP_BRIDGE_, _SPACE_SHARE_], (type) => {
4484
4912
  describe(`type = ${type}`, () => {
4485
4913
  it('sends client event correctly for state = inactive', () => {
@@ -4500,6 +4928,11 @@ describe('plugin-meetings', () => {
4500
4928
  options: {
4501
4929
  meetingId: locusInfo.meetingId,
4502
4930
  },
4931
+ payload: {
4932
+ eventData: {
4933
+ joinInProgress: false,
4934
+ },
4935
+ },
4503
4936
  });
4504
4937
  });
4505
4938
 
@@ -4520,6 +4953,11 @@ describe('plugin-meetings', () => {
4520
4953
  options: {
4521
4954
  meetingId: locusInfo.meetingId,
4522
4955
  },
4956
+ payload: {
4957
+ eventData: {
4958
+ joinInProgress: false,
4959
+ },
4960
+ },
4523
4961
  });
4524
4962
  });
4525
4963
 
@@ -4541,12 +4979,17 @@ describe('plugin-meetings', () => {
4541
4979
  options: {
4542
4980
  meetingId: locusInfo.meetingId,
4543
4981
  },
4982
+ payload: {
4983
+ eventData: {
4984
+ joinInProgress: false,
4985
+ },
4986
+ },
4544
4987
  });
4545
4988
  });
4546
4989
  });
4547
4990
  });
4548
4991
 
4549
- it('sends client event correctly for state = MEETING_INACTIVE_TERMINATING', () => {
4992
+ it('sends client event correctly for state = MEETING_INACTIVE', () => {
4550
4993
  locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
4551
4994
  locusInfo.parsedLocus = {
4552
4995
  fullState: {
@@ -4568,7 +5011,7 @@ describe('plugin-meetings', () => {
4568
5011
  });
4569
5012
  });
4570
5013
 
4571
- it('sends client event correctly for state = FULLSTATE_REMOVED', () => {
5014
+ it('does not send client event when state = INACTIVE and endMeetingReason = BREAKOUT_ENDED', () => {
4572
5015
  locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
4573
5016
  locusInfo.parsedLocus = {
4574
5017
  fullState: {
@@ -4577,16 +5020,127 @@ describe('plugin-meetings', () => {
4577
5020
  };
4578
5021
 
4579
5022
  locusInfo.fullState = {
4580
- removed: true,
5023
+ state: LOCUS.STATE.INACTIVE,
5024
+ endMeetingReason: 'BREAKOUT_ENDED',
4581
5025
  };
4582
5026
 
4583
5027
  locusInfo.isMeetingActive();
4584
5028
 
4585
- assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
4586
- name: 'client.call.remote-ended',
4587
- options: {
4588
- meetingId: locusInfo.meetingId,
5029
+ assert.notCalled(webex.internal.newMetrics.submitClientEvent);
5030
+ });
5031
+
5032
+ it('sends client event correctly for state self removed', () => {
5033
+ locusInfo.emitScoped = sinon.stub();
5034
+ locusInfo.parsedLocus = {
5035
+ fullState: {
5036
+ type: _MEETING_,
4589
5037
  },
5038
+ self: {
5039
+ removed: true,
5040
+ }
5041
+ };
5042
+
5043
+ locusInfo.isMeetingActive();
5044
+
5045
+ assert.notCalled(webex.internal.newMetrics.submitClientEvent);
5046
+ assert.calledOnceWithExactly(
5047
+ locusInfo.emitScoped,
5048
+ {
5049
+ file: 'locus-info',
5050
+ function: 'isMeetingActive',
5051
+ },
5052
+ EVENTS.DESTROY_MEETING,
5053
+ {
5054
+ reason: MEETING_REMOVED_REASON.SELF_REMOVED,
5055
+ shouldLeave: false,
5056
+ }
5057
+ );
5058
+ });
5059
+
5060
+ describe('destroyMeetingSuspended', () => {
5061
+ it('suppresses DESTROY_MEETING for SELF_REMOVED when suspended', () => {
5062
+ locusInfo.emitScoped = sinon.stub();
5063
+ locusInfo.suspendDestroyMeeting(true);
5064
+ locusInfo.parsedLocus = {
5065
+ fullState: {
5066
+ type: _MEETING_,
5067
+ },
5068
+ self: {
5069
+ removed: true,
5070
+ }
5071
+ };
5072
+
5073
+ locusInfo.isMeetingActive();
5074
+
5075
+ assert.notCalled(locusInfo.emitScoped);
5076
+ assert.calledOnceWithExactly(
5077
+ sendBehavioralMetricStub,
5078
+ BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
5079
+ {
5080
+ meetingId: locusInfo.meetingId,
5081
+ reason: 'SELF_REMOVED',
5082
+ }
5083
+ );
5084
+ });
5085
+
5086
+ it('suppresses DESTROY_MEETING for MEETING_INACTIVE_TERMINATING when suspended', () => {
5087
+ locusInfo.emitScoped = sinon.stub();
5088
+ locusInfo.suspendDestroyMeeting(true);
5089
+ locusInfo.parsedLocus = {
5090
+ fullState: {
5091
+ type: _MEETING_,
5092
+ },
5093
+ };
5094
+ locusInfo.fullState = {
5095
+ state: LOCUS.STATE.INACTIVE,
5096
+ };
5097
+
5098
+ locusInfo.isMeetingActive();
5099
+
5100
+ assert.notCalled(locusInfo.emitScoped);
5101
+ assert.notCalled(webex.internal.newMetrics.submitClientEvent);
5102
+ assert.calledOnceWithExactly(
5103
+ sendBehavioralMetricStub,
5104
+ BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED,
5105
+ {
5106
+ meetingId: locusInfo.meetingId,
5107
+ reason: 'MEETING_INACTIVE_TERMINATING',
5108
+ }
5109
+ );
5110
+ });
5111
+
5112
+ [
5113
+ {reason: 'CALL_INACTIVE', setup: () => {
5114
+ locusInfo.parsedLocus = {fullState: {type: _CALL_}};
5115
+ locusInfo.fullState = {state: LOCUS.STATE.INACTIVE};
5116
+ }},
5117
+ {reason: 'PARTNER_LEFT', setup: () => {
5118
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
5119
+ locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.JOINED}};
5120
+ }},
5121
+ {reason: 'SELF_LEFT', setup: () => {
5122
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
5123
+ locusInfo.parsedLocus = {fullState: {type: _CALL_}, self: {state: MEETING_STATE.STATES.LEFT}};
5124
+ }},
5125
+ ].forEach(({reason, setup}) => {
5126
+ it(`sends joinInProgress=true in client event for ${reason} when suspended`, () => {
5127
+ locusInfo.suspendDestroyMeeting(true);
5128
+ setup();
5129
+
5130
+ locusInfo.isMeetingActive();
5131
+
5132
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
5133
+ name: 'client.call.remote-ended',
5134
+ options: {
5135
+ meetingId: locusInfo.meetingId,
5136
+ },
5137
+ payload: {
5138
+ eventData: {
5139
+ joinInProgress: true,
5140
+ },
5141
+ },
5142
+ });
5143
+ });
4590
5144
  });
4591
5145
  });
4592
5146
  });
@@ -4979,6 +5533,31 @@ describe('plugin-meetings', () => {
4979
5533
  );
4980
5534
  assert.notCalled(getTheLocusToUpdateStub);
4981
5535
  });
5536
+
5537
+ it('should call handleLocusAPIResponse for SDK_LOCUS_FROM_SYNC_MEETINGS when hash tree parsers exist', () => {
5538
+ const fakeLocusUrl = 'http://locus-url.com';
5539
+ const fakeLocus = {url: fakeLocusUrl, fullState: {state: 'ACTIVE'}};
5540
+ const mockHashTreeParser = {
5541
+ handleMessage: sinon.stub(),
5542
+ handleLocusUpdate: sinon.stub(),
5543
+ };
5544
+ locusInfo.hashTreeParsers.set(fakeLocusUrl, {
5545
+ parser: mockHashTreeParser,
5546
+ initializedFromHashTree: true,
5547
+ });
5548
+
5549
+ sinon.stub(locusInfo, 'handleLocusDelta');
5550
+
5551
+ locusInfo.parse(mockMeeting, {
5552
+ eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
5553
+ locus: fakeLocus,
5554
+ });
5555
+
5556
+ // should route through handleLocusAPIResponse which passes unwrapped LocusDTO to parser
5557
+ assert.calledOnce(mockHashTreeParser.handleLocusUpdate);
5558
+ assert.notCalled(mockHashTreeParser.handleMessage);
5559
+ assert.notCalled(locusInfo.handleLocusDelta);
5560
+ });
4982
5561
  });
4983
5562
  });
4984
5563
 
@@ -5171,6 +5750,7 @@ describe('plugin-meetings', () => {
5171
5750
  return {
5172
5751
  htMeta: {elementId: {type: 'Self'}},
5173
5752
  data: {
5753
+ deviceUrl,
5174
5754
  devices,
5175
5755
  },
5176
5756
  };