@webex/plugin-meetings 3.12.0-next.13 → 3.12.0-next.131

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 (232) 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/annotation/index.js +2 -2
  5. package/dist/annotation/index.js.map +1 -1
  6. package/dist/breakouts/breakout.js +8 -3
  7. package/dist/breakouts/breakout.js.map +1 -1
  8. package/dist/breakouts/events.js +29 -14
  9. package/dist/breakouts/events.js.map +1 -1
  10. package/dist/breakouts/index.js +99 -4
  11. package/dist/breakouts/index.js.map +1 -1
  12. package/dist/common/errors/webex-errors.js +49 -5
  13. package/dist/common/errors/webex-errors.js.map +1 -1
  14. package/dist/config.js +2 -2
  15. package/dist/config.js.map +1 -1
  16. package/dist/constants.js +37 -10
  17. package/dist/constants.js.map +1 -1
  18. package/dist/controls-options-manager/index.js +46 -10
  19. package/dist/controls-options-manager/index.js.map +1 -1
  20. package/dist/hashTree/constants.js +4 -1
  21. package/dist/hashTree/constants.js.map +1 -1
  22. package/dist/hashTree/hashTreeParser.js +1045 -393
  23. package/dist/hashTree/hashTreeParser.js.map +1 -1
  24. package/dist/hashTree/utils.js +20 -0
  25. package/dist/hashTree/utils.js.map +1 -1
  26. package/dist/index.js +7 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  29. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  30. package/dist/interceptors/locusRetry.js +23 -8
  31. package/dist/interceptors/locusRetry.js.map +1 -1
  32. package/dist/interpretation/index.js +10 -1
  33. package/dist/interpretation/index.js.map +1 -1
  34. package/dist/interpretation/interpretation.types.js +7 -0
  35. package/dist/interpretation/interpretation.types.js.map +1 -0
  36. package/dist/interpretation/siLanguage.js +1 -1
  37. package/dist/locus-info/controlsUtils.js +4 -1
  38. package/dist/locus-info/controlsUtils.js.map +1 -1
  39. package/dist/locus-info/index.js +409 -122
  40. package/dist/locus-info/index.js.map +1 -1
  41. package/dist/locus-info/infoUtils.js +36 -5
  42. package/dist/locus-info/infoUtils.js.map +1 -1
  43. package/dist/locus-info/types.js +19 -0
  44. package/dist/locus-info/types.js.map +1 -1
  45. package/dist/media/MediaConnectionAwaiter.js +15 -2
  46. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  47. package/dist/media/index.js +8 -2
  48. package/dist/media/index.js.map +1 -1
  49. package/dist/media/properties.js +4 -5
  50. package/dist/media/properties.js.map +1 -1
  51. package/dist/meeting/in-meeting-actions.js +5 -1
  52. package/dist/meeting/in-meeting-actions.js.map +1 -1
  53. package/dist/meeting/index.js +1669 -835
  54. package/dist/meeting/index.js.map +1 -1
  55. package/dist/meeting/locusMediaRequest.js +229 -82
  56. package/dist/meeting/locusMediaRequest.js.map +1 -1
  57. package/dist/meeting/muteState.js +10 -1
  58. package/dist/meeting/muteState.js.map +1 -1
  59. package/dist/meeting/request.js +5 -2
  60. package/dist/meeting/request.js.map +1 -1
  61. package/dist/meeting/util.js +34 -2
  62. package/dist/meeting/util.js.map +1 -1
  63. package/dist/meeting-info/meeting-info-v2.js +9 -3
  64. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  65. package/dist/meetings/index.js +281 -124
  66. package/dist/meetings/index.js.map +1 -1
  67. package/dist/meetings/meetings.types.js +6 -1
  68. package/dist/meetings/meetings.types.js.map +1 -1
  69. package/dist/meetings/request.js +39 -0
  70. package/dist/meetings/request.js.map +1 -1
  71. package/dist/meetings/util.js +116 -18
  72. package/dist/meetings/util.js.map +1 -1
  73. package/dist/member/index.js +10 -0
  74. package/dist/member/index.js.map +1 -1
  75. package/dist/member/types.js.map +1 -1
  76. package/dist/member/util.js +30 -0
  77. package/dist/member/util.js.map +1 -1
  78. package/dist/members/index.js +101 -43
  79. package/dist/members/index.js.map +1 -1
  80. package/dist/members/util.js +8 -1
  81. package/dist/members/util.js.map +1 -1
  82. package/dist/metrics/constants.js +7 -1
  83. package/dist/metrics/constants.js.map +1 -1
  84. package/dist/multistream/codec/constants.js +63 -0
  85. package/dist/multistream/codec/constants.js.map +1 -0
  86. package/dist/multistream/mediaRequestManager.js +62 -15
  87. package/dist/multistream/mediaRequestManager.js.map +1 -1
  88. package/dist/multistream/receiveSlot.js +9 -0
  89. package/dist/multistream/receiveSlot.js.map +1 -1
  90. package/dist/reachability/clusterReachability.js.map +1 -1
  91. package/dist/reachability/index.js +121 -83
  92. package/dist/reachability/index.js.map +1 -1
  93. package/dist/reachability/reachability.types.js +2 -0
  94. package/dist/reachability/reachability.types.js.map +1 -1
  95. package/dist/reachability/util.js +45 -0
  96. package/dist/reachability/util.js.map +1 -1
  97. package/dist/reactions/reactions.type.js.map +1 -1
  98. package/dist/recording-controller/index.js +1 -3
  99. package/dist/recording-controller/index.js.map +1 -1
  100. package/dist/roap/turnDiscovery.js +8 -1
  101. package/dist/roap/turnDiscovery.js.map +1 -1
  102. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  103. package/dist/types/config.d.ts +2 -2
  104. package/dist/types/constants.d.ts +13 -1
  105. package/dist/types/controls-options-manager/index.d.ts +16 -0
  106. package/dist/types/hashTree/constants.d.ts +1 -0
  107. package/dist/types/hashTree/hashTreeParser.d.ts +189 -22
  108. package/dist/types/hashTree/utils.d.ts +7 -0
  109. package/dist/types/index.d.ts +3 -0
  110. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  111. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  112. package/dist/types/locus-info/index.d.ts +61 -7
  113. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  114. package/dist/types/locus-info/types.d.ts +21 -1
  115. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  116. package/dist/types/media/properties.d.ts +6 -2
  117. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  118. package/dist/types/meeting/index.d.ts +175 -11
  119. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  120. package/dist/types/meeting/request.d.ts +1 -0
  121. package/dist/types/meeting/util.d.ts +9 -0
  122. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  123. package/dist/types/meetings/index.d.ts +38 -18
  124. package/dist/types/meetings/meetings.types.d.ts +15 -0
  125. package/dist/types/meetings/request.d.ts +14 -0
  126. package/dist/types/member/index.d.ts +1 -0
  127. package/dist/types/member/types.d.ts +1 -0
  128. package/dist/types/member/util.d.ts +9 -0
  129. package/dist/types/members/index.d.ts +15 -2
  130. package/dist/types/members/util.d.ts +1 -5
  131. package/dist/types/metrics/constants.d.ts +6 -0
  132. package/dist/types/multistream/codec/constants.d.ts +7 -0
  133. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  134. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  135. package/dist/types/reachability/index.d.ts +10 -3
  136. package/dist/types/reachability/reachability.types.d.ts +7 -0
  137. package/dist/types/reachability/util.d.ts +17 -0
  138. package/dist/types/reactions/reactions.type.d.ts +3 -0
  139. package/dist/webinar/index.js +307 -161
  140. package/dist/webinar/index.js.map +1 -1
  141. package/package.json +23 -23
  142. package/src/aiEnableRequest/index.ts +16 -0
  143. package/src/annotation/index.ts +6 -4
  144. package/src/breakouts/breakout.ts +3 -1
  145. package/src/breakouts/events.ts +33 -11
  146. package/src/breakouts/index.ts +122 -2
  147. package/src/common/errors/webex-errors.ts +50 -3
  148. package/src/config.ts +2 -2
  149. package/src/constants.ts +21 -3
  150. package/src/controls-options-manager/index.ts +62 -10
  151. package/src/hashTree/constants.ts +7 -0
  152. package/src/hashTree/hashTreeParser.ts +796 -192
  153. package/src/hashTree/utils.ts +19 -0
  154. package/src/index.ts +6 -0
  155. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  156. package/src/interceptors/locusRetry.ts +25 -4
  157. package/src/interpretation/index.ts +27 -9
  158. package/src/interpretation/interpretation.types.ts +11 -0
  159. package/src/locus-info/controlsUtils.ts +3 -1
  160. package/src/locus-info/index.ts +413 -130
  161. package/src/locus-info/infoUtils.ts +41 -6
  162. package/src/locus-info/types.ts +25 -1
  163. package/src/media/MediaConnectionAwaiter.ts +21 -4
  164. package/src/media/index.ts +10 -1
  165. package/src/media/properties.ts +8 -3
  166. package/src/meeting/in-meeting-actions.ts +8 -0
  167. package/src/meeting/index.ts +923 -117
  168. package/src/meeting/locusMediaRequest.ts +106 -6
  169. package/src/meeting/muteState.ts +10 -1
  170. package/src/meeting/request.ts +11 -0
  171. package/src/meeting/util.ts +46 -5
  172. package/src/meeting-info/meeting-info-v2.ts +10 -4
  173. package/src/meetings/index.ts +178 -78
  174. package/src/meetings/meetings.types.ts +19 -0
  175. package/src/meetings/request.ts +43 -0
  176. package/src/meetings/util.ts +117 -4
  177. package/src/member/index.ts +10 -0
  178. package/src/member/types.ts +1 -0
  179. package/src/member/util.ts +29 -0
  180. package/src/members/index.ts +70 -7
  181. package/src/members/util.ts +12 -4
  182. package/src/metrics/constants.ts +6 -0
  183. package/src/multistream/codec/constants.ts +58 -0
  184. package/src/multistream/mediaRequestManager.ts +119 -28
  185. package/src/multistream/receiveSlot.ts +18 -0
  186. package/src/reachability/clusterReachability.ts +3 -2
  187. package/src/reachability/index.ts +47 -16
  188. package/src/reachability/reachability.types.ts +11 -0
  189. package/src/reachability/util.ts +36 -0
  190. package/src/reactions/reactions.type.ts +3 -0
  191. package/src/recording-controller/index.ts +1 -2
  192. package/src/roap/turnDiscovery.ts +9 -1
  193. package/src/webinar/index.ts +216 -38
  194. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  195. package/test/unit/spec/annotation/index.ts +3 -3
  196. package/test/unit/spec/breakouts/breakout.ts +9 -3
  197. package/test/unit/spec/breakouts/events.ts +120 -2
  198. package/test/unit/spec/breakouts/index.ts +223 -3
  199. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  200. package/test/unit/spec/controls-options-manager/index.js +139 -32
  201. package/test/unit/spec/hashTree/hashTreeParser.ts +2299 -243
  202. package/test/unit/spec/hashTree/utils.ts +37 -0
  203. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  204. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  205. package/test/unit/spec/interpretation/index.ts +26 -4
  206. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  207. package/test/unit/spec/locus-info/index.js +671 -63
  208. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  209. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  210. package/test/unit/spec/media/index.ts +92 -0
  211. package/test/unit/spec/media/properties.ts +23 -23
  212. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  213. package/test/unit/spec/meeting/index.js +2733 -116
  214. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  215. package/test/unit/spec/meeting/muteState.js +81 -0
  216. package/test/unit/spec/meeting/request.js +12 -0
  217. package/test/unit/spec/meeting/utils.js +153 -1
  218. package/test/unit/spec/meeting-info/meetinginfov2.js +76 -10
  219. package/test/unit/spec/meetings/index.js +486 -49
  220. package/test/unit/spec/meetings/request.js +141 -0
  221. package/test/unit/spec/meetings/utils.js +402 -51
  222. package/test/unit/spec/member/index.js +7 -0
  223. package/test/unit/spec/member/util.js +89 -0
  224. package/test/unit/spec/members/index.js +216 -0
  225. package/test/unit/spec/members/request.js +37 -1
  226. package/test/unit/spec/members/utils.js +63 -0
  227. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  228. package/test/unit/spec/reachability/index.ts +128 -46
  229. package/test/unit/spec/reachability/util.ts +31 -0
  230. package/test/unit/spec/recording-controller/index.js +9 -8
  231. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  232. package/test/unit/spec/webinar/index.ts +332 -31
@@ -1,4 +1,6 @@
1
1
  import {isEqual, assignWith, cloneDeep, isEmpty} from 'lodash';
2
+ import uuid from 'uuid';
3
+ import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
2
4
 
3
5
  import LoggerProxy from '../common/logs/logger-proxy';
4
6
  import EventsScope from '../common/events/events-scope';
@@ -37,6 +39,7 @@ import HashTreeParser, {
37
39
  LocusInfoUpdate,
38
40
  LocusInfoUpdateType,
39
41
  Metadata,
42
+ SyncLatencyTracker,
40
43
  } from '../hashTree/hashTreeParser';
41
44
  import {HashTreeObject, ObjectType, ObjectTypeToLocusKeyMap} from '../hashTree/types';
42
45
  import {isMetadata, isSelf} from '../hashTree/utils';
@@ -46,6 +49,7 @@ import {MEETING_KEY} from '../meetings/meetings.types';
46
49
  import MeetingCollection from '../meetings/collection';
47
50
 
48
51
  export type LocusLLMEvent = {
52
+ trackingId?: string;
49
53
  data: {
50
54
  eventType: typeof LOCUSEVENT.HASH_TREE_DATA_UPDATED;
51
55
  stateElementsMessage: HashTreeMessage;
@@ -94,11 +98,16 @@ export type HashTreeParserEntry = {
94
98
  initializedFromHashTree: boolean;
95
99
  };
96
100
 
101
+ export type LocusInfoCallbacks = {
102
+ updateMeeting: (object: any) => void;
103
+ syncLatencyTracker?: SyncLatencyTracker;
104
+ };
105
+
97
106
  /**
98
107
  * Gets the replacement information
99
108
  *
100
109
  * @param {any} self - "self" object from Locus DTO
101
- * @param {string} deviceUrl - The URL of the user's device
110
+ * @param {string} deviceUrl - The URL of the specified device
102
111
  * @returns {any} The replace information if available, otherwise undefined
103
112
  */
104
113
  function getReplaceInfoFromSelf(self: any, deviceUrl: string): ReplacesInfo | undefined {
@@ -138,14 +147,15 @@ function findLocusUrlInAnyHashTreeParser(
138
147
  *
139
148
  * @param {HashTreeMessage} message - The hash tree message to find the meeting for
140
149
  * @param {MeetingCollection} meetingCollection - The collection of meetings to search
141
- * @param {string} deviceUrl - The URL of the user's device
142
150
  * @returns {any} The meeting if found, otherwise undefined
143
151
  */
144
152
  export function findMeetingForHashTreeMessage(
145
- message: HashTreeMessage,
146
- meetingCollection: MeetingCollection,
147
- deviceUrl: string
153
+ message: HashTreeMessage | undefined,
154
+ meetingCollection: MeetingCollection
148
155
  ): any {
156
+ if (!message) {
157
+ return undefined;
158
+ }
149
159
  let foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, message.locusUrl);
150
160
 
151
161
  if (foundMeeting) {
@@ -155,7 +165,7 @@ export function findMeetingForHashTreeMessage(
155
165
  // if we haven't found anything, it may mean that message has a new locusUrl
156
166
  // check if it indicates that it replaces some existing current locusUrl (this is indicated in "self")
157
167
  const self = message.locusStateElements?.find((el) => isSelf(el))?.data;
158
- const replaces = getReplaceInfoFromSelf(self, deviceUrl);
168
+ const replaces = getReplaceInfoFromSelf(self, self?.deviceUrl);
159
169
 
160
170
  if (replaces?.locusUrl) {
161
171
  foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, replaces.locusUrl);
@@ -261,7 +271,6 @@ export default class LocusInfo extends EventsScope {
261
271
  locusParser: any;
262
272
  meetingId: any;
263
273
  parsedLocus: any;
264
- updateMeeting: any;
265
274
  webex: any;
266
275
  aclUrl: any;
267
276
  baseSequence: any;
@@ -285,24 +294,27 @@ export default class LocusInfo extends EventsScope {
285
294
  hashTreeParsers: Map<string, HashTreeParserEntry>;
286
295
  hashTreeObjectId2ParticipantId: Map<number, string>; // mapping of hash tree object ids to participant ids
287
296
  classicVsHashTreeMismatchMetricCounter = 0;
297
+ private callbacks: LocusInfoCallbacks;
298
+ private destroyMeetingSuspended = false;
288
299
 
289
300
  /**
290
301
  * Constructor
291
- * @param {function} updateMeeting callback to update the meeting object from an object
302
+ * @param {Object} callbacks callbacks used by LocusInfo
303
+ * @param {function} callbacks.updateMeeting callback to update the meeting object from an object
292
304
  * @param {object} webex
293
305
  * @param {string} meetingId
294
306
  * @returns {undefined}
295
307
  */
296
- constructor(updateMeeting, webex, meetingId) {
308
+ constructor(callbacks: LocusInfoCallbacks, webex: any, meetingId: any) {
297
309
  super();
298
310
  this.parsedLocus = {
299
311
  states: [],
300
312
  };
313
+ this.callbacks = callbacks;
301
314
  this.webex = webex;
302
315
  this.emitChange = false;
303
316
  this.compareAndUpdateFlags = {};
304
317
  this.meetingId = meetingId;
305
- this.updateMeeting = updateMeeting;
306
318
  this.locusParser = new LocusDeltaParser();
307
319
  this.hashTreeParsers = new Map();
308
320
  this.hashTreeObjectId2ParticipantId = new Map();
@@ -517,7 +529,7 @@ export default class LocusInfo extends EventsScope {
517
529
  this.updateControls(locus.controls, locus.self);
518
530
  this.updateLocusUrl(locus.url, ControlsUtils.isMainSessionDTO(locus));
519
531
  this.updateFullState(locus.fullState);
520
- this.updateMeetingInfo(locus.info);
532
+ this.updateMeetingInfo(locus.info, locus.self);
521
533
  this.updateEmbeddedApps(locus.embeddedApps);
522
534
  // self and participants generate sipUrl for 1:1 meeting
523
535
  this.updateSelf(locus.self);
@@ -553,9 +565,26 @@ export default class LocusInfo extends EventsScope {
553
565
  initialLocus,
554
566
  metadata,
555
567
  webexRequest: this.webex.request.bind(this.webex),
556
- locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
568
+ callbacks: {
569
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
570
+ syncLatencyTracker: this.callbacks.syncLatencyTracker,
571
+ // Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
572
+ // webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
573
+ // ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
574
+ // back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
575
+ // isn't in the map). The value is opaque to the metrics layer and is forced onto the
576
+ // /hashtree and /sync request headers.
577
+ generateTrackingId: () => {
578
+ const interceptor = [...webexTrackingIdSequenceNumbers.keys()].find(
579
+ (candidate) => candidate?.webex === this.webex
580
+ );
581
+
582
+ return `${this.webex.sessionId}_${interceptor ? interceptor.sequence : uuid.v4()}`;
583
+ },
584
+ },
557
585
  debugId: `HT-${locusUrl.split('/')?.pop()?.substring(0, 4)}`,
558
586
  excludedDataSets: this.webex.config.meetings.locus?.excludedDataSets,
587
+ syncLatencyMeetingId: this.meetingId,
559
588
  });
560
589
 
561
590
  // When a new HashTreeParser is created, previous one should be stopped.
@@ -581,6 +610,7 @@ export default class LocusInfo extends EventsScope {
581
610
 
582
611
  /**
583
612
  * @param {Object} data - data to initialize locus info with. It may be from a join or GET /loci response or from a Mercury event that triggers a creation of meeting object
613
+ * @param {Function} [onLocusSynced] - optional callback that will be called at the end of initial setup, when locus info is fully synced. It will be called with the full locus snapshot as an argument (which may be null if we haven't received any full locus DTOs during the initial setup, for example in case we receive only hash tree messages without full locus DTOs)
584
614
  * @returns {undefined}
585
615
  * @memberof LocusInfo
586
616
  */
@@ -600,8 +630,10 @@ export default class LocusInfo extends EventsScope {
600
630
  | {
601
631
  trigger: 'get-loci-response';
602
632
  locus?: LocusDTO;
603
- }
633
+ },
634
+ onLocusSynced?: (locus: LocusDTO) => void
604
635
  ) {
636
+ let initialFullLocus: LocusDTO | null = null;
605
637
  switch (data.trigger) {
606
638
  case 'locus-message':
607
639
  if (data.hashTreeMessage) {
@@ -649,6 +681,7 @@ export default class LocusInfo extends EventsScope {
649
681
  case 'join-response':
650
682
  this.updateLocusCache(data.locus);
651
683
  this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
684
+ initialFullLocus = data.locus;
652
685
  break;
653
686
  case 'get-loci-response':
654
687
  if (data.locus?.links?.resources?.visibleDataSets?.url) {
@@ -671,52 +704,99 @@ export default class LocusInfo extends EventsScope {
671
704
  // "classic" Locus case, no hash trees involved
672
705
  this.updateLocusCache(data.locus);
673
706
  this.onFullLocus('classic get-loci-response', data.locus, undefined);
707
+ initialFullLocus = data.locus || null;
674
708
  }
675
709
  }
710
+
711
+ if (onLocusSynced) {
712
+ try {
713
+ onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
714
+ } catch (error) {
715
+ LoggerProxy.logger.warn(
716
+ `Locus-info:index#initialSetup --> onLocusSynced callback failed: ${error}`
717
+ );
718
+ }
719
+ }
720
+
676
721
  // Change it to true after it receives it first locus object
677
722
  this.emitChange = true;
678
723
  }
679
724
 
725
+ /**
726
+ * Builds a full locus DTO snapshot from current internal locus state.
727
+ *
728
+ * @returns {LocusDTO}
729
+ */
730
+ private getCurrentLocusSnapshot(): LocusDTO {
731
+ const locus: Record<string, any> = {};
732
+
733
+ LocusDtoTopLevelKeys.forEach((key) => {
734
+ const value = (this as Record<string, any>)[key];
735
+
736
+ if (value !== undefined && value !== null) {
737
+ locus[key] = cloneDeep(value);
738
+ }
739
+ });
740
+
741
+ if (!Array.isArray(locus.participants)) {
742
+ locus.participants = [];
743
+ }
744
+
745
+ return locus as LocusDTO;
746
+ }
747
+
680
748
  /**
681
749
  * Handles HTTP response from Locus API call.
682
750
  * @param {Meeting} meeting meeting object
683
751
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
684
752
  * @returns {void}
685
753
  */
686
- handleLocusAPIResponse(meeting, responseBody: LocusApiResponseBody): void {
754
+ handleLocusAPIResponse(meeting: any, responseBody: LocusApiResponseBody): void {
687
755
  const isWrapped = 'locus' in responseBody;
688
756
  const locusUrl = isWrapped ? responseBody.locus?.url : responseBody.url;
689
757
  const hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
690
- if (hashTreeParserEntry) {
691
- if (isWrapped) {
692
- if (!responseBody.dataSets) {
693
- this.sendClassicVsHashTreeMismatchMetric(
694
- meeting,
695
- `expected hash tree dataSets in API response but they are missing`
758
+ const locus = isWrapped
759
+ ? (responseBody as {locus: LocusDTO}).locus
760
+ : (responseBody as LocusDTO);
761
+
762
+ if (this.hashTreeParsers.size > 0) {
763
+ // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
764
+ if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
765
+ if (!locusUrl) {
766
+ LoggerProxy.logger.warn(
767
+ 'Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch'
696
768
  );
697
- // continuing as we can still manage without responseBody.dataSets, but this is very suspicious
769
+
770
+ return;
698
771
  }
699
- LoggerProxy.logger.info(
700
- 'Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ',
701
- responseBody
702
- );
772
+
773
+ this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
774
+
775
+ return;
776
+ }
777
+
778
+ // Active parser found - pass the API response to it
779
+ if (isWrapped) {
703
780
  // update the data in our hash trees
704
781
  hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
705
782
  } else {
706
- // LocusDTO without wrapper - pass it through as if it had no dataSets
783
+ // LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
707
784
  hashTreeParserEntry.parser.handleLocusUpdate({locus: responseBody});
708
785
  }
709
- } else {
710
- if (isWrapped && responseBody.dataSets) {
711
- this.sendClassicVsHashTreeMismatchMetric(
712
- meeting,
713
- `unexpected hash tree dataSets in API response`
714
- );
715
- }
716
- // classic Locus delta
717
- const locus = isWrapped ? responseBody.locus : responseBody;
718
- this.handleLocusDelta(locus, meeting);
786
+
787
+ return;
788
+ }
789
+
790
+ // No hash tree parsers - classic Locus mode
791
+ if (isWrapped && responseBody.dataSets) {
792
+ this.sendClassicVsHashTreeMismatchMetric(
793
+ meeting,
794
+ `unexpected hash tree dataSets in API response`
795
+ );
719
796
  }
797
+
798
+ // classic Locus delta
799
+ this.handleLocusDelta(locus, meeting);
720
800
  }
721
801
 
722
802
  /**
@@ -878,14 +958,22 @@ export default class LocusInfo extends EventsScope {
878
958
  if (!object.data) {
879
959
  // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
880
960
  // all other types info, fullstate, etc - Locus should never send them without data
881
- LoggerProxy.logger.warn(
882
- `Locus-info:index#updateLocusFromHashTreeObject --> received ${type} object without data, this is not expected! version=${object.htMeta.elementId.version}`
961
+ // but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
962
+ LoggerProxy.logger.info(
963
+ `Locus-info:index#updateLocusFromHashTreeObject --> received ${type} object without data, version=${object.htMeta.elementId.version}`
883
964
  );
884
965
  } else {
885
966
  LoggerProxy.logger.info(
886
967
  `Locus-info:index#updateLocusFromHashTreeObject --> ${type} object updated to version ${object.htMeta.elementId.version}`
887
968
  );
888
- const locusDtoKey = ObjectTypeToLocusKeyMap[type];
969
+
970
+ if (type === ObjectType.self) {
971
+ LoggerProxy.logger.info(
972
+ `Locus-info:index#updateLocusFromHashTreeObject --> self data: removed=${object.data.removed} state=${object.data.state} reason=${object.data.reason}`
973
+ );
974
+ }
975
+
976
+ const locusDtoKey = ObjectTypeToLocusKeyMap[type] as keyof LocusDTO;
889
977
  locus[locusDtoKey] = object.data;
890
978
 
891
979
  /* Hash tree based webinar attendees don't receive a Participant object for themselves from Locus,
@@ -945,6 +1033,114 @@ export default class LocusInfo extends EventsScope {
945
1033
  }
946
1034
  }
947
1035
 
1036
+ /**
1037
+ * Helper that handles the common logic for reactivating a stopped HashTreeParser when
1038
+ * a newer "replaces" is detected. Used by both the message and API response parser switch methods.
1039
+ *
1040
+ * @param {string} callerName - name of the calling method, used in log messages
1041
+ * @param {string} locusUrl - the locus URL of the stopped parser
1042
+ * @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
1043
+ * @param {ReplacesInfo} replaces - replacement info extracted from self
1044
+ * @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
1045
+ * @returns {void}
1046
+ */
1047
+ private resumeStoppedParser(
1048
+ callerName: string,
1049
+ locusUrl: string,
1050
+ stoppedEntry: HashTreeParserEntry,
1051
+ replaces: ReplacesInfo | undefined,
1052
+ resumeCallback: () => void
1053
+ ): void {
1054
+ // this check is just for typescript, it should never happen, replaces should always be defined
1055
+ if (!replaces) {
1056
+ LoggerProxy.logger.info(
1057
+ `Locus-info:index#${callerName} --> received data for stopped HashTreeParser with locusUrl ${locusUrl}, but no replaces info provided, so not re-activating the parser`
1058
+ );
1059
+
1060
+ return;
1061
+ }
1062
+
1063
+ if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
1064
+ LoggerProxy.logger.info(
1065
+ `Locus-info:index#${callerName} --> received data for stopped HashTreeParser with locusUrl ${locusUrl}, but replaces info provided is not newer, so not re-activating the parser`
1066
+ );
1067
+
1068
+ return;
1069
+ }
1070
+
1071
+ LoggerProxy.logger.info(
1072
+ `Locus-info:index#${callerName} --> reactivating HashTreeParser for locusUrl=${locusUrl}, which replaces ${replaces.locusUrl}`
1073
+ );
1074
+
1075
+ const replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
1076
+
1077
+ if (replacedEntry) {
1078
+ replacedEntry.replacedAt = replaces.replacedAt;
1079
+ replacedEntry.parser.stop();
1080
+ } else {
1081
+ LoggerProxy.logger.warn(
1082
+ `Locus-info:index#${callerName} --> the parser that is supposed to be replaced with the currently reactivated parser is not found, locusUrl=${replaces.locusUrl}`
1083
+ );
1084
+ }
1085
+
1086
+ stoppedEntry.initializedFromHashTree = false;
1087
+ this.hashTreeObjectId2ParticipantId.clear();
1088
+
1089
+ resumeCallback();
1090
+ }
1091
+
1092
+ /**
1093
+ * Handles an API response whose locusUrl doesn't match any active HashTreeParser
1094
+ * (either no entry exists, or the existing entry is stopped).
1095
+ * Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
1096
+ *
1097
+ * @param {string} locusUrl - the locus URL from the API response
1098
+ * @param {LocusDTO} locus - the locus DTO from the API response
1099
+ * @returns {void}
1100
+ */
1101
+ private handleHashTreeParserSwitchForAPIResponse(locusUrl: string, locus: LocusDTO): void {
1102
+ const entry = this.hashTreeParsers.get(locusUrl);
1103
+
1104
+ const replaces = getReplaceInfoFromSelf(
1105
+ locus.self,
1106
+ // @ts-ignore
1107
+ this.webex.internal.device.url
1108
+ );
1109
+
1110
+ if (!entry) {
1111
+ LoggerProxy.logger.info(
1112
+ `Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ${locusUrl}, creating a new one`
1113
+ );
1114
+
1115
+ const parser = this.createHashTreeParser({
1116
+ locusUrl,
1117
+ initialLocus: {locus: null, dataSets: []},
1118
+ metadata: null,
1119
+ replacedAt: replaces?.replacedAt,
1120
+ });
1121
+
1122
+ parser.initializeFromGetLociResponse(locus);
1123
+
1124
+ return;
1125
+ }
1126
+
1127
+ if (entry.parser.state !== 'stopped') {
1128
+ LoggerProxy.logger.warn(
1129
+ `Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state "${entry.parser.state}" for locusUrl ${locusUrl}`
1130
+ );
1131
+
1132
+ return;
1133
+ }
1134
+
1135
+ this.resumeStoppedParser(
1136
+ 'handleHashTreeParserSwitchForAPIResponse',
1137
+ locusUrl,
1138
+ entry,
1139
+ replaces,
1140
+ () => entry.parser.resumeFromApiResponse(locus)
1141
+ );
1142
+ }
1143
+
948
1144
  /**
949
1145
  * Checks if the hash tree message should trigger a switch to a different HashTreeParser
950
1146
  *
@@ -993,36 +1189,12 @@ export default class LocusInfo extends EventsScope {
993
1189
  if (entry.parser.state === 'stopped') {
994
1190
  // the message matches a stopped parser, we need to check if maybe this is a new "replacement" and we need to re-activate the parser
995
1191
  // this happens when you move from breakout A -> breakout B -> back to breakout A
996
- if (replaces) {
997
- if (replaces.replacedAt > (entry.replacedAt || '')) {
998
- LoggerProxy.logger.info(
999
- `Locus-info:index#handleHashTreeParserSwitch --> resuming a HashTreeParser for locusUrl=${message.locusUrl}, which replaces ${replaces.locusUrl}`
1000
- );
1001
- const replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
1002
-
1003
- if (replacedEntry) {
1004
- replacedEntry.replacedAt = replaces.replacedAt;
1005
- entry.initializedFromHashTree = false;
1006
- this.hashTreeObjectId2ParticipantId.clear();
1007
-
1008
- replacedEntry.parser.stop();
1009
- entry.parser.resume(message);
1010
- } else {
1011
- LoggerProxy.logger.warn(
1012
- `Locus-info:index#handleHashTreeParserSwitch --> the parser that is supposed to be replaced with the currently resumed parser is not found, locusUrl=${replaces.locusUrl}`
1013
- );
1014
- }
1015
- } else {
1016
- LoggerProxy.logger.info(
1017
- `Locus-info:index#handleHashTreeParserSwitch --> received message for stopped HashTreeParser with locusUrl ${message.locusUrl}, but replaces info provided is not newer, so not re-activating the parser`
1018
- );
1019
- }
1020
-
1021
- return true;
1022
- }
1023
-
1024
- LoggerProxy.logger.info(
1025
- `Locus-info:index#handleHashTreeParserSwitch --> received message for stopped HashTreeParser with locusUrl ${message.locusUrl}, but no replaces info provided, so not re-activating the parser`
1192
+ this.resumeStoppedParser(
1193
+ 'handleHashTreeParserSwitch',
1194
+ message.locusUrl,
1195
+ entry,
1196
+ replaces,
1197
+ () => entry.parser.resumeFromMessage(message)
1026
1198
  );
1027
1199
 
1028
1200
  return true;
@@ -1063,6 +1235,23 @@ export default class LocusInfo extends EventsScope {
1063
1235
  }
1064
1236
  }
1065
1237
 
1238
+ /**
1239
+ * Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
1240
+ * The syncs are executed sequentially within each parser.
1241
+ *
1242
+ * @param {Object} [options={}] - Options for syncing
1243
+ * @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
1244
+ * @returns {Promise<void>}
1245
+ */
1246
+ async syncAllHashTreeDatasets(options: {onlyLLM?: boolean} = {}): Promise<void> {
1247
+ for (const [, entry] of this.hashTreeParsers) {
1248
+ if (entry.parser) {
1249
+ // eslint-disable-next-line no-await-in-loop
1250
+ await entry.parser.syncAllDatasets(options);
1251
+ }
1252
+ }
1253
+ }
1254
+
1066
1255
  /**
1067
1256
  * Callback registered with HashTreeParser to receive locus info updates.
1068
1257
  * Updates our locus info based on the data parsed by the hash tree parser.
@@ -1189,6 +1378,21 @@ export default class LocusInfo extends EventsScope {
1189
1378
  );
1190
1379
  this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.SELF_REMOVED);
1191
1380
  }
1381
+ break;
1382
+ }
1383
+
1384
+ case LocusInfoUpdateType.LOCUS_NOT_FOUND: {
1385
+ LoggerProxy.logger.info(
1386
+ `Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ${locusUrl}, triggering syncMeetings`
1387
+ );
1388
+ this.webex.meetings
1389
+ .syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true})
1390
+ .catch((syncError) => {
1391
+ LoggerProxy.logger.error(
1392
+ `Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ${syncError}`
1393
+ );
1394
+ });
1395
+ break;
1192
1396
  }
1193
1397
  }
1194
1398
  }
@@ -1201,11 +1405,17 @@ export default class LocusInfo extends EventsScope {
1201
1405
  */
1202
1406
  parse(meeting: any, data: any) {
1203
1407
  if (this.hashTreeParsers.size > 0) {
1204
- this.handleHashTreeMessage(
1205
- meeting,
1206
- data.eventType,
1207
- data.stateElementsMessage as HashTreeMessage
1208
- );
1408
+ if (data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1409
+ // sync meetings response follows the format of "not wrapped" locus API responses,
1410
+ // so has no dataSets nor Metadata
1411
+ this.handleLocusAPIResponse(meeting, {...data.locus});
1412
+ } else {
1413
+ this.handleHashTreeMessage(
1414
+ meeting,
1415
+ data.eventType,
1416
+ data.stateElementsMessage as HashTreeMessage
1417
+ );
1418
+ }
1209
1419
  } else {
1210
1420
  const {eventType} = data;
1211
1421
 
@@ -1506,7 +1716,7 @@ export default class LocusInfo extends EventsScope {
1506
1716
  * @memberof LocusInfo
1507
1717
  */
1508
1718
  updateLocusInfo(locus) {
1509
- if (locus.self?.reason === 'MOVED' && locus.self?.state === 'LEFT') {
1719
+ if (MeetingsUtil.isSelfMovedOrBreakoutEnded(locus)) {
1510
1720
  // When moved to a breakout session locus sends a message for the previous locus
1511
1721
  // indicating that we have been moved. It isn't helpful to continue parsing this
1512
1722
  // as it gets interpreted as if we have left the call
@@ -1570,7 +1780,7 @@ export default class LocusInfo extends EventsScope {
1570
1780
  // @ts-ignore
1571
1781
  const partner = this.getLocusPartner(this.participants, this.self);
1572
1782
 
1573
- this.updateMeeting({partner});
1783
+ this.callbacks.updateMeeting({partner});
1574
1784
 
1575
1785
  // Check if guest user needs to be checked here
1576
1786
 
@@ -1591,8 +1801,19 @@ export default class LocusInfo extends EventsScope {
1591
1801
  options: {
1592
1802
  meetingId: this.meetingId,
1593
1803
  },
1804
+ payload: {
1805
+ eventData: {
1806
+ joinInProgress: this.destroyMeetingSuspended,
1807
+ },
1808
+ },
1594
1809
  });
1595
1810
 
1811
+ if (this.destroyMeetingSuspended) {
1812
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1813
+ meetingId: this.meetingId,
1814
+ reason: 'CALL_INACTIVE',
1815
+ });
1816
+ }
1596
1817
  this.emitScoped(
1597
1818
  {
1598
1819
  file: 'locus-info',
@@ -1617,7 +1838,18 @@ export default class LocusInfo extends EventsScope {
1617
1838
  options: {
1618
1839
  meetingId: this.meetingId,
1619
1840
  },
1841
+ payload: {
1842
+ eventData: {
1843
+ joinInProgress: this.destroyMeetingSuspended,
1844
+ },
1845
+ },
1620
1846
  });
1847
+ if (this.destroyMeetingSuspended) {
1848
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1849
+ meetingId: this.meetingId,
1850
+ reason: 'PARTNER_LEFT',
1851
+ });
1852
+ }
1621
1853
  this.emitScoped(
1622
1854
  {
1623
1855
  file: 'locus-info',
@@ -1644,8 +1876,19 @@ export default class LocusInfo extends EventsScope {
1644
1876
  options: {
1645
1877
  meetingId: this.meetingId,
1646
1878
  },
1879
+ payload: {
1880
+ eventData: {
1881
+ joinInProgress: this.destroyMeetingSuspended,
1882
+ },
1883
+ },
1647
1884
  });
1648
1885
 
1886
+ if (this.destroyMeetingSuspended) {
1887
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1888
+ meetingId: this.meetingId,
1889
+ reason: 'SELF_LEFT',
1890
+ });
1891
+ }
1649
1892
  this.emitScoped(
1650
1893
  {
1651
1894
  file: 'locus-info',
@@ -1659,56 +1902,82 @@ export default class LocusInfo extends EventsScope {
1659
1902
  );
1660
1903
  }
1661
1904
  } else if (this.parsedLocus.fullState?.type === _MEETING_) {
1662
- if (
1663
- this.fullState &&
1664
- (this.fullState.state === LOCUS.STATE.INACTIVE ||
1905
+ if (this.fullState && MeetingsUtil.isWholeMeetingEnded(this.fullState)) {
1906
+ if (this.destroyMeetingSuspended) {
1907
+ LoggerProxy.logger.info(
1908
+ 'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended'
1909
+ );
1910
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1911
+ meetingId: this.meetingId,
1912
+ reason: 'MEETING_INACTIVE_TERMINATING',
1913
+ });
1914
+ } else {
1915
+ LoggerProxy.logger.warn(
1916
+ 'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive'
1917
+ );
1918
+
1665
1919
  // @ts-ignore
1666
- this.fullState.state === LOCUS.STATE.TERMINATING)
1667
- ) {
1668
- LoggerProxy.logger.warn(
1669
- 'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive or terminating'
1670
- );
1920
+ this.webex.internal.newMetrics.submitClientEvent({
1921
+ name: 'client.call.remote-ended',
1922
+ options: {
1923
+ meetingId: this.meetingId,
1924
+ },
1925
+ });
1671
1926
 
1672
- // @ts-ignore
1673
- this.webex.internal.newMetrics.submitClientEvent({
1674
- name: 'client.call.remote-ended',
1675
- options: {
1676
- meetingId: this.meetingId,
1677
- },
1678
- });
1679
- this.emitScoped(
1680
- {
1681
- file: 'locus-info',
1682
- function: 'isMeetingActive',
1683
- },
1684
- EVENTS.DESTROY_MEETING,
1685
- {
1686
- reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1687
- shouldLeave: false,
1688
- }
1689
- );
1927
+ this.emitScoped(
1928
+ {
1929
+ file: 'locus-info',
1930
+ function: 'isMeetingActive',
1931
+ },
1932
+ EVENTS.DESTROY_MEETING,
1933
+ {
1934
+ reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1935
+ shouldLeave: false,
1936
+ }
1937
+ );
1938
+ }
1690
1939
  }
1691
1940
  // If you are guest and you are removed from the meeting
1692
1941
  // You wont get any further events
1693
1942
  else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
1694
- // Check if we need to send an event
1695
- this.emitScoped(
1696
- {
1697
- file: 'locus-info',
1698
- function: 'isMeetingActive',
1699
- },
1700
- EVENTS.DESTROY_MEETING,
1701
- {
1702
- reason: MEETING_REMOVED_REASON.SELF_REMOVED,
1703
- shouldLeave: false,
1704
- }
1705
- );
1943
+ if (this.destroyMeetingSuspended) {
1944
+ LoggerProxy.logger.info(
1945
+ 'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended'
1946
+ );
1947
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1948
+ meetingId: this.meetingId,
1949
+ reason: 'SELF_REMOVED',
1950
+ });
1951
+ } else {
1952
+ this.emitScoped(
1953
+ {
1954
+ file: 'locus-info',
1955
+ function: 'isMeetingActive',
1956
+ },
1957
+ EVENTS.DESTROY_MEETING,
1958
+ {
1959
+ reason: MEETING_REMOVED_REASON.SELF_REMOVED,
1960
+ shouldLeave: false,
1961
+ }
1962
+ );
1963
+ }
1706
1964
  }
1707
1965
  } else {
1708
1966
  LoggerProxy.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
1709
1967
  }
1710
1968
  }
1711
1969
 
1970
+ /**
1971
+ * Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
1972
+ * Used by joinWithMedia to prevent meeting destruction during retry flows.
1973
+ * @param {boolean} suspend - true to suppress, false to resume
1974
+ * @returns {undefined}
1975
+ * @memberof LocusInfo
1976
+ */
1977
+ suspendDestroyMeeting(suspend: boolean) {
1978
+ this.destroyMeetingSuspended = suspend;
1979
+ }
1980
+
1712
1981
  /**
1713
1982
  * checks if the host permissions have changed while in the meeting
1714
1983
  * This would be the case if your role as host or moderator has been updated
@@ -1929,6 +2198,8 @@ export default class LocusInfo extends EventsScope {
1929
2198
  state,
1930
2199
  modifiedBy: current.record.modifiedBy,
1931
2200
  lastModified: current.record.lastModified,
2201
+ modifiedByServiceAppName: current.record.modifiedByServiceAppName,
2202
+ modifiedByServiceAppId: current.record.modifiedByServiceAppId,
1932
2203
  }
1933
2204
  );
1934
2205
  }
@@ -2058,7 +2329,7 @@ export default class LocusInfo extends EventsScope {
2058
2329
  if (hasEntryExitToneChanged) {
2059
2330
  const {entryExitTone} = current;
2060
2331
 
2061
- this.updateMeeting({entryExitTone});
2332
+ this.callbacks.updateMeeting({entryExitTone});
2062
2333
 
2063
2334
  this.emitScoped(
2064
2335
  {
@@ -2077,7 +2348,7 @@ export default class LocusInfo extends EventsScope {
2077
2348
  if (hasVideoEnabledChanged) {
2078
2349
  const {videoEnabled} = current;
2079
2350
 
2080
- this.updateMeeting({unmuteVideoAllowed: videoEnabled});
2351
+ this.callbacks.updateMeeting({unmuteVideoAllowed: videoEnabled});
2081
2352
 
2082
2353
  this.emitScoped(
2083
2354
  {
@@ -2169,14 +2440,14 @@ export default class LocusInfo extends EventsScope {
2169
2440
  updateConversationUrl(conversationUrl: string, info: any) {
2170
2441
  if (conversationUrl && !isEqual(this.conversationUrl, conversationUrl)) {
2171
2442
  this.conversationUrl = conversationUrl;
2172
- this.updateMeeting({conversationUrl});
2443
+ this.callbacks.updateMeeting({conversationUrl});
2173
2444
  } else if (
2174
2445
  info &&
2175
2446
  info.conversationUrl &&
2176
2447
  !isEqual(this.conversationUrl, info.conversationUrl)
2177
2448
  ) {
2178
2449
  this.conversationUrl = info.conversationUrl;
2179
- this.updateMeeting({conversationUrl: info.conversationUrl});
2450
+ this.callbacks.updateMeeting({conversationUrl: info.conversationUrl});
2180
2451
  }
2181
2452
  }
2182
2453
 
@@ -2238,7 +2509,7 @@ export default class LocusInfo extends EventsScope {
2238
2509
  if (fullState && !isEqual(this.fullState, fullState)) {
2239
2510
  const result = FullState.getFullState(this.fullState, fullState);
2240
2511
 
2241
- this.updateMeeting(result.current);
2512
+ this.callbacks.updateMeeting(result.current);
2242
2513
 
2243
2514
  if (result.updates.meetingStateChangedTo) {
2244
2515
  this.emitScoped(
@@ -2282,7 +2553,7 @@ export default class LocusInfo extends EventsScope {
2282
2553
  if (host && !isEqual(this.host, host)) {
2283
2554
  const parsedHosts = HostUtils.getHosts(this.host, host);
2284
2555
 
2285
- this.updateMeeting(parsedHosts.current);
2556
+ this.callbacks.updateMeeting(parsedHosts.current);
2286
2557
  this.parsedLocus.host = parsedHosts.current;
2287
2558
  if (parsedHosts.updates.isNewHost) {
2288
2559
  this.compareAndUpdateFlags.compareSelfAndHost = true;
@@ -2312,9 +2583,19 @@ export default class LocusInfo extends EventsScope {
2312
2583
  */
2313
2584
  updateMeetingInfo(info: object, self?: object) {
2314
2585
  const roles = self ? SelfUtils.getRoles(self) : this.parsedLocus.self?.roles || [];
2315
- if ((info && !isEqual(this.info, info)) || (!isEqual(this.roles, roles) && info)) {
2316
- const isJoined = SelfUtils.isJoined(self || this.parsedLocus.self);
2317
- const parsedInfo = InfoUtils.getInfos(this.parsedLocus.info, info, roles, isJoined);
2586
+ const isJoined = SelfUtils.isJoined(self || this.parsedLocus.self);
2587
+
2588
+ // The parsed userDisplayHints depend on info, roles and isJoined, so we must recompute
2589
+ // whenever any of them changes. A common case is self transitioning to JOINED via a delta
2590
+ // that doesn't carry an info section - in that case we fall back to the previously stored
2591
+ // info so the hints get reparsed with the new joined state (e.g. VIEW_THE_PARTICIPANT_LIST).
2592
+ const infoToParse = info || this.info;
2593
+ const infoChanged = info && !isEqual(this.info, info);
2594
+ const rolesChanged = !isEqual(this.roles, roles);
2595
+ const isJoinedChanged = SelfUtils.isJoined(this.parsedLocus.self) !== isJoined;
2596
+
2597
+ if (infoToParse && (infoChanged || rolesChanged || isJoinedChanged)) {
2598
+ const parsedInfo = InfoUtils.getInfos(this.parsedLocus.info, infoToParse, roles, isJoined);
2318
2599
 
2319
2600
  if (parsedInfo.updates.isLocked) {
2320
2601
  this.emitScoped(
@@ -2337,10 +2618,10 @@ export default class LocusInfo extends EventsScope {
2337
2618
  );
2338
2619
  }
2339
2620
 
2340
- this.info = info;
2621
+ this.info = infoToParse;
2341
2622
  this.parsedLocus.info = parsedInfo.current;
2342
2623
  // Parses the info and adds necessary values
2343
- this.updateMeeting(parsedInfo.current);
2624
+ this.callbacks.updateMeeting(parsedInfo.current);
2344
2625
 
2345
2626
  this.emitScoped(
2346
2627
  {
@@ -2369,7 +2650,7 @@ export default class LocusInfo extends EventsScope {
2369
2650
 
2370
2651
  const parsedEmbeddedApps = EmbeddedAppsUtils.parse(embeddedApps);
2371
2652
 
2372
- this.updateMeeting({embeddedApps: parsedEmbeddedApps});
2653
+ this.callbacks.updateMeeting({embeddedApps: parsedEmbeddedApps});
2373
2654
 
2374
2655
  this.emitScoped(
2375
2656
  {
@@ -2394,7 +2675,7 @@ export default class LocusInfo extends EventsScope {
2394
2675
  if (mediaShares && (!isEqual(this.mediaShares, mediaShares) || forceUpdate)) {
2395
2676
  const parsedMediaShares = MediaSharesUtils.getMediaShares(this.mediaShares, mediaShares);
2396
2677
 
2397
- this.updateMeeting(parsedMediaShares.current);
2678
+ this.callbacks.updateMeeting(parsedMediaShares.current);
2398
2679
  this.parsedLocus.mediaShares = parsedMediaShares.current;
2399
2680
  this.mediaShares = mediaShares;
2400
2681
  this.emitScoped(
@@ -2440,7 +2721,7 @@ export default class LocusInfo extends EventsScope {
2440
2721
  this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
2441
2722
  );
2442
2723
 
2443
- this.updateMeeting(parsedSelves.current);
2724
+ this.callbacks.updateMeeting(parsedSelves.current);
2444
2725
  this.parsedLocus.self = parsedSelves.current;
2445
2726
 
2446
2727
  const element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
@@ -2458,7 +2739,7 @@ export default class LocusInfo extends EventsScope {
2458
2739
  );
2459
2740
 
2460
2741
  if (result?.sipUri) {
2461
- this.updateMeeting(result);
2742
+ this.callbacks.updateMeeting(result);
2462
2743
  }
2463
2744
 
2464
2745
  if (parsedSelves.updates.moderatorChanged) {
@@ -2585,6 +2866,7 @@ export default class LocusInfo extends EventsScope {
2585
2866
  {
2586
2867
  muted: parsedSelves.current.remoteMuted,
2587
2868
  unmuteAllowed: parsedSelves.current.unmuteAllowed,
2869
+ modifiedBy: parsedSelves.current.modifiedBy ?? null,
2588
2870
  }
2589
2871
  );
2590
2872
  }
@@ -2598,6 +2880,7 @@ export default class LocusInfo extends EventsScope {
2598
2880
  {
2599
2881
  muted: parsedSelves.current.remoteMuted,
2600
2882
  unmuteAllowed: parsedSelves.current.unmuteAllowed,
2883
+ modifiedBy: parsedSelves.current.modifiedBy ?? null,
2601
2884
  }
2602
2885
  );
2603
2886
  }
@@ -2724,7 +3007,7 @@ export default class LocusInfo extends EventsScope {
2724
3007
  updateLocusUrl(url: string, isMainLocus = true) {
2725
3008
  if (url && this.url !== url) {
2726
3009
  this.url = url;
2727
- this.updateMeeting({locusUrl: url});
3010
+ this.callbacks.updateMeeting({locusUrl: url});
2728
3011
  this.emitScoped(
2729
3012
  {
2730
3013
  file: 'locus-info',